feat: show derived window data (zoom, viewport, gaps, center)

- main.ts GET_WINDOW_INFO: add zoom, viewport bounds, gaps L/R/T/B, center
  computed from figma.viewport + plugin window geometry
- ui.tsx: render additional readout lines under 🔍 Инфо
This commit is contained in:
Hermes Agent committed 2026-09-09 13:18:32 +02:00
1 parent ecbbd5d8c1
commit dcfb235d06
2 files changed
+42 -4

No files matched your search

+11 -1
View File
@@ -19,7 +19,13 @@ const MAX_WINDOW_SIZE = { width: 800, height: 800 }
function Plugin () {
const [currentWindowSize, setCurrentWindowSize] = useState(MIN_WINDOW_SIZE)
const [windowInfo, setWindowInfo] = useState<{ x: number; y: number; width: number; height: number } | null>(null)
const [windowInfo, setWindowInfo] = useState<{
x: number; y: number; width: number; height: number
zoom: number
viewport: { x: number; y: number; width: number; height: number }
gapL: number; gapR: number; gapT: number; gapB: number
center: { x: number; y: number }
} | null>(null)
// Нативный drag-ресайз окна Figma (тянуть за правый нижний угол).
// Опции min/max обязательны: без них хук берёт базу из window.innerWidth на момент
@@ -119,6 +125,10 @@ function Plugin () {
<VerticalSpace space="small" />
<Muted>x: {windowInfo.x} y: {windowInfo.y}</Muted>
<Muted>w: {windowInfo.width} h: {windowInfo.height}</Muted>
<Muted>zoom: {windowInfo.zoom}</Muted>
<Muted>viewport: {windowInfo.viewport.x},{windowInfo.viewport.y} {windowInfo.viewport.width}×{windowInfo.viewport.height}</Muted>
<Muted>gaps L/R/T/B: {windowInfo.gapL}/{windowInfo.gapR}/{windowInfo.gapT}/{windowInfo.gapB}</Muted>
<Muted>center: {windowInfo.center.x},{windowInfo.center.y}</Muted>
</div>
)}
</div>