From cd9db8816c8ae8ff0c8269c60ec23dc9bd179204 Mon Sep 17 00:00:00 2001 From: Hiren Kangad Date: Fri, 13 Mar 2026 12:59:20 +0530 Subject: [PATCH] refboard: cull images by visible bounds --- frontend/src/canvas/PixiCanvas.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/canvas/PixiCanvas.tsx b/frontend/src/canvas/PixiCanvas.tsx index 6d447fb..4036fbe 100644 --- a/frontend/src/canvas/PixiCanvas.tsx +++ b/frontend/src/canvas/PixiCanvas.tsx @@ -205,8 +205,9 @@ const PixiCanvas = forwardRef( const nearbyItems = scene.queryRegion(qx, qy, qw, qh); for (const item of nearbyItems) { - const cx = item.data.x + (item.data.w * Math.abs(item.data.sx)) / 2; - const cy = item.data.y + (item.data.h * Math.abs(item.data.sy)) / 2; + const itemBounds = getItemWorldBounds(item); + const cx = itemBounds.x + itemBounds.w / 2; + const cy = itemBounds.y + itemBounds.h / 2; const dist = (cx - vcx) ** 2 + (cy - vcy) ** 2; if (item.type === 'image' && (item.displayObject instanceof ImageSprite || item.displayObject instanceof AnimatedGifSprite)) {