refactor(review): use shared getPointAnchorWorld in jump-to-object

This commit is contained in:
Hiren Kangad
2026-03-12 22:09:12 +05:30
parent 40153751f6
commit 1134ddb5c9
+6 -2
View File
@@ -33,6 +33,7 @@ import { useAnchoredOverlayPosition } from '../hooks/useAnchoredOverlayPosition'
import { UploadManager } from '../stores/uploadManager'; import { UploadManager } from '../stores/uploadManager';
import { InboxZone } from '../canvas/InboxZone'; import { InboxZone } from '../canvas/InboxZone';
import { getItemWorldBounds } from '../canvas/SceneManager'; import { getItemWorldBounds } from '../canvas/SceneManager';
import { getPointAnchorWorld } from '../canvas/reviewAnchors';
import type { TextObject } from '../canvas/scene-format'; import type { TextObject } from '../canvas/scene-format';
import { VideoSprite } from '../canvas/sprites/VideoSprite'; import { VideoSprite } from '../canvas/sprites/VideoSprite';
import * as ops from '../canvas/operations'; import * as ops from '../canvas/operations';
@@ -1063,8 +1064,11 @@ export default function Editor({ isPublicView }: EditorProps) {
let centerX = b.x + b.w / 2; let centerX = b.x + b.w / 2;
let centerY = b.y + b.h / 2; let centerY = b.y + b.h / 2;
if (thread?.anchor_type === 'point' && thread.pin_x != null && thread.pin_y != null) { if (thread?.anchor_type === 'point' && thread.pin_x != null && thread.pin_y != null) {
centerX = b.x + thread.pin_x * b.w; const pinWorld = getPointAnchorWorld(scene, objectId, thread.pin_x, thread.pin_y);
centerY = b.y + thread.pin_y * b.h; if (pinWorld) {
centerX = pinWorld.x;
centerY = pinWorld.y;
}
} }
// Pan only by default; zoom in if object is too small on screen // Pan only by default; zoom in if object is too small on screen