feat(editor): replace slot with rxjs subject (#10768)

This commit is contained in:
Mirone
2025-03-12 11:29:24 +09:00
committed by GitHub
parent 19f978d9aa
commit cd63e0ed8b
302 changed files with 1405 additions and 1251 deletions

View File

@@ -303,14 +303,14 @@ export class AffineDocRemoteSelectionWidget extends WidgetComponent {
);
this.disposables.add(
this.std.store.slots.blockUpdated.on(() => {
this.std.store.slots.blockUpdated.subscribe(() => {
this._updateSelectionsThrottled(this._remoteSelections.peek());
})
);
const gfx = this.std.get(GfxControllerIdentifier);
this.disposables.add(
gfx.viewport.viewportUpdated.on(() => {
gfx.viewport.viewportUpdated.subscribe(() => {
const selections = this._remoteSelections.peek();
this._updateSelections(selections);
})

View File

@@ -184,27 +184,31 @@ export class EdgelessRemoteSelectionWidget extends WidgetComponent<RootBlockMode
if (this.surface) {
_disposables.add(
this.surface.elementAdded.on(this._updateOnElementChange)
this.surface.elementAdded.subscribe(this._updateOnElementChange)
);
_disposables.add(
this.surface.elementRemoved.on(this._updateOnElementChange)
this.surface.elementRemoved.subscribe(this._updateOnElementChange)
);
_disposables.add(
this.surface.elementUpdated.on(this._updateOnElementChange)
this.surface.elementUpdated.subscribe(this._updateOnElementChange)
);
}
_disposables.add(doc.slots.blockUpdated.on(this._updateOnElementChange));
_disposables.add(
this.selection.slots.remoteUpdated.on(this._updateRemoteRects)
);
_disposables.add(
this.selection.slots.remoteCursorUpdated.on(this._updateRemoteCursor)
doc.slots.blockUpdated.subscribe(this._updateOnElementChange)
);
_disposables.add(
this.gfx.viewport.viewportUpdated.on(() => {
this.selection.slots.remoteUpdated.subscribe(this._updateRemoteRects)
);
_disposables.add(
this.selection.slots.remoteCursorUpdated.subscribe(
this._updateRemoteCursor
)
);
_disposables.add(
this.gfx.viewport.viewportUpdated.subscribe(() => {
this._updateTransform();
})
);