There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
perf(editor): reduce per frame viewport dom ops (#9431)
doodlewindd4053a345e46
diff --git a/blocksuite/framework/block-std/src/view/element/gfx-block-component.ts b/blocksuite/framework/block-std/src/view/element/gfx-block-component.tsindex 35b7655513..753dcc1f6d 100644--- a/blocksuite/framework/block-std/src/view/element/gfx-block-component.ts+++ b/blocksuite/framework/block-std/src/view/element/gfx-block-component.ts@@ -22,6 +22,7 @@ function updateTransform(element: GfxBlockComponent) {function handleGfxConnection(instance: GfxBlockComponent) {instance.style.position = 'absolute';+ instance.style.willChange = 'transform';instance.disposables.add(instance.gfx.viewport.viewportUpdated.on(() => {@@ -87,11 +88,11 @@ export abstract class GfxBlockComponent<override renderBlock() {const { x, y, w, h, zIndex } = this.getRenderingRect();- this.style.left = `${x}px`;- this.style.top = `${y}px`;- this.style.width = `${w}px`;- this.style.height = `${h}px`;- this.style.zIndex = zIndex;+ if (this.style.left !== `${x}px`) this.style.left = `${x}px`;+ if (this.style.top !== `${y}px`) this.style.top = `${y}px`;+ if (this.style.width !== `${w}px`) this.style.width = `${w}px`;+ if (this.style.height !== `${h}px`) this.style.height = `${h}px`;+ if (this.style.zIndex !== zIndex) this.style.zIndex = zIndex;return this.renderGfxBlock();}