@netless/window-manager 1.0.0-canary.8 → 1.0.0-canary.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "1.0.0-canary.8",
3
+ "version": "1.0.0-canary.9",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -105,6 +105,7 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
105
105
  this._viewWrapper = undefined;
106
106
  }
107
107
  view.divElement = viewWrapper;
108
+ this.appProxy.fireMemberStateChange();
108
109
  if (this.isAddApp) {
109
110
  this.ensurePageSize(size);
110
111
  }
@@ -130,7 +131,7 @@ export class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOption
130
131
 
131
132
  /** Get App writable status. */
132
133
  public get isWritable(): boolean {
133
- return this.manager.canOperate;
134
+ return this.manager.canOperate && !this.destroyed;
134
135
  };
135
136
 
136
137
  /** Get the App Window UI box. */
@@ -8,7 +8,7 @@ import { autorun, reaction, toJS } from "white-web-sdk";
8
8
  import { boxEmitter } from "../BoxEmitter";
9
9
  import { BoxManagerNotFoundError } from "../Utils/error";
10
10
  import { calculateNextIndex } from "../Page";
11
- import { combine, Val } from "value-enhancer";
11
+ import { combine, Val, ValManager } from "value-enhancer";
12
12
  import { debounce, get } from "lodash";
13
13
  import { emitter } from "../InternalEmitter";
14
14
  import { Fields } from "../AttributesDelegate";
@@ -30,7 +30,7 @@ import type {
30
30
  setAppOptions,
31
31
  AppListenerKeys,
32
32
  } from "../index";
33
- import type { SceneState, View, SceneDefinition, Camera } from "white-web-sdk";
33
+ import type { SceneState, View, SceneDefinition, Camera , MemberState} from "white-web-sdk";
34
34
  import type { AppManager } from "../AppManager";
35
35
  import type { NetlessApp } from "../typings";
36
36
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
@@ -57,20 +57,20 @@ export class AppProxy implements PageRemoveService {
57
57
  public status: "normal" | "destroyed" = "normal";
58
58
  private stateKey: string;
59
59
  public _pageState: AppPageStateImpl;
60
- private _prevFullPath: string | undefined;
61
60
 
62
61
  public appResult?: NetlessApp<any>;
63
62
  public appContext?: AppContext<any, any>;
64
63
 
65
64
  private sideEffectManager = new SideEffectManager();
65
+ private valManager = new ValManager();
66
66
 
67
- public camera$ = new Val<ICamera | undefined>(undefined);
68
- public size$ = new Val<ISize | undefined>(undefined);
69
-
67
+ private fullPath$ = this.valManager.attach(new Val<string | undefined>(undefined));
70
68
  private appViewSync?: AppViewSync;
71
69
 
72
- public box$ = new Val<ReadonlyTeleBox | undefined>(undefined);
73
- public view$ = new Val<View | undefined>(undefined);
70
+ public camera$ = this.valManager.attach(new Val<ICamera | undefined>(undefined));
71
+ public size$ = this.valManager.attach(new Val<ISize | undefined>(undefined));
72
+ public box$ = this.valManager.attach(new Val<ReadonlyTeleBox | undefined>(undefined));
73
+ public view$ = this.valManager.attach(new Val<View | undefined>(undefined));
74
74
 
75
75
  constructor(
76
76
  private params: BaseInsertParams,
@@ -110,63 +110,56 @@ export class AppProxy implements PageRemoveService {
110
110
  );
111
111
  this.camera$.setValue(toJS(this.appAttributes.camera));
112
112
  this.size$.setValue(toJS(this.appAttributes.size));
113
- this.sideEffectManager.add(() => {
114
- return this.manager.refresher.add(`${this.id}-camera`, () => {
115
- return reaction(
116
- () => this.appAttributes?.camera,
117
- camera => {
118
- if (camera && camera.id !== this.uid) {
119
- this.camera$.setValue(toJS(camera));
120
- }
113
+ this.addCameraReaction();
114
+ this.addSizeReaction();
115
+ this.sideEffectManager.add(() =>
116
+ combine([this.box$, this.view$]).subscribe(([box, view]) => {
117
+ if (box && view) {
118
+ if (!this.camera$.value) {
119
+ this.storeCamera({
120
+ centerX: 0,
121
+ centerY: 0,
122
+ scale: 1,
123
+ id: this.uid,
124
+ });
125
+ this.camera$.setValue(toJS(this.appAttributes.camera));
121
126
  }
122
- );
123
- });
124
- });
125
- this.sideEffectManager.add(() => {
126
- return this.manager.refresher.add(`${this.id}-size`, () => {
127
- return reaction(
128
- () => this.appAttributes?.size,
129
- size => {
130
- if (size && size.id !== this.uid) {
131
- this.size$.setValue(toJS(size));
132
- }
127
+ if (!this.size$.value && box.contentStageRect) {
128
+ this.storeSize({
129
+ id: this.uid,
130
+ width: box.contentStageRect?.width,
131
+ height: box.contentStageRect?.height,
132
+ });
133
+ this.size$.setValue(toJS(this.appAttributes.size));
133
134
  }
134
- );
135
- });
136
- });
137
- combine([this.box$, this.view$]).subscribe(([box, view]) => {
138
- if (box && view) {
139
- if (!this.camera$.value) {
140
- this.storeCamera({
141
- centerX: 0, centerY: 0, scale: 1, id: this.uid,
142
- });
143
- this.camera$.setValue(toJS(this.appAttributes.camera));
135
+ this.appViewSync = new AppViewSync(this);
136
+ this.sideEffectManager.add(() => () => this.appViewSync?.destroy());
144
137
  }
145
- if (!this.size$.value && box.contentStageRect) {
146
- this.storeSize({
147
- id: this.uid,
148
- width: box.contentStageRect?.width,
149
- height: box.contentStageRect?.height,
150
- });
151
- this.size$.setValue(toJS(this.appAttributes.size));
152
- }
153
- this.appViewSync = new AppViewSync(this);
154
- this.sideEffectManager.add(() => () => this.appViewSync?.destroy());
138
+ })
139
+ );
140
+ this.sideEffectManager.add(() =>
141
+ emitter.on("memberStateChange", this.onMemberStateChange)
142
+ );
143
+ }
144
+
145
+ public fireMemberStateChange = () => {
146
+ if (this.manager.room) {
147
+ this.onMemberStateChange(this.manager.room.state.memberState);
148
+ }
149
+ }
150
+
151
+ private onMemberStateChange = (memberState: MemberState) => {
152
+ // clicker 教具把事件穿透给下层
153
+ const needPointerEventsNone = memberState.currentApplianceName === "clicker";
154
+ if (needPointerEventsNone) {
155
+ if (this.appContext?._viewWrapper) {
156
+ this.appContext._viewWrapper.style.pointerEvents = "none";
155
157
  }
156
- });
157
- this.sideEffectManager.add(() => emitter.on("memberStateChange", memberState => {
158
- // clicker 教具把事件穿透给下层
159
- const needPointerEventsNone = memberState.currentApplianceName === "clicker";
160
- if (needPointerEventsNone) {
161
- if (this.appContext?._viewWrapper) {
162
- this.appContext._viewWrapper.style.pointerEvents = "none";
163
- }
164
- } else {
165
- if (this.appContext?._viewWrapper) {
166
- this.appContext._viewWrapper.style.pointerEvents = "auto";
167
- }
158
+ } else {
159
+ if (this.appContext?._viewWrapper) {
160
+ this.appContext._viewWrapper.style.pointerEvents = "auto";
168
161
  }
169
- }));
162
+ }
170
163
  }
171
164
 
172
165
  public createAppDir() {
@@ -196,7 +189,7 @@ export class AppProxy implements PageRemoveService {
196
189
  }
197
190
 
198
191
  public get view(): View | undefined {
199
- return this.manager.viewManager.getView(this.id);
192
+ return this.view$.value;
200
193
  }
201
194
 
202
195
  public get viewIndex(): number | undefined {
@@ -446,7 +439,7 @@ export class AppProxy implements PageRemoveService {
446
439
  }
447
440
 
448
441
  private appAttributesUpdateListener = (appId: string) => {
449
- this.manager.refresher?.add(appId, () => {
442
+ this.manager.refresher.add(appId, () => {
450
443
  return autorun(() => {
451
444
  const attrs = this.manager.attributes[appId];
452
445
  if (attrs) {
@@ -454,7 +447,7 @@ export class AppProxy implements PageRemoveService {
454
447
  }
455
448
  });
456
449
  });
457
- this.manager.refresher?.add(this.stateKey, () => {
450
+ this.manager.refresher.add(this.stateKey, () => {
458
451
  return autorun(() => {
459
452
  const appState = this.appAttributes?.state;
460
453
  if (appState?.zIndex > 0 && appState.zIndex !== this.box?.zIndex) {
@@ -462,13 +455,13 @@ export class AppProxy implements PageRemoveService {
462
455
  }
463
456
  });
464
457
  });
465
- this.manager.refresher?.add(`${appId}-fullPath`, () => {
458
+ this.manager.refresher.add(`${appId}-fullPath`, () => {
466
459
  return autorun(() => {
467
460
  const fullPath = this.appAttributes?.fullPath;
468
461
  this.setFocusScenePathHandler(fullPath);
469
- if (this._prevFullPath !== fullPath) {
462
+ if (this.fullPath$.value !== fullPath) {
470
463
  this.notifyPageStateChange();
471
- this._prevFullPath = fullPath;
464
+ this.fullPath$.setValue(fullPath);
472
465
  }
473
466
  });
474
467
  });
@@ -598,13 +591,40 @@ export class AppProxy implements PageRemoveService {
598
591
 
599
592
  this.viewManager.destroyView(this.id);
600
593
  this.manager.appStatus.delete(this.id);
601
- this.manager.refresher?.remove(this.id);
602
- this.manager.refresher?.remove(this.stateKey);
603
- this.manager.refresher?.remove(`${this.id}-fullPath`);
604
- this._prevFullPath = undefined;
605
- this.camera$.destroy();
606
- this.size$.destroy();
607
- this.box$.destroy();
594
+ this.manager.refresher.remove(this.id);
595
+ this.manager.refresher.remove(this.stateKey);
596
+ this.manager.refresher.remove(`${this.id}-fullPath`);
597
+ this.valManager.destroy();
598
+ }
599
+
600
+ private addCameraReaction = () => {
601
+ this.sideEffectManager.add(() =>
602
+ this.manager.refresher.add(`${this.id}-camera`, () =>
603
+ reaction(
604
+ () => this.appAttributes?.camera,
605
+ camera => {
606
+ if (camera && camera.id !== this.uid) {
607
+ this.camera$.setValue(toJS(camera));
608
+ }
609
+ }
610
+ )
611
+ )
612
+ , "camera");
613
+ }
614
+
615
+ private addSizeReaction = () => {
616
+ this.sideEffectManager.add(() =>
617
+ this.manager.refresher.add(`${this.id}-size`, () =>
618
+ reaction(
619
+ () => this.appAttributes?.size,
620
+ size => {
621
+ if (size && size.id !== this.uid) {
622
+ this.size$.setValue(toJS(size));
623
+ }
624
+ }
625
+ )
626
+ )
627
+ , "size");
608
628
  }
609
629
 
610
630
  public close(): Promise<void> {
package/src/AppManager.ts CHANGED
@@ -18,6 +18,7 @@ import { RedoUndo } from "./RedoUndo";
18
18
  import { serializeRoomMembers } from "./Helper";
19
19
  import { SideEffectManager } from "side-effect-manager";
20
20
  import { ViewManager } from "./View/ViewManager";
21
+ import { Val } from "value-enhancer";
21
22
  import type { SyncRegisterAppPayload } from "./Register";
22
23
  import type { RemoveSceneParams } from "./InternalEmitter";
23
24
  import {
@@ -63,10 +64,10 @@ export class AppManager {
63
64
  private appListeners: AppListeners;
64
65
  public boxManager?: BoxManager;
65
66
 
66
- private _prevSceneIndex: number | undefined;
67
- private _prevFocused: string | undefined;
68
67
  private callbacksNode: ScenesCallbacksNode | null = null;
69
68
  private appCreateQueue = new AppCreateQueue();
69
+ private sceneIndex$ = new Val<number | undefined>(undefined);
70
+ private focused$ = new Val<string | undefined>(undefined);
70
71
 
71
72
  private sideEffectManager = new SideEffectManager();
72
73
 
@@ -324,31 +325,31 @@ export class AppManager {
324
325
 
325
326
  this.addAppsChangeListener();
326
327
  this.addAppCloseListener();
327
- this.refresher?.add("maximized", () => {
328
+ this.refresher.add("maximized", () => {
328
329
  return autorun(() => {
329
330
  const maximized = this.attributes.maximized;
330
331
  this.boxManager?.setMaximized(Boolean(maximized));
331
332
  });
332
333
  });
333
- this.refresher?.add("minimized", () => {
334
+ this.refresher.add("minimized", () => {
334
335
  return autorun(() => {
335
336
  const minimized = this.attributes.minimized;
336
337
  this.onMinimized(minimized);
337
338
  });
338
339
  });
339
- this.refresher?.add("mainViewIndex", () => {
340
+ this.refresher.add("mainViewIndex", () => {
340
341
  return autorun(() => {
341
342
  const mainSceneIndex = get(this.attributes, "_mainSceneIndex");
342
343
  this.onMainViewIndexChange(mainSceneIndex);
343
344
  });
344
345
  });
345
- this.refresher?.add("focusedChange", () => {
346
+ this.refresher.add("focusedChange", () => {
346
347
  return autorun(() => {
347
348
  const focused = get(this.attributes, "focus");
348
349
  this.onFocusChange(focused);
349
350
  });
350
351
  });
351
- this.refresher?.add("registeredChange", () => {
352
+ this.refresher.add("registeredChange", () => {
352
353
  return autorun(() => {
353
354
  const registered = get(this.attributes, Fields.Registered);
354
355
  this.onRegisteredChange(registered);
@@ -361,7 +362,7 @@ export class AppManager {
361
362
  }
362
363
  this.displayerWritableListener(!this.room?.isWritable);
363
364
  this.displayer.callbacks.on("onEnableWriteNowChanged", this.displayerWritableListener);
364
- this._prevFocused = this.attributes.focus;
365
+ this.focused$.setValue(this.attributes.focus);
365
366
 
366
367
  this.sideEffectManager.add(() => {
367
368
  const redoUndo = new RedoUndo({
@@ -426,21 +427,21 @@ export class AppManager {
426
427
  };
427
428
 
428
429
  private onMainViewIndexChange = (index: number) => {
429
- if (index !== undefined && this._prevSceneIndex !== index) {
430
+ if (index !== undefined && this.sceneIndex$.value !== index) {
430
431
  callbacks.emit("mainViewSceneIndexChange", index);
431
432
  emitter.emit("changePageState");
432
433
  if (this.callbacksNode) {
433
434
  this.updateSceneState(this.callbacksNode);
434
435
  }
435
- this._prevSceneIndex = index;
436
+ this.sceneIndex$.setValue(index);
436
437
  }
437
438
  };
438
439
 
439
440
  private onFocusChange = (focused: string | undefined) => {
440
- if (this._prevFocused !== focused) {
441
+ if (this.focused$.value !== focused) {
441
442
  callbacks.emit("focusedChange", focused);
442
- emitter.emit("focusedChange", { focused, prev: this._prevFocused });
443
- this._prevFocused = focused;
443
+ emitter.emit("focusedChange", { focused, prev: this.focused$.value });
444
+ this.focused$.setValue(focused);
444
445
  if (focused !== undefined) {
445
446
  this.boxManager?.focusBox({ appId: focused });
446
447
  // 确保 focus 修改的时候, appProxy 已经创建
@@ -687,12 +688,9 @@ export class AppManager {
687
688
  appProxy.emitAppIsWritableChange();
688
689
  });
689
690
  if (isWritable === true) {
690
- this.mainView.disableCameraTransform = false;
691
691
  if (this.room && this.room.disableSerialization === true) {
692
692
  this.room.disableSerialization = false;
693
693
  }
694
- } else {
695
- this.mainView.disableCameraTransform = true;
696
694
  }
697
695
  emitter.emit("writableChange", isWritable);
698
696
  };
@@ -834,7 +832,7 @@ export class AppManager {
834
832
  }
835
833
  callbacks.clearListeners();
836
834
  this.sideEffectManager.flushAll();
837
- this._prevFocused = undefined;
838
- this._prevSceneIndex = undefined;
835
+ this.sceneIndex$.destroy();
836
+ this.focused$.destroy();
839
837
  }
840
838
  }
package/src/BoxManager.ts CHANGED
@@ -47,11 +47,11 @@ export type CreateTeleBoxManagerConfig = {
47
47
  collectorStyles?: Partial<CSSStyleDeclaration>;
48
48
  prefersColorScheme?: TeleBoxColorScheme;
49
49
  stageRatio?: number;
50
+ highlightStage?: boolean;
50
51
  };
51
52
 
52
53
  export type BoxManagerContext = {
53
54
  safeSetAttributes: (attributes: any) => void;
54
- getMainView: () => View;
55
55
  updateAppState: (appId: string, field: AppAttributes, value: any) => void;
56
56
  emitter: EmitterType;
57
57
  boxEmitter: BoxEmitterType;
@@ -72,7 +72,6 @@ export const createBoxManager = (
72
72
  return new BoxManager(
73
73
  {
74
74
  safeSetAttributes: (attributes: any) => manager.safeSetAttributes(attributes),
75
- getMainView: () => manager.mainView,
76
75
  updateAppState: (...args) => manager.appManager?.store.updateAppState(...args),
77
76
  canOperate: () => manager.canOperate,
78
77
  notifyContainerRectUpdate: (rect: TeleBoxRect) =>
@@ -178,10 +177,6 @@ export class BoxManager {
178
177
  ]);
179
178
  }
180
179
 
181
- private get mainView() {
182
- return this.context.getMainView();
183
- }
184
-
185
180
  private get canOperate() {
186
181
  return this.context.canOperate();
187
182
  }
@@ -251,6 +246,7 @@ export class BoxManager {
251
246
  root: root,
252
247
  fence: false,
253
248
  prefersColorScheme: createTeleBoxManagerConfig?.prefersColorScheme,
249
+ highlightStage: createTeleBoxManagerConfig?.highlightStage,
254
250
  };
255
251
 
256
252
  const manager = new TeleBoxManager(initManagerState);
@@ -13,6 +13,7 @@ export type PageState = {
13
13
  export interface PageController {
14
14
  nextPage: () => Promise<boolean>;
15
15
  prevPage: () => Promise<boolean>;
16
+ jumpPage: (index: number) => Promise<boolean>;
16
17
  addPage: (params?: AddPageParams) => Promise<void>;
17
18
  removePage: (index: number) => Promise<boolean>;
18
19
  pageState: PageState;
@@ -1,7 +1,7 @@
1
1
  import { AnimationMode } from "white-web-sdk";
2
2
  import { delay, throttle } from "lodash";
3
3
  import type { TeleBoxRect } from "@netless/telebox-insider";
4
- import type { Camera, View, Size } from "white-web-sdk";
4
+ import type { Camera, View } from "white-web-sdk";
5
5
  import type { ISize } from "../AttributesDelegate";
6
6
 
7
7
  export type SaveCamera = (camera: Camera) => void;
@@ -53,21 +53,4 @@ export class CameraSynchronizer {
53
53
  this.saveCamera(camera);
54
54
  this.remoteCamera = camera;
55
55
  }
56
-
57
- // 本地 Size 更新, 先匹配 camera 到新的 size 然后再发送 camera 数据到远端
58
- public onLocalSizeUpdate = (size: Size) => {
59
- if (this.rect && this.view) {
60
- let scale: number;
61
- if (size.width < size.height) {
62
- scale = this.rect.width / size.width;
63
- } else {
64
- scale = this.rect.height / size.height;
65
- }
66
- const nextScale = this.view.camera.scale / scale;
67
- this.view.moveCamera({
68
- scale: nextScale,
69
- animationMode: AnimationMode.Immediately
70
- });
71
- }
72
- }
73
56
  }
@@ -32,34 +32,29 @@ export class MainViewProxy {
32
32
  this.ensureCameraAndSize();
33
33
  this.startListenWritableChange();
34
34
  });
35
- this.sideEffectManager.add(() => {
36
- return emitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
37
- });
38
- this.sideEffectManager.add(() => {
39
- return emitter.on("startReconnect", () => {
35
+ this.sideEffectManager.add(() => [
36
+ emitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio),
37
+ emitter.on("startReconnect", () => {
40
38
  releaseView(this.mainView);
41
- });
42
- });
39
+ }),
40
+ emitter.on("playgroundSizeChange", rect => {
41
+ this.synchronizer.setRect(rect);
42
+ })
43
+ ]);
43
44
  const rect = this.manager.boxManager?.stageRect;
44
45
  if (rect) {
45
46
  this.synchronizer.setRect(rect);
46
47
  }
47
- this.sideEffectManager.add(() => {
48
- return emitter.on("playgroundSizeChange", rect => {
49
- this.synchronizer.setRect(rect);
50
- // this.synchronizer.onLocalSizeUpdate(rect);
51
- });
52
- });
53
48
  }
54
49
 
55
50
  private startListenWritableChange = () => {
56
- this.sideEffectManager.add(() => {
57
- return emitter.on("writableChange", isWritable => {
51
+ this.sideEffectManager.add(() =>
52
+ emitter.on("writableChange", isWritable => {
58
53
  if (isWritable) {
59
54
  this.ensureCameraAndSize();
60
55
  }
61
- });
62
- });
56
+ })
57
+ );
63
58
  };
64
59
 
65
60
  public ensureCameraAndSize() {
@@ -87,14 +82,13 @@ export class MainViewProxy {
87
82
 
88
83
  public start() {
89
84
  if (this.started) return;
90
- this.sizeChangeHandler(this.mainViewSize);
91
85
  this.addCameraListener();
92
86
  this.addCameraReaction();
93
87
  this.started = true;
94
88
  }
95
89
 
96
90
  public addCameraReaction = () => {
97
- this.manager.refresher?.add(Fields.MainViewCamera, this.cameraReaction);
91
+ this.manager.refresher.add(Fields.MainViewCamera, this.cameraReaction);
98
92
  };
99
93
 
100
94
  public setCameraAndSize(): void {
@@ -118,15 +112,8 @@ export class MainViewProxy {
118
112
  );
119
113
  };
120
114
 
121
- public sizeChangeHandler = debounce((size: Size) => {
122
- if (size) {
123
- // this.synchronizer.onLocalSizeUpdate(size);
124
- }
125
- }, 30);
126
-
127
115
  public onUpdateContainerSizeRatio = () => {
128
116
  const size = this.store.getMainViewSize();
129
- this.sizeChangeHandler(size);
130
117
  if (size.id === this.manager.uid) {
131
118
  this.setCameraAndSize();
132
119
  }
@@ -242,8 +229,8 @@ export class MainViewProxy {
242
229
 
243
230
  public stop() {
244
231
  this.removeCameraListener();
245
- this.manager.refresher?.remove(Fields.MainViewCamera);
246
- this.manager.refresher?.remove(Fields.MainViewSize);
232
+ this.manager.refresher.remove(Fields.MainViewCamera);
233
+ this.manager.refresher.remove(Fields.MainViewSize);
247
234
  this.started = false;
248
235
  }
249
236
 
package/src/index.ts CHANGED
@@ -129,8 +129,8 @@ export type MountParams = {
129
129
  container?: HTMLElement;
130
130
  /** 白板高宽比例, 默认为 9 / 16 */
131
131
  containerSizeRatio?: number;
132
- /** 显示 PS 透明背景,默认 true */
133
- chessboard?: boolean;
132
+ /** 是否高亮显示同步区域, 默认为 true */
133
+ highlightStage?: boolean;
134
134
  collectorContainer?: HTMLElement;
135
135
  collectorStyles?: Partial<CSSStyleDeclaration>;
136
136
  overwriteStyles?: string;
@@ -241,6 +241,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
241
241
  collectorStyles: params.collectorStyles,
242
242
  prefersColorScheme: params.prefersColorScheme,
243
243
  stageRatio: params.containerSizeRatio,
244
+ highlightStage: params.highlightStage
244
245
  });
245
246
  manager.appManager?.setBoxManager(manager.boxManager);
246
247
  if (params.container) {
@@ -504,6 +505,18 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
504
505
  }
505
506
  }
506
507
 
508
+ public async jumpPage(index: number): Promise<boolean> {
509
+ if (!this.appManager) {
510
+ return false;
511
+ }
512
+ if (index < 0 || index >= this.pageState.length) {
513
+ console.warn(`[WindowManager]: index ${index} out of range`);
514
+ return false;
515
+ }
516
+ await this.appManager.setMainViewSceneIndex(index);
517
+ return true;
518
+ }
519
+
507
520
  public async addPage(params?: AddPageParams): Promise<void> {
508
521
  if (this.appManager) {
509
522
  const after = params?.after;
@@ -1,7 +0,0 @@
1
- import type { Camera, Size } from "white-web-sdk";
2
- export interface ViewSync {
3
- readonly camera: Camera;
4
- readonly size: Size;
5
- setCamera: (camera: Camera) => void;
6
- setSize: (size: Size) => void;
7
- }
@@ -1,10 +0,0 @@
1
- import type { Camera, Size } from "white-web-sdk";
2
-
3
-
4
- export interface ViewSync {
5
- readonly camera: Camera;
6
- readonly size: Size;
7
-
8
- setCamera: (camera: Camera) => void;
9
- setSize: (size: Size) => void;
10
- }