@netless/app-presentation 0.1.9-beta.3 → 0.1.9-beta.4
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 +10 -4
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app-presentation.ts +8 -1
- package/src/scrollbar/index.ts +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -311,7 +311,7 @@ interface ScrollbarEventCallback {
|
|
|
311
311
|
onScrollbarDragEnd?: () => void;
|
|
312
312
|
onScrollbarDragX?: (x: number) => void;
|
|
313
313
|
onScrollbarDragY?: (y: number) => void;
|
|
314
|
-
onScrollCameraUpdated?: (originScale: number, scale: number) => void;
|
|
314
|
+
onScrollCameraUpdated?: (appid: string, originScale: number, scale: number) => void;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
type Logger = (...data: any[]) => void;
|
|
@@ -380,6 +380,8 @@ interface PresentationController {
|
|
|
380
380
|
}) => void;
|
|
381
381
|
/** get the origin scale */
|
|
382
382
|
getOriginScale: () => number;
|
|
383
|
+
/** get the view scale */
|
|
384
|
+
getScale: () => number;
|
|
383
385
|
}
|
|
384
386
|
|
|
385
387
|
declare const NetlessAppPresentation: NetlessApp<{}, {}, PresentationAppOptions, PresentationController>;
|
package/dist/index.global.js
CHANGED
|
@@ -6821,6 +6821,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
6821
6821
|
this.namespace = "netless-app-presentation";
|
|
6822
6822
|
this.scrollContainer = document.createElement("div");
|
|
6823
6823
|
this.option = {
|
|
6824
|
+
appId: "",
|
|
6824
6825
|
getPageSize: () => {
|
|
6825
6826
|
return {
|
|
6826
6827
|
width: 0,
|
|
@@ -6850,7 +6851,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
6850
6851
|
this.scrollbarY.style.display = ratio === 1 ? "none" : "block";
|
|
6851
6852
|
this.scrollbarY.style.transform = `translateY(${scrollY}px)`;
|
|
6852
6853
|
}
|
|
6853
|
-
(_b = (_a = this.option.scrollbarEventCallback) == null ? void 0 : _a.onScrollCameraUpdated) == null ? void 0 : _b.call(_a, originScale, scale);
|
|
6854
|
+
(_b = (_a = this.option.scrollbarEventCallback) == null ? void 0 : _a.onScrollCameraUpdated) == null ? void 0 : _b.call(_a, this.appId, originScale, scale);
|
|
6854
6855
|
}, 50);
|
|
6855
6856
|
this.onDragStart = () => {
|
|
6856
6857
|
var _a, _b;
|
|
@@ -6911,6 +6912,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
6911
6912
|
this.scrollContainer.className = this.c("scrollbar-container");
|
|
6912
6913
|
this.container = container;
|
|
6913
6914
|
this.option = option;
|
|
6915
|
+
this.appId = option.appId;
|
|
6914
6916
|
this.readonly = option.readonly || false;
|
|
6915
6917
|
this.view = view;
|
|
6916
6918
|
this.init();
|
|
@@ -7233,7 +7235,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
7233
7235
|
dispose2.add(view$$.addStateChangedListener(() => syncViewFromRemote(false, true)));
|
|
7234
7236
|
const box = context.getBox();
|
|
7235
7237
|
const app = dispose2.add(createPresentation(box, pages, jumpPage, pageIndex$, options.thumbnail));
|
|
7236
|
-
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.
|
|
7238
|
+
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.4";
|
|
7237
7239
|
app.scaleDocsToFit = scaleDocsToFit;
|
|
7238
7240
|
app.log = log;
|
|
7239
7241
|
if (options.justDocsViewReadonly) {
|
|
@@ -7277,6 +7279,9 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
7277
7279
|
const { width, height } = getPageSize();
|
|
7278
7280
|
return Math.min(size.height / height, size.width / width);
|
|
7279
7281
|
};
|
|
7282
|
+
const getScale = () => {
|
|
7283
|
+
return view.camera.scale;
|
|
7284
|
+
};
|
|
7280
7285
|
const moveCamera = (camera) => {
|
|
7281
7286
|
if (context.getIsWritable()) {
|
|
7282
7287
|
view.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: "immediately" }));
|
|
@@ -7289,6 +7294,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
7289
7294
|
if (options.useScrollbar) {
|
|
7290
7295
|
dispose2.make(() => {
|
|
7291
7296
|
scrollbar = new Scrollbar(app.contentDOM, {
|
|
7297
|
+
appId: context.appId,
|
|
7292
7298
|
getPageSize,
|
|
7293
7299
|
getOriginScale,
|
|
7294
7300
|
syncView,
|
|
@@ -7421,7 +7427,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
7421
7427
|
scrollbar.setReadonly(bol);
|
|
7422
7428
|
}
|
|
7423
7429
|
};
|
|
7424
|
-
const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale };
|
|
7430
|
+
const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale, getScale };
|
|
7425
7431
|
dispose2.add(listen(window, "message", (ev) => {
|
|
7426
7432
|
if (ev.data === "@netless/_presentation_") {
|
|
7427
7433
|
if (typeof window !== "undefined")
|
|
@@ -7477,7 +7483,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
7477
7483
|
};
|
|
7478
7484
|
|
|
7479
7485
|
// src/index.ts
|
|
7480
|
-
var version = "0.1.9-beta.
|
|
7486
|
+
var version = "0.1.9-beta.4";
|
|
7481
7487
|
/*! Bundled license information:
|
|
7482
7488
|
|
|
7483
7489
|
lodash/lodash.js:
|
package/dist/index.js
CHANGED
|
@@ -6822,6 +6822,7 @@ var Scrollbar = class {
|
|
|
6822
6822
|
this.namespace = "netless-app-presentation";
|
|
6823
6823
|
this.scrollContainer = document.createElement("div");
|
|
6824
6824
|
this.option = {
|
|
6825
|
+
appId: "",
|
|
6825
6826
|
getPageSize: () => {
|
|
6826
6827
|
return {
|
|
6827
6828
|
width: 0,
|
|
@@ -6851,7 +6852,7 @@ var Scrollbar = class {
|
|
|
6851
6852
|
this.scrollbarY.style.display = ratio === 1 ? "none" : "block";
|
|
6852
6853
|
this.scrollbarY.style.transform = `translateY(${scrollY}px)`;
|
|
6853
6854
|
}
|
|
6854
|
-
(_b = (_a = this.option.scrollbarEventCallback) == null ? void 0 : _a.onScrollCameraUpdated) == null ? void 0 : _b.call(_a, originScale, scale);
|
|
6855
|
+
(_b = (_a = this.option.scrollbarEventCallback) == null ? void 0 : _a.onScrollCameraUpdated) == null ? void 0 : _b.call(_a, this.appId, originScale, scale);
|
|
6855
6856
|
}, 50);
|
|
6856
6857
|
this.onDragStart = () => {
|
|
6857
6858
|
var _a, _b;
|
|
@@ -6912,6 +6913,7 @@ var Scrollbar = class {
|
|
|
6912
6913
|
this.scrollContainer.className = this.c("scrollbar-container");
|
|
6913
6914
|
this.container = container;
|
|
6914
6915
|
this.option = option;
|
|
6916
|
+
this.appId = option.appId;
|
|
6915
6917
|
this.readonly = option.readonly || false;
|
|
6916
6918
|
this.view = view;
|
|
6917
6919
|
this.init();
|
|
@@ -7234,7 +7236,7 @@ var NetlessAppPresentation = {
|
|
|
7234
7236
|
dispose2.add(view$$.addStateChangedListener(() => syncViewFromRemote(false, true)));
|
|
7235
7237
|
const box = context.getBox();
|
|
7236
7238
|
const app = dispose2.add(createPresentation(box, pages, jumpPage, pageIndex$, options.thumbnail));
|
|
7237
|
-
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.
|
|
7239
|
+
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.4";
|
|
7238
7240
|
app.scaleDocsToFit = scaleDocsToFit;
|
|
7239
7241
|
app.log = log;
|
|
7240
7242
|
if (options.justDocsViewReadonly) {
|
|
@@ -7278,6 +7280,9 @@ var NetlessAppPresentation = {
|
|
|
7278
7280
|
const { width, height } = getPageSize();
|
|
7279
7281
|
return Math.min(size.height / height, size.width / width);
|
|
7280
7282
|
};
|
|
7283
|
+
const getScale = () => {
|
|
7284
|
+
return view.camera.scale;
|
|
7285
|
+
};
|
|
7281
7286
|
const moveCamera = (camera) => {
|
|
7282
7287
|
if (context.getIsWritable()) {
|
|
7283
7288
|
view.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: "immediately" }));
|
|
@@ -7290,6 +7295,7 @@ var NetlessAppPresentation = {
|
|
|
7290
7295
|
if (options.useScrollbar) {
|
|
7291
7296
|
dispose2.make(() => {
|
|
7292
7297
|
scrollbar = new Scrollbar(app.contentDOM, {
|
|
7298
|
+
appId: context.appId,
|
|
7293
7299
|
getPageSize,
|
|
7294
7300
|
getOriginScale,
|
|
7295
7301
|
syncView,
|
|
@@ -7422,7 +7428,7 @@ var NetlessAppPresentation = {
|
|
|
7422
7428
|
scrollbar.setReadonly(bol);
|
|
7423
7429
|
}
|
|
7424
7430
|
};
|
|
7425
|
-
const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale };
|
|
7431
|
+
const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale, getScale };
|
|
7426
7432
|
dispose2.add(listen(window, "message", (ev) => {
|
|
7427
7433
|
if (ev.data === "@netless/_presentation_") {
|
|
7428
7434
|
if (typeof window !== "undefined")
|
|
@@ -7478,7 +7484,7 @@ var install = (register, options = {}) => {
|
|
|
7478
7484
|
};
|
|
7479
7485
|
|
|
7480
7486
|
// src/index.ts
|
|
7481
|
-
var version = "0.1.9-beta.
|
|
7487
|
+
var version = "0.1.9-beta.4";
|
|
7482
7488
|
/*! Bundled license information:
|
|
7483
7489
|
|
|
7484
7490
|
lodash/lodash.js:
|