@netless/window-manager 1.0.0-canary.22 → 1.0.0-canary.23
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/dist/View/CameraSynchronizer.d.ts +1 -1
- package/dist/index.cjs.js +8 -8
- package/dist/index.es.js +20 -28
- package/dist/index.umd.js +8 -8
- package/docs/app-context.md +89 -3
- package/package.json +1 -1
- package/src/View/CameraSynchronizer.ts +17 -26
package/dist/index.es.js
CHANGED
@@ -19,7 +19,7 @@ var __spreadValues = (a2, b2) => {
|
|
19
19
|
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
|
20
20
|
import pRetry from "p-retry";
|
21
21
|
import Emittery from "emittery";
|
22
|
-
import { debounce, isEqual, omit, isObject, has, get, size as size$1, mapValues, noop as noop$1, pick, isBoolean, isNumber, throttle,
|
22
|
+
import { debounce, isEqual, omit, isObject, has, get, size as size$1, mapValues, noop as noop$1, pick, isBoolean, isNumber, throttle, omitBy, isUndefined, isInteger, orderBy, isEmpty, isFunction, isNull } from "lodash";
|
23
23
|
import { ScenePathType, UpdateEventKind, listenUpdated, unlistenUpdated, reaction, WhiteVersion, autorun, toJS, listenDisposed, unlistenDisposed, AnimationMode, ViewMode, isPlayer, isRoom, ApplianceNames, RoomPhase, InvisiblePlugin } from "white-web-sdk";
|
24
24
|
import { v4 } from "uuid";
|
25
25
|
import { genUID, SideEffectManager } from "side-effect-manager";
|
@@ -1219,13 +1219,14 @@ class AppPageStateImpl {
|
|
1219
1219
|
class CameraSynchronizer {
|
1220
1220
|
constructor(saveCamera) {
|
1221
1221
|
this.saveCamera = saveCamera;
|
1222
|
-
this.setRect =
|
1222
|
+
this.setRect = (rect) => {
|
1223
1223
|
this.rect = rect;
|
1224
1224
|
if (this.remoteCamera && this.remoteSize) {
|
1225
1225
|
this.onRemoteUpdate(this.remoteCamera, this.remoteSize);
|
1226
1226
|
}
|
1227
|
-
}
|
1227
|
+
};
|
1228
1228
|
this.onRemoteUpdate = throttle((camera, size2) => {
|
1229
|
+
var _a;
|
1229
1230
|
this.remoteCamera = camera;
|
1230
1231
|
this.remoteSize = size2;
|
1231
1232
|
if (this.remoteSize && this.rect) {
|
@@ -1236,22 +1237,17 @@ class CameraSynchronizer {
|
|
1236
1237
|
scale2 = this.rect.height / size2.height;
|
1237
1238
|
}
|
1238
1239
|
const nextScale = camera.scale * scale2;
|
1239
|
-
const
|
1240
|
-
|
1241
|
-
|
1242
|
-
scale: nextScale,
|
1243
|
-
animationMode: AnimationMode.Immediately
|
1244
|
-
};
|
1245
|
-
if (camera.centerX !== null) {
|
1246
|
-
config.centerX = camera.centerX;
|
1247
|
-
}
|
1248
|
-
if (camera.centerY !== null) {
|
1249
|
-
config.centerY = camera.centerY;
|
1250
|
-
}
|
1251
|
-
(_a = this.view) == null ? void 0 : _a.moveCamera(config);
|
1240
|
+
const config = {
|
1241
|
+
scale: nextScale,
|
1242
|
+
animationMode: AnimationMode.Immediately
|
1252
1243
|
};
|
1253
|
-
|
1254
|
-
|
1244
|
+
if (camera.centerX !== null) {
|
1245
|
+
config.centerX = camera.centerX;
|
1246
|
+
}
|
1247
|
+
if (camera.centerY !== null) {
|
1248
|
+
config.centerY = camera.centerY;
|
1249
|
+
}
|
1250
|
+
(_a = this.view) == null ? void 0 : _a.moveCamera(config);
|
1255
1251
|
}
|
1256
1252
|
}, 10);
|
1257
1253
|
}
|
@@ -1259,20 +1255,16 @@ class CameraSynchronizer {
|
|
1259
1255
|
this.view = view;
|
1260
1256
|
}
|
1261
1257
|
onRemoteSizeUpdate(size2) {
|
1258
|
+
var _a;
|
1262
1259
|
this.remoteSize = size2;
|
1263
1260
|
const needMoveCamera = !isEqual(pick(this.rect, ["width", "height"]), pick(size2, ["width", "height"]));
|
1264
1261
|
if (this.rect && this.remoteCamera && needMoveCamera) {
|
1265
1262
|
const scale2 = this.rect.width / size2.width;
|
1266
1263
|
const nextScale = this.remoteCamera.scale * scale2;
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
animationMode: AnimationMode.Immediately
|
1272
|
-
});
|
1273
|
-
};
|
1274
|
-
moveCamera();
|
1275
|
-
delay(moveCamera, 50);
|
1264
|
+
(_a = this.view) == null ? void 0 : _a.moveCamera({
|
1265
|
+
scale: nextScale,
|
1266
|
+
animationMode: AnimationMode.Immediately
|
1267
|
+
});
|
1276
1268
|
}
|
1277
1269
|
}
|
1278
1270
|
onLocalCameraUpdate(camera) {
|
@@ -15647,7 +15639,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
15647
15639
|
const _WindowManager = class extends InvisiblePlugin {
|
15648
15640
|
constructor(context) {
|
15649
15641
|
super(context);
|
15650
|
-
this.version = "1.0.0-canary.
|
15642
|
+
this.version = "1.0.0-canary.23";
|
15651
15643
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.18", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "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/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.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", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
|
15652
15644
|
this.emitter = callbacks$1;
|
15653
15645
|
this.viewMode = ViewMode.Broadcaster;
|