Merge pull request #21 from AEmotionStudio/bolt/optimize-render-overlays-1998194206652878890
⚡ Bolt: Optimize rendering loop by hoisting getBoundingClientRect
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user