From 20777fb0debb88b257d26d49191125d356a6d474 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 9 Sep 2026 19:41:45 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20left/top=20resize=20=E2=80=94=20let=20Fi?= =?UTF-8?q?gma=20move=20window=20(no=20explicit=20reposition,=20kills=20ji?= =?UTF-8?q?tter)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main.ts b/src/main.ts index 52c3ff1..d1528f1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -152,19 +152,18 @@ export default function () { on('RESIZE_WINDOW_DRAG', function (payload: { dx: number; dy: number; dir: string }) { if (resizeAnchor == null) return const { dx, dy, dir } = payload - const zoom = figma.viewport.zoom || 1 let w = resizeAnchor.w let h = resizeAnchor.h - let nx = resizeAnchor.x - let ny = resizeAnchor.y if (dir.indexOf('right') !== -1) w = resizeAnchor.w + dx - if (dir.indexOf('left') !== -1) { w = resizeAnchor.w - dx; nx = resizeAnchor.x + dx / zoom } + if (dir.indexOf('left') !== -1) w = resizeAnchor.w - dx if (dir.indexOf('bottom') !== -1) h = resizeAnchor.h + dy - if (dir.indexOf('top') !== -1) { h = resizeAnchor.h - dy; ny = resizeAnchor.y + dy / zoom } + if (dir.indexOf('top') !== -1) h = resizeAnchor.h - dy const size = clampWindowSize({ width: w, height: h }) figma.ui.resize(size.width, size.height) lastSize = { width: size.width, height: size.height } - figma.ui.reposition(nx, ny) + // reposition НЕ вызываем: при resize Figma сама держит противоположный угол на месте + // (для left/top окно сдвигается автоматически). Явный reposition конфликтует с этим + // и даёт дрожание из-за округления getPosition() и 1/zoom. }) // Ресайз окна плагина (кастомные ручки по периметру -> RESIZE_WINDOW по pointerup)