Auto-pan to center of counter

This commit is contained in:
Catalin Constantin Mititiuc 2024-08-08 14:54:08 -07:00
parent 9e5e82ca17
commit b970b34a88

View File

@ -27,7 +27,7 @@ export function manualPan(gb, counter) {
const counterRect = counter.getBoundingClientRect(); const counterRect = counter.getBoundingClientRect();
const mapRect = document.querySelector('object').getBoundingClientRect(); const mapRect = document.querySelector('object').getBoundingClientRect();
let startPt = new DOMPoint(counterRect.x, counterRect.y); let startPt = new DOMPoint(counterRect.x + counterRect.width / 2, counterRect.y + counterRect.height / 2);
let movePt = new DOMPoint(mapRect.width / 2, mapRect.height / 2); let movePt = new DOMPoint(mapRect.width / 2, mapRect.height / 2);
startPt = startPt.matrixTransform(inverseScreenCTM); startPt = startPt.matrixTransform(inverseScreenCTM);