From a635145f2ad5a0ac9cfa83ec6b9f5aa2a46b9e6f Mon Sep 17 00:00:00 2001 From: David Sheldrick Date: Tue, 3 Oct 2023 11:42:34 +0100 Subject: [PATCH] Fix group opacity (#1997) @SomeHats I'll leave this assigned to you in case you want to compare the perf of using consts/lets scoped to the visitor function. Or just do that anyway regardless of microperf. Either is fine with me. --- packages/editor/src/lib/editor/Editor.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/lib/editor/Editor.ts b/packages/editor/src/lib/editor/Editor.ts index 2e6fad1ab..5bd5aa2fd 100644 --- a/packages/editor/src/lib/editor/Editor.ts +++ b/packages/editor/src/lib/editor/Editor.ts @@ -3026,17 +3026,16 @@ export class Editor extends EventEmitter { const isCullingOffScreenShapes = Number.isFinite(this.renderingBoundsMargin) let shape: TLShape | undefined - let opacity: number let isShapeErasing: boolean let isCulled: boolean let util: ShapeUtil let maskedPageBounds: Box2d | undefined - const addShapeById = (id: TLShapeId, parentOpacity: number, isAncestorErasing: boolean) => { + const addShapeById = (id: TLShapeId, opacity: number, isAncestorErasing: boolean) => { shape = this.getShape(id) if (!shape) return - opacity = shape.opacity * parentOpacity + opacity *= shape.opacity isShapeErasing = false isCulled = false util = this.getShapeUtil(shape)