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)