@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.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();
@@ -7230,7 +7232,7 @@ var NetlessAppPresentation = {
7230
7232
  dispose2.add(view$$.addStateChangedListener(() => syncViewFromRemote(false, true)));
7231
7233
  const box = context.getBox();
7232
7234
  const app = dispose2.add(createPresentation(box, pages, jumpPage, pageIndex$, options.thumbnail));
7233
- app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.3";
7235
+ app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.4";
7234
7236
  app.scaleDocsToFit = scaleDocsToFit;
7235
7237
  app.log = log;
7236
7238
  if (options.justDocsViewReadonly) {
@@ -7274,6 +7276,9 @@ var NetlessAppPresentation = {
7274
7276
  const { width, height } = getPageSize();
7275
7277
  return Math.min(size.height / height, size.width / width);
7276
7278
  };
7279
+ const getScale = () => {
7280
+ return view.camera.scale;
7281
+ };
7277
7282
  const moveCamera = (camera) => {
7278
7283
  if (context.getIsWritable()) {
7279
7284
  view.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: "immediately" }));
@@ -7286,6 +7291,7 @@ var NetlessAppPresentation = {
7286
7291
  if (options.useScrollbar) {
7287
7292
  dispose2.make(() => {
7288
7293
  scrollbar = new Scrollbar(app.contentDOM, {
7294
+ appId: context.appId,
7289
7295
  getPageSize,
7290
7296
  getOriginScale,
7291
7297
  syncView,
@@ -7418,7 +7424,7 @@ var NetlessAppPresentation = {
7418
7424
  scrollbar.setReadonly(bol);
7419
7425
  }
7420
7426
  };
7421
- const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale };
7427
+ const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale, getScale };
7422
7428
  dispose2.add(listen(window, "message", (ev) => {
7423
7429
  if (ev.data === "@netless/_presentation_") {
7424
7430
  if (typeof window !== "undefined")
@@ -7474,7 +7480,7 @@ var install = (register, options = {}) => {
7474
7480
  };
7475
7481
 
7476
7482
  // src/index.ts
7477
- var version = "0.1.9-beta.3";
7483
+ var version = "0.1.9-beta.4";
7478
7484
  /*! Bundled license information:
7479
7485
 
7480
7486
  lodash/lodash.js: