feat: normalized window position relX/relY relative to viewport (no infinite-canvas coords)
This commit is contained in:
1 parent
153da94fde
commit
b57cda16ec
2 files changed
+15
No files matched your search
@@ -143,6 +143,13 @@ export default function () {
|
||||
const cx = Math.round(x + wCanvas / 2)
|
||||
const cy = Math.round(y + hCanvas / 2)
|
||||
|
||||
// Нормализованная позиция окна относительно видимого viewport (левый верхний угол
|
||||
// окна в координатах bounds). relX = x − bounds.x, relY = y − bounds.y. Это те же
|
||||
// значения, что gapL/gapT, но семантически — "где окно внутри видимой области",
|
||||
// без привязки к абсолютным (бесконечным) координатам canvas.
|
||||
const relX = Math.round(x - b.x)
|
||||
const relY = Math.round(y - b.y)
|
||||
|
||||
// Максимальный размер окна (экранные px) = весь видимый viewport (bounds * zoom).
|
||||
const maxViewport = {
|
||||
width: Math.max(320, Math.round(b.width * zoom)),
|
||||
@@ -166,6 +173,8 @@ export default function () {
|
||||
gapR,
|
||||
gapT,
|
||||
gapB,
|
||||
relX,
|
||||
relY,
|
||||
center: { x: cx, y: cy }
|
||||
})
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user