fix: resize anchored at start (no jump) — absolute target from RESIZE_START anchor

This commit is contained in:
Hermes Agent committed 2026-09-09 19:36:53 +02:00
1 parent 3c0ab7a67c
commit c8df3b8054
2 files changed
+37 -24

No files matched your search

+3 -10
View File
@@ -74,6 +74,8 @@ function Plugin () {
resizeRef.current.startY = e.clientY
resizeRef.current.startW = window.innerWidth
resizeRef.current.startH = window.innerHeight
// Сообщаем main зафиксировать якорь (старт-позиция + старт-размер) ДО первого движения.
emit('RESIZE_START', { dir: dir })
}
function onPointerMove (e: PointerEvent) {
@@ -81,16 +83,7 @@ function Plugin () {
const dir = resizeRef.current.dir
const dx = e.clientX - resizeRef.current.startX
const dy = e.clientY - resizeRef.current.startY
let w = resizeRef.current.startW
let h = resizeRef.current.startH
if (dir.indexOf('right') !== -1) w = resizeRef.current.startW + dx
if (dir.indexOf('left') !== -1) w = resizeRef.current.startW - dx
if (dir.indexOf('bottom') !== -1) h = resizeRef.current.startH + dy
if (dir.indexOf('top') !== -1) h = resizeRef.current.startH - dy
w = Math.max(320, w)
h = Math.max(200, h)
setCurrentWindowSize({ width: w, height: h })
emit('RESIZE_WINDOW_DRAG', { width: w, height: h, dx: dx, dy: dy, dir: dir })
emit('RESIZE_WINDOW_DRAG', { dx: dx, dy: dy, dir: dir })
}
function onPointerUpResize () {