@netless/window-manager 0.4.21 → 0.4.22
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 +4 -0
- package/dist/AppListener.d.ts +1 -0
- package/dist/View/MainView.d.ts +1 -0
- package/dist/constants.d.ts +2 -1
- package/dist/index.es.js +21 -13
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/AppListener.ts +8 -0
- package/src/AppManager.ts +11 -8
- package/src/View/MainView.ts +13 -12
- package/src/constants.ts +1 -0
package/CHANGELOG.md
CHANGED
package/dist/AppListener.d.ts
CHANGED
package/dist/View/MainView.d.ts
CHANGED
package/dist/constants.d.ts
CHANGED
@@ -14,7 +14,8 @@ export declare enum Events {
|
|
14
14
|
MoveCameraToContain = "MoveCameraToContain",
|
15
15
|
CursorMove = "CursorMove",
|
16
16
|
RootDirRemoved = "RootDirRemoved",
|
17
|
-
Refresh = "Refresh"
|
17
|
+
Refresh = "Refresh",
|
18
|
+
InitMainViewCamera = "InitMainViewCamera"
|
18
19
|
}
|
19
20
|
export declare const MagixEventName = "__WindowManger";
|
20
21
|
export declare enum AppAttributes {
|
package/dist/index.es.js
CHANGED
@@ -42,6 +42,7 @@ var Events = /* @__PURE__ */ ((Events2) => {
|
|
42
42
|
Events2["CursorMove"] = "CursorMove";
|
43
43
|
Events2["RootDirRemoved"] = "RootDirRemoved";
|
44
44
|
Events2["Refresh"] = "Refresh";
|
45
|
+
Events2["InitMainViewCamera"] = "InitMainViewCamera";
|
45
46
|
return Events2;
|
46
47
|
})(Events || {});
|
47
48
|
const MagixEventName = "__WindowManger";
|
@@ -470,6 +471,10 @@ class AppListeners {
|
|
470
471
|
this.refreshHandler();
|
471
472
|
break;
|
472
473
|
}
|
474
|
+
case Events.InitMainViewCamera: {
|
475
|
+
this.initMainViewCameraHandler();
|
476
|
+
break;
|
477
|
+
}
|
473
478
|
}
|
474
479
|
}
|
475
480
|
};
|
@@ -508,6 +513,9 @@ class AppListeners {
|
|
508
513
|
this.refreshHandler = () => {
|
509
514
|
this.manager.windowManger._refresh();
|
510
515
|
};
|
516
|
+
this.initMainViewCameraHandler = () => {
|
517
|
+
this.manager.mainViewProxy.addCameraReaction();
|
518
|
+
};
|
511
519
|
}
|
512
520
|
get boxManager() {
|
513
521
|
return this.manager.boxManager;
|
@@ -1603,15 +1611,17 @@ class MainViewProxy {
|
|
1603
1611
|
this.mainViewIsAddListener = false;
|
1604
1612
|
this.store = this.manager.store;
|
1605
1613
|
this.sideEffectManager = new SideEffectManager();
|
1614
|
+
this.addCameraReaction = () => {
|
1615
|
+
var _a;
|
1616
|
+
(_a = this.manager.refresher) == null ? void 0 : _a.add(Fields.MainViewCamera, this.cameraReaction);
|
1617
|
+
};
|
1606
1618
|
this.cameraReaction = () => {
|
1607
1619
|
return reaction(() => this.mainViewCamera, (camera) => {
|
1608
1620
|
if (camera && camera.id !== this.manager.uid) {
|
1609
1621
|
this.moveCameraToContian(this.mainViewSize);
|
1610
1622
|
this.moveCamera(camera);
|
1611
1623
|
}
|
1612
|
-
}, {
|
1613
|
-
fireImmediately: true
|
1614
|
-
});
|
1624
|
+
}, { fireImmediately: true });
|
1615
1625
|
};
|
1616
1626
|
this.sizeChangeHandler = debounce((size2) => {
|
1617
1627
|
if (size2) {
|
@@ -1637,13 +1647,12 @@ class MainViewProxy {
|
|
1637
1647
|
this.mainView = this.createMainView();
|
1638
1648
|
this.moveCameraSizeByAttributes();
|
1639
1649
|
emitter.once("mainViewMounted").then(() => {
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
}, 200);
|
1650
|
+
this.addMainViewListener();
|
1651
|
+
this.start();
|
1652
|
+
if (!this.mainViewCamera || !this.mainViewSize) {
|
1653
|
+
manager.dispatchInternalEvent(Events.InitMainViewCamera);
|
1654
|
+
this.setCameraAndSize();
|
1655
|
+
}
|
1647
1656
|
});
|
1648
1657
|
const playgroundSizeChangeListener = () => {
|
1649
1658
|
this.sizeChangeHandler(this.mainViewSize);
|
@@ -1664,12 +1673,11 @@ class MainViewProxy {
|
|
1664
1673
|
this.moveCamera(this.mainViewCamera);
|
1665
1674
|
}
|
1666
1675
|
start() {
|
1667
|
-
var _a;
|
1668
1676
|
if (this.started)
|
1669
1677
|
return;
|
1670
1678
|
this.sizeChangeHandler(this.mainViewSize);
|
1671
1679
|
this.addCameraListener();
|
1672
|
-
|
1680
|
+
this.addCameraReaction();
|
1673
1681
|
this.started = true;
|
1674
1682
|
}
|
1675
1683
|
setCameraAndSize() {
|
@@ -14839,7 +14847,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
14839
14847
|
const _WindowManager = class extends InvisiblePlugin {
|
14840
14848
|
constructor(context) {
|
14841
14849
|
super(context);
|
14842
|
-
this.version = "0.4.
|
14850
|
+
this.version = "0.4.22";
|
14843
14851
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.26", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^0.1.5", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.9", "@netless/app-media-player": "0.1.0-beta.5", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.22", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/jest": "^27.4.1", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jest": "^27.5.1", "jest-canvas-mock": "^2.3.1", "jest-fetch-mock": "^3.0.3", "jest-transform-stub": "^2.0.0", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "svelte-jester": "^2.3.2", "ts-jest": "^27.1.4", "typescript": "^4.5.5", "vite": "^2.5.3", "white-web-sdk": "2.16.10" } };
|
14844
14852
|
this.emitter = callbacks$1;
|
14845
14853
|
this.viewMode = ViewMode.Broadcaster;
|