소스 검색

fix: a performance issue on drawing

Peng Xiao 3 년 전
부모
커밋
bd693292eb
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      tldraw/packages/core/src/lib/TLPage/TLPage.ts

+ 3 - 3
tldraw/packages/core/src/lib/TLPage/TLPage.ts

@@ -225,7 +225,7 @@ export class TLPage<S extends TLShape = TLShape, E extends TLEventMap = TLEventM
   @action
   @action
   cleanup = (changedShapeIds: string[]) => {
   cleanup = (changedShapeIds: string[]) => {
     // Get bindings related to the changed shapes
     // Get bindings related to the changed shapes
-    const bindingsToUpdate = getRelatedBindings(this.serialized, changedShapeIds)
+    const bindingsToUpdate = getRelatedBindings(this.bindings, changedShapeIds)
     const visitedShapes = new Set<string>()
     const visitedShapes = new Set<string>()
 
 
     let shapeChanged = false
     let shapeChanged = false
@@ -495,9 +495,9 @@ export class TLPage<S extends TLShape = TLShape, E extends TLEventMap = TLEventM
   }
   }
 }
 }
 
 
-function getRelatedBindings(page: TLPageModel, ids: string[]): TLBinding[] {
+function getRelatedBindings(bindings: Record<string, TLBinding>, ids: string[]): TLBinding[] {
   const changedShapeIds = new Set(ids)
   const changedShapeIds = new Set(ids)
-  const bindingsArr = Object.values(page.bindings)
+  const bindingsArr = Object.values(bindings)
 
 
   // Start with bindings that are directly bound to our changed shapes
   // Start with bindings that are directly bound to our changed shapes
   const bindingsToUpdate = new Set(
   const bindingsToUpdate = new Set(