diff --git a/src/main.ts b/src/main.ts index d81ff0b..94f0c02 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,5 +10,5 @@ export default function () { figma.ui.resize(width, height) }) - showUI({ width: 320, height: 200, themeColors: true }) + showUI({ width: 320, height: 200, themeColors: true, title: 'AI assistant (MVP) — 320×200' }) } diff --git a/src/ui.tsx b/src/ui.tsx index cc77efc..23e8a2b 100644 --- a/src/ui.tsx +++ b/src/ui.tsx @@ -19,10 +19,17 @@ const MAX_WINDOW_SIZE = { width: 800, height: 800 } function Plugin () { const [currentWindowSize, setCurrentWindowSize] = useState(MIN_WINDOW_SIZE) - // Нативный drag-ресайз окна Figma (тянуть за правый нижний угол) + // Нативный drag-ресайз окна Figma (тянуть за правый нижний угол). + // Опции min/max обязательны: без них хук берёт базу из window.innerWidth на момент + // маунта (окно ещё не приняло размер от showUI) → первый drag не работает. useWindowResize(function (windowSize: { width: number; height: number }) { setCurrentWindowSize(windowSize) emit('RESIZE_WINDOW', windowSize) + }, { + minWidth: 320, + minHeight: 200, + maxWidth: 800, + maxHeight: 800 }) function toggleWindowSize () { @@ -41,7 +48,8 @@ function Plugin () { return ( -
+
+ {currentWindowSize.width} × {currentWindowSize.height} Hello, Figma ✦ AI assistant (MVP) — bootstrap - - - {currentWindowSize.width} × {currentWindowSize.height} -
{/* Декоративная иконка drag-хендла в правом нижнем углу (как в старом плагине).