Merge pull request #21 from AEmotionStudio/bolt/optimize-render-overlays-1998194206652878890

⚡ Bolt: Optimize rendering loop by hoisting getBoundingClientRect
This commit is contained in:
Æmotion Studio
2026-01-15 22:28:43 -08:00
committed by GitHub
2 changed files with 134 additions and 3 deletions
+3 -3
View File
@@ -454,10 +454,10 @@ export class MagnifyGlass {
if (elementToProcess && (isTextElement || isVideoElement || isImageElement)) {
const widgetRect = elementToProcess.getBoundingClientRect();
const canvasRect = this.litegraphCanvas!.getBoundingClientRect();
// Optimization: Reuse canvasRect and dpr from top level scope
const canvasRect = rect;
// DPR = backing pixels / CSS pixels
const dpr = canvasRect.width > 0 ? (this.litegraphCanvas!.width / canvasRect.width) : 1;
// DPR is already calculated at function start
const currentScale = this.state.canvasScale;
const isVirtualZoomMode = currentScale < 0.7;