@netless/app-presentation 0.1.9-beta.3 → 0.1.9-beta.5
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/index.d.ts +3 -1
- package/dist/index.global.js +32 -16
- package/dist/index.js +32 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app-presentation.ts +8 -1
- package/src/scrollbar/index.ts +30 -15
package/dist/index.mjs
CHANGED
|
@@ -6818,6 +6818,7 @@ var Scrollbar = class {
|
|
|
6818
6818
|
this.namespace = "netless-app-presentation";
|
|
6819
6819
|
this.scrollContainer = document.createElement("div");
|
|
6820
6820
|
this.option = {
|
|
6821
|
+
appId: "",
|
|
6821
6822
|
getPageSize: () => {
|
|
6822
6823
|
return {
|
|
6823
6824
|
width: 0,
|
|
@@ -6847,7 +6848,7 @@ var Scrollbar = class {
|
|
|
6847
6848
|
this.scrollbarY.style.display = ratio === 1 ? "none" : "block";
|
|
6848
6849
|
this.scrollbarY.style.transform = `translateY(${scrollY}px)`;
|
|
6849
6850
|
}
|
|
6850
|
-
(_b = (_a = this.option.scrollbarEventCallback) == null ? void 0 : _a.onScrollCameraUpdated) == null ? void 0 : _b.call(_a, originScale, scale);
|
|
6851
|
+
(_b = (_a = this.option.scrollbarEventCallback) == null ? void 0 : _a.onScrollCameraUpdated) == null ? void 0 : _b.call(_a, this.appId, originScale, scale);
|
|
6851
6852
|
}, 50);
|
|
6852
6853
|
this.onDragStart = () => {
|
|
6853
6854
|
var _a, _b;
|
|
@@ -6908,6 +6909,7 @@ var Scrollbar = class {
|
|
|
6908
6909
|
this.scrollContainer.className = this.c("scrollbar-container");
|
|
6909
6910
|
this.container = container;
|
|
6910
6911
|
this.option = option;
|
|
6912
|
+
this.appId = option.appId;
|
|
6911
6913
|
this.readonly = option.readonly || false;
|
|
6912
6914
|
this.view = view;
|
|
6913
6915
|
this.init();
|
|
@@ -6917,9 +6919,8 @@ var Scrollbar = class {
|
|
|
6917
6919
|
}
|
|
6918
6920
|
setReadonly(bol) {
|
|
6919
6921
|
this.readonly = bol;
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
} else {
|
|
6922
|
+
this.destroy();
|
|
6923
|
+
if (!this.readonly) {
|
|
6923
6924
|
this.init();
|
|
6924
6925
|
}
|
|
6925
6926
|
}
|
|
@@ -6984,16 +6985,27 @@ var Scrollbar = class {
|
|
|
6984
6985
|
this.onCameraUpdated();
|
|
6985
6986
|
}
|
|
6986
6987
|
destroy() {
|
|
6987
|
-
var _a, _b, _c, _d;
|
|
6988
6988
|
this.view.callbacks.off("onCameraUpdated", this.onCameraUpdated);
|
|
6989
|
-
(
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
this.
|
|
6996
|
-
|
|
6989
|
+
if (this.scrollbarX && this.scrollbarContainerX) {
|
|
6990
|
+
this.scrollbarContainerX.removeChild(this.scrollbarX);
|
|
6991
|
+
this.scrollbarX.remove();
|
|
6992
|
+
this.scrollbarContainerX.remove();
|
|
6993
|
+
this.scrollbarX = void 0;
|
|
6994
|
+
}
|
|
6995
|
+
if (this.scrollbarY && this.scrollbarContainerY) {
|
|
6996
|
+
this.scrollbarContainerY.removeChild(this.scrollbarY);
|
|
6997
|
+
this.scrollbarY.remove();
|
|
6998
|
+
this.scrollbarContainerY.remove();
|
|
6999
|
+
this.scrollbarY = void 0;
|
|
7000
|
+
}
|
|
7001
|
+
if (this.draggableX) {
|
|
7002
|
+
this.draggableX.destroy();
|
|
7003
|
+
this.draggableX = void 0;
|
|
7004
|
+
}
|
|
7005
|
+
if (this.draggableY) {
|
|
7006
|
+
this.draggableY.destroy();
|
|
7007
|
+
this.draggableY = void 0;
|
|
7008
|
+
}
|
|
6997
7009
|
}
|
|
6998
7010
|
};
|
|
6999
7011
|
|
|
@@ -7230,7 +7242,7 @@ var NetlessAppPresentation = {
|
|
|
7230
7242
|
dispose2.add(view$$.addStateChangedListener(() => syncViewFromRemote(false, true)));
|
|
7231
7243
|
const box = context.getBox();
|
|
7232
7244
|
const app = dispose2.add(createPresentation(box, pages, jumpPage, pageIndex$, options.thumbnail));
|
|
7233
|
-
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.
|
|
7245
|
+
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.5";
|
|
7234
7246
|
app.scaleDocsToFit = scaleDocsToFit;
|
|
7235
7247
|
app.log = log;
|
|
7236
7248
|
if (options.justDocsViewReadonly) {
|
|
@@ -7274,6 +7286,9 @@ var NetlessAppPresentation = {
|
|
|
7274
7286
|
const { width, height } = getPageSize();
|
|
7275
7287
|
return Math.min(size.height / height, size.width / width);
|
|
7276
7288
|
};
|
|
7289
|
+
const getScale = () => {
|
|
7290
|
+
return view.camera.scale;
|
|
7291
|
+
};
|
|
7277
7292
|
const moveCamera = (camera) => {
|
|
7278
7293
|
if (context.getIsWritable()) {
|
|
7279
7294
|
view.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: "immediately" }));
|
|
@@ -7286,6 +7301,7 @@ var NetlessAppPresentation = {
|
|
|
7286
7301
|
if (options.useScrollbar) {
|
|
7287
7302
|
dispose2.make(() => {
|
|
7288
7303
|
scrollbar = new Scrollbar(app.contentDOM, {
|
|
7304
|
+
appId: context.appId,
|
|
7289
7305
|
getPageSize,
|
|
7290
7306
|
getOriginScale,
|
|
7291
7307
|
syncView,
|
|
@@ -7418,7 +7434,7 @@ var NetlessAppPresentation = {
|
|
|
7418
7434
|
scrollbar.setReadonly(bol);
|
|
7419
7435
|
}
|
|
7420
7436
|
};
|
|
7421
|
-
const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale };
|
|
7437
|
+
const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale, getScale };
|
|
7422
7438
|
dispose2.add(listen(window, "message", (ev) => {
|
|
7423
7439
|
if (ev.data === "@netless/_presentation_") {
|
|
7424
7440
|
if (typeof window !== "undefined")
|
|
@@ -7474,7 +7490,7 @@ var install = (register, options = {}) => {
|
|
|
7474
7490
|
};
|
|
7475
7491
|
|
|
7476
7492
|
// src/index.ts
|
|
7477
|
-
var version = "0.1.9-beta.
|
|
7493
|
+
var version = "0.1.9-beta.5";
|
|
7478
7494
|
/*! Bundled license information:
|
|
7479
7495
|
|
|
7480
7496
|
lodash/lodash.js:
|