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.
This commit is contained in:
David Sheldrick 2023-10-03 11:42:34 +01:00 committed by GitHub
parent 2694a7ab48
commit a635145f2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3026,17 +3026,16 @@ export class Editor extends EventEmitter<TLEventMap> {
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)