Skip to content

Commit b2ec56b

Browse files
authored
refactor(whiteboard): change the way to update the scenesLength value (#1335)
1 parent b252d3f commit b2ec56b

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

desktop/renderer-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@netless/redo-undo": "^0.1.9",
1818
"@netless/tool-box": "^0.1.6",
1919
"@netless/video-js-plugin": "^0.3.6",
20-
"@netless/window-manager": "0.4.0-canary.26",
20+
"@netless/window-manager": "0.4.0-canary.27",
2121
"@videojs/vhs-utils": "^2.3.0",
2222
"agora-rtm-sdk": "^1.4.3",
2323
"antd": "^4.15.4",

desktop/renderer-app/src/components/Whiteboard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export const Whiteboard = observer<WhiteboardProps>(function Whiteboard({
6363

6464
whiteboardStore.updateWindowManager(windowManager);
6565
whiteboardStore.onMainViewSceneChange();
66+
whiteboardStore.onMainViewSceneLengthChange();
6667
whiteboardStore.onMainViewRedoUndoStepsChange();
6768
whiteboardStore.onWindowManagerBoxStateChange(
6869
whiteboardStore.windowManager?.boxState,

desktop/renderer-app/src/stores/whiteboard-store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,16 @@ export class WhiteboardStore {
270270
this.windowManager?.emitter.on("mainViewSceneIndexChange", scene => {
271271
if (this.room) {
272272
this.updateCurrentSceneIndex(scene);
273-
this.updateScenesCount(this.room.entireScenes()["/"].length);
274273
}
275274
});
276275
};
277276

277+
public onMainViewSceneLengthChange = (): void => {
278+
this.windowManager?.emitter.on("mainViewScenesLengthChange", length => {
279+
this.updateScenesCount(length);
280+
});
281+
};
282+
278283
public onMainViewRedoUndoStepsChange = (): void => {
279284
this.windowManager?.mainView.callbacks.on("onCanUndoStepsUpdate", this.updateUndoSteps);
280285
this.windowManager?.mainView.callbacks.on("onCanRedoStepsUpdate", this.updateRedoSteps);

web/flat-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@netless/redo-undo": "^0.1.9",
5151
"@netless/tool-box": "^0.1.6",
5252
"@netless/video-js-plugin": "^0.3.6",
53-
"@netless/window-manager": "0.4.0-canary.26",
53+
"@netless/window-manager": "0.4.0-canary.27",
5454
"@videojs/vhs-utils": "^2.3.0",
5555
"@zip.js/zip.js": "^2.3.7",
5656
"agora-rtc-sdk-ng": "^4.5.0",

web/flat-web/src/components/Whiteboard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export const Whiteboard = observer<WhiteboardProps>(function Whiteboard({
6363

6464
whiteboardStore.updateWindowManager(windowManager);
6565
whiteboardStore.onMainViewSceneChange();
66+
whiteboardStore.onMainViewSceneLengthChange();
6667
whiteboardStore.onMainViewRedoUndoStepsChange();
6768
whiteboardStore.onWindowManagerBoxStateChange(
6869
whiteboardStore.windowManager?.boxState,

web/flat-web/src/stores/whiteboard-store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,16 @@ export class WhiteboardStore {
268268
this.windowManager?.emitter.on("mainViewSceneIndexChange", scene => {
269269
if (this.room) {
270270
this.updateCurrentSceneIndex(scene);
271-
this.updateScenesCount(this.room.entireScenes()["/"].length);
272271
}
273272
});
274273
};
275274

275+
public onMainViewSceneLengthChange = (): void => {
276+
this.windowManager?.emitter.on("mainViewScenesLengthChange", length => {
277+
this.updateScenesCount(length);
278+
});
279+
};
280+
276281
public onMainViewRedoUndoStepsChange = (): void => {
277282
this.windowManager?.mainView.callbacks.on("onCanUndoStepsUpdate", this.updateUndoSteps);
278283
this.windowManager?.mainView.callbacks.on("onCanRedoStepsUpdate", this.updateRedoSteps);

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,10 +1946,10 @@
19461946
resolved "https://registry.yarnpkg.com/@netless/video-js-plugin/-/video-js-plugin-0.3.7.tgz#6c1f174f20e8a93634e1770e7e535c1302bdf22b"
19471947
integrity sha512-UG1t9464w1bZT9kzdhxj/K7R6jqI9sqYfqfUQJ2w9JRWsNibL6O16OC81iwBJT6nkGXEVN7z2pqHvNg1OhKppw==
19481948

1949-
"@netless/[email protected].26":
1950-
version "0.4.0-canary.26"
1951-
resolved "https://registry.npmjs.org/@netless/window-manager/-/window-manager-0.4.0-canary.26.tgz#7be89444e5bfea60104bfac83b2795cee868f0c6"
1952-
integrity sha512-q8ksfesJsBgtEhQkJjrcIayKhcsw8OJ/Up/2uHVkm0yqd++RVRT7j0Yu6eSY6AFk3wa6+jYzQmx5h8lTx0vYnw==
1949+
"@netless/[email protected].27":
1950+
version "0.4.0-canary.27"
1951+
resolved "https://registry.npmjs.org/@netless/window-manager/-/window-manager-0.4.0-canary.27.tgz#67ff060e0605af203380f2b65a269f6b8893031e"
1952+
integrity sha512-bfku4CfNsDmlszuooeakmPyS3hRcRsefIwrTZp2AM7atzouutNA1Of4g+8YEM9EVhZiXAMaBQCT7KT1iqrKaZA==
19531953
dependencies:
19541954
"@juggle/resize-observer" "^3.3.1"
19551955
emittery "^0.9.2"

0 commit comments

Comments
 (0)