@netless/window-manager 0.4.11-canary.2 → 0.4.11
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/CHANGELOG.md +8 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/PageState.ts +5 -5
- package/src/index.ts +6 -2
package/package.json
CHANGED
package/src/PageState.ts
CHANGED
@@ -5,14 +5,14 @@ import { emitter } from "./InternalEmitter";
|
|
5
5
|
export type PageState = {
|
6
6
|
index: number;
|
7
7
|
length: number;
|
8
|
-
}
|
8
|
+
};
|
9
9
|
|
10
10
|
export class PageStateImpl {
|
11
11
|
constructor(private manager: AppManager) {
|
12
12
|
emitter.on("changePageState", () => {
|
13
|
-
callbacks.emit("pageStateChange", this.toObject())
|
13
|
+
callbacks.emit("pageStateChange", this.toObject());
|
14
14
|
});
|
15
|
-
}
|
15
|
+
}
|
16
16
|
|
17
17
|
public get index(): number {
|
18
18
|
return this.manager?.store.getMainViewSceneIndex() || 0;
|
@@ -25,7 +25,7 @@ export class PageStateImpl {
|
|
25
25
|
public toObject(): PageState {
|
26
26
|
return {
|
27
27
|
index: this.index,
|
28
|
-
length: this.length
|
29
|
-
}
|
28
|
+
length: this.length,
|
29
|
+
};
|
30
30
|
}
|
31
31
|
}
|
package/src/index.ts
CHANGED
@@ -176,6 +176,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
176
176
|
private static params?: MountParams;
|
177
177
|
|
178
178
|
private containerResizeObserver?: ContainerResizeObserver;
|
179
|
+
public containerSizeRatio = WindowManager.containerSizeRatio;
|
179
180
|
|
180
181
|
constructor(context: InvisiblePluginContext) {
|
181
182
|
super(context);
|
@@ -240,6 +241,9 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
240
241
|
manager.appManager = new AppManager(manager);
|
241
242
|
manager._pageState = new PageStateImpl(manager.appManager);
|
242
243
|
manager.cursorManager = new CursorManager(manager.appManager, Boolean(cursor));
|
244
|
+
if (containerSizeRatio) {
|
245
|
+
manager.containerSizeRatio = containerSizeRatio;
|
246
|
+
}
|
243
247
|
|
244
248
|
if (params.container) {
|
245
249
|
manager.bindContainer(params.container);
|
@@ -646,7 +650,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
646
650
|
}
|
647
651
|
|
648
652
|
public get mainViewSceneIndex(): number {
|
649
|
-
return this.
|
653
|
+
return this._pageState?.index || 0;
|
650
654
|
}
|
651
655
|
|
652
656
|
public get mainViewSceneDir(): string {
|
@@ -662,7 +666,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
662
666
|
}
|
663
667
|
|
664
668
|
public get mainViewScenesLength(): number {
|
665
|
-
return this.
|
669
|
+
return this._pageState?.length || 0;
|
666
670
|
}
|
667
671
|
|
668
672
|
public get canRedoSteps(): number {
|