@netless/app-presentation 0.1.9-beta.0 → 0.1.9-beta.2
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 +10 -0
- package/dist/index.global.js +73 -21
- package/dist/index.js +73 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app-presentation.ts +40 -10
- package/src/scrollbar/Draggable.ts +2 -0
- package/src/scrollbar/index.ts +20 -11
package/dist/index.d.ts
CHANGED
|
@@ -361,6 +361,16 @@ interface PresentationController {
|
|
|
361
361
|
log: Logger;
|
|
362
362
|
/** set the docs view readonly */
|
|
363
363
|
setDocsViewReadonly: (bol: boolean) => void;
|
|
364
|
+
/** set the presentation readonly */
|
|
365
|
+
setReadonly: (bol: boolean) => void;
|
|
366
|
+
/** move the camera */
|
|
367
|
+
moveCamera: (camera: {
|
|
368
|
+
centerX: number;
|
|
369
|
+
centerY: number;
|
|
370
|
+
scale: number;
|
|
371
|
+
}) => void;
|
|
372
|
+
/** get the origin scale */
|
|
373
|
+
getOriginScale: () => number;
|
|
364
374
|
}
|
|
365
375
|
|
|
366
376
|
declare const NetlessAppPresentation: NetlessApp<{}, {}, PresentationAppOptions, PresentationController>;
|
package/dist/index.global.js
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
var NetlessAppPresentation = (function (exports) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
|
|
4
24
|
// node_modules/.pnpm/@wopjs+disposable@0.1.5/node_modules/@wopjs/disposable/dist/index.mjs
|
|
5
25
|
var isAbortable = (disposable) => disposable && disposable.abortable;
|
|
6
26
|
var dispose = (disposable) => {
|
|
@@ -1264,6 +1284,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1264
1284
|
originalMouseY = e.pageY;
|
|
1265
1285
|
element.addEventListener("pointermove", drag);
|
|
1266
1286
|
document.body.addEventListener("pointerup", stopDrag);
|
|
1287
|
+
document.body.addEventListener("pointercancel", stopDrag);
|
|
1267
1288
|
element.setPointerCapture(e.pointerId);
|
|
1268
1289
|
onDragStart == null ? void 0 : onDragStart();
|
|
1269
1290
|
}
|
|
@@ -1271,6 +1292,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1271
1292
|
currentDragger = null;
|
|
1272
1293
|
element.removeEventListener("pointermove", drag);
|
|
1273
1294
|
document.body.removeEventListener("pointerup", stopDrag);
|
|
1295
|
+
document.body.removeEventListener("pointercancel", stopDrag);
|
|
1274
1296
|
}
|
|
1275
1297
|
function stopDrag(e) {
|
|
1276
1298
|
if (!currentDragger)
|
|
@@ -1302,11 +1324,14 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1302
1324
|
};
|
|
1303
1325
|
},
|
|
1304
1326
|
getWritable: () => false,
|
|
1327
|
+
getOriginScale: () => 1,
|
|
1305
1328
|
syncView: () => void 0
|
|
1306
1329
|
};
|
|
1307
1330
|
this.onCameraUpdated = () => {
|
|
1331
|
+
if (this.readonly)
|
|
1332
|
+
return;
|
|
1308
1333
|
const { scale, centerX, centerY } = this.view.camera;
|
|
1309
|
-
const originScale = this.getOriginScale();
|
|
1334
|
+
const originScale = this.option.getOriginScale();
|
|
1310
1335
|
const ratio = Math.round(originScale / scale * 1e3) / 1e3;
|
|
1311
1336
|
const scrollX = Math.round(centerX * originScale);
|
|
1312
1337
|
const scrollY = Math.round(centerY * originScale);
|
|
@@ -1332,7 +1357,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1332
1357
|
this.onDragX = (transformedDrag) => {
|
|
1333
1358
|
if (this.cameraCache) {
|
|
1334
1359
|
const { x } = transformedDrag;
|
|
1335
|
-
const originScale = this.getOriginScale();
|
|
1360
|
+
const originScale = this.option.getOriginScale();
|
|
1336
1361
|
const { minX, maxX } = this.getScrollXRange(this.cameraCache);
|
|
1337
1362
|
const scrollX = Math.round(x / originScale);
|
|
1338
1363
|
let centerX = scrollX + this.cameraCache.centerX;
|
|
@@ -1350,7 +1375,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1350
1375
|
this.onDragY = (transformedDrag) => {
|
|
1351
1376
|
if (this.cameraCache) {
|
|
1352
1377
|
const { y } = transformedDrag;
|
|
1353
|
-
const originScale = this.getOriginScale();
|
|
1378
|
+
const originScale = this.option.getOriginScale();
|
|
1354
1379
|
const { minY, maxY } = this.getScrollYRange(this.cameraCache);
|
|
1355
1380
|
const scrollY = Math.round(y / originScale);
|
|
1356
1381
|
let centerY = scrollY + this.cameraCache.centerY;
|
|
@@ -1372,21 +1397,24 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1372
1397
|
this.scrollContainer.className = this.c("scrollbar-container");
|
|
1373
1398
|
this.container = container;
|
|
1374
1399
|
this.option = option;
|
|
1400
|
+
this.readonly = option.readonly || false;
|
|
1375
1401
|
this.view = view;
|
|
1376
1402
|
this.init();
|
|
1377
|
-
this.view.callbacks.on("onCameraUpdated", this.onCameraUpdated);
|
|
1378
1403
|
}
|
|
1379
1404
|
c(className) {
|
|
1380
1405
|
return `${this.namespace}-${className}`;
|
|
1381
1406
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1407
|
+
setReadonly(bol) {
|
|
1408
|
+
this.readonly = bol;
|
|
1409
|
+
if (this.readonly) {
|
|
1410
|
+
this.destroy();
|
|
1411
|
+
} else {
|
|
1412
|
+
this.init();
|
|
1413
|
+
}
|
|
1386
1414
|
}
|
|
1387
1415
|
getScrollXRange(camera) {
|
|
1388
1416
|
const { width } = this.option.getPageSize();
|
|
1389
|
-
const originScale = this.getOriginScale();
|
|
1417
|
+
const originScale = this.option.getOriginScale();
|
|
1390
1418
|
const scale = camera.scale;
|
|
1391
1419
|
const ratio = Math.round(originScale / scale * 1e3) / 1e3;
|
|
1392
1420
|
const scrollWidth = width * (1 - ratio);
|
|
@@ -1396,7 +1424,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1396
1424
|
}
|
|
1397
1425
|
getScrollYRange(camera) {
|
|
1398
1426
|
const { height } = this.option.getPageSize();
|
|
1399
|
-
const originScale = this.getOriginScale();
|
|
1427
|
+
const originScale = this.option.getOriginScale();
|
|
1400
1428
|
const scale = camera.scale;
|
|
1401
1429
|
const ratio = Math.round(originScale / scale * 1e3) / 1e3;
|
|
1402
1430
|
const scrollHeight = height * (1 - ratio);
|
|
@@ -1441,6 +1469,8 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1441
1469
|
this.scrollbarContainerY.appendChild(this.scrollbarY);
|
|
1442
1470
|
this.scrollContainer.append(this.scrollbarContainerX, this.scrollbarContainerY);
|
|
1443
1471
|
this.container.appendChild(this.scrollContainer);
|
|
1472
|
+
this.view.callbacks.on("onCameraUpdated", this.onCameraUpdated);
|
|
1473
|
+
this.onCameraUpdated();
|
|
1444
1474
|
}
|
|
1445
1475
|
destroy() {
|
|
1446
1476
|
var _a, _b, _c, _d;
|
|
@@ -1689,7 +1719,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1689
1719
|
dispose2.add(view$$.addStateChangedListener(() => syncViewFromRemote(false, true)));
|
|
1690
1720
|
const box = context.getBox();
|
|
1691
1721
|
const app = dispose2.add(createPresentation(box, pages, jumpPage, pageIndex$, options.thumbnail));
|
|
1692
|
-
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.
|
|
1722
|
+
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.2";
|
|
1693
1723
|
app.scaleDocsToFit = scaleDocsToFit;
|
|
1694
1724
|
app.log = log;
|
|
1695
1725
|
if (options.justDocsViewReadonly) {
|
|
@@ -1724,17 +1754,33 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1724
1754
|
dispose2.add(context.emitter.on("writableChange", (isWritable) => {
|
|
1725
1755
|
app.setReadonly(!isWritable);
|
|
1726
1756
|
}));
|
|
1757
|
+
const getPageSize = () => {
|
|
1758
|
+
const { width, height } = app.page() || {};
|
|
1759
|
+
return { width: width || 0, height: height || 0 };
|
|
1760
|
+
};
|
|
1761
|
+
const getOriginScale = () => {
|
|
1762
|
+
const { size } = view;
|
|
1763
|
+
const { width, height } = getPageSize();
|
|
1764
|
+
return Math.min(size.height / height, size.width / width);
|
|
1765
|
+
};
|
|
1766
|
+
const moveCamera = (camera) => {
|
|
1767
|
+
if (context.getIsWritable()) {
|
|
1768
|
+
view.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: "immediately" }));
|
|
1769
|
+
syncView();
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1772
|
+
throw new Error("[Presentation]: moveCamera must be called in writable room");
|
|
1773
|
+
};
|
|
1774
|
+
let scrollbar;
|
|
1727
1775
|
if (options.useScrollbar) {
|
|
1728
1776
|
dispose2.make(() => {
|
|
1729
|
-
|
|
1730
|
-
getPageSize
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
getWritable: () => context.getIsWritable(),
|
|
1735
|
-
syncView: () => syncView()
|
|
1777
|
+
scrollbar = new Scrollbar(app.contentDOM, {
|
|
1778
|
+
getPageSize,
|
|
1779
|
+
getOriginScale,
|
|
1780
|
+
syncView,
|
|
1781
|
+
getWritable: () => context.getIsWritable()
|
|
1736
1782
|
}, view);
|
|
1737
|
-
return () => scrollbar.destroy();
|
|
1783
|
+
return () => scrollbar == null ? void 0 : scrollbar.destroy();
|
|
1738
1784
|
});
|
|
1739
1785
|
}
|
|
1740
1786
|
context.emitter.on("destroy", () => dispose2());
|
|
@@ -1854,7 +1900,13 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1854
1900
|
const setDocsViewReadonly = (bol) => {
|
|
1855
1901
|
app.setDocsViewReadonly(bol);
|
|
1856
1902
|
};
|
|
1857
|
-
const
|
|
1903
|
+
const setReadonly = (bol) => {
|
|
1904
|
+
app.setReadonly(bol);
|
|
1905
|
+
if (scrollbar) {
|
|
1906
|
+
scrollbar.setReadonly(bol);
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale };
|
|
1858
1910
|
dispose2.add(listen(window, "message", (ev) => {
|
|
1859
1911
|
if (ev.data === "@netless/_presentation_") {
|
|
1860
1912
|
if (typeof window !== "undefined")
|
|
@@ -1910,7 +1962,7 @@ var NetlessAppPresentation = (function (exports) {
|
|
|
1910
1962
|
};
|
|
1911
1963
|
|
|
1912
1964
|
// src/index.ts
|
|
1913
|
-
var version = "0.1.9-beta.
|
|
1965
|
+
var version = "0.1.9-beta.2";
|
|
1914
1966
|
|
|
1915
1967
|
exports.NetlessAppPresentation = NetlessAppPresentation;
|
|
1916
1968
|
exports.Presentation = Presentation;
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
|
|
5
25
|
// node_modules/.pnpm/@wopjs+disposable@0.1.5/node_modules/@wopjs/disposable/dist/index.mjs
|
|
6
26
|
var isAbortable = (disposable) => disposable && disposable.abortable;
|
|
7
27
|
var dispose = (disposable) => {
|
|
@@ -1265,6 +1285,7 @@ function makeDraggable(element, options) {
|
|
|
1265
1285
|
originalMouseY = e.pageY;
|
|
1266
1286
|
element.addEventListener("pointermove", drag);
|
|
1267
1287
|
document.body.addEventListener("pointerup", stopDrag);
|
|
1288
|
+
document.body.addEventListener("pointercancel", stopDrag);
|
|
1268
1289
|
element.setPointerCapture(e.pointerId);
|
|
1269
1290
|
onDragStart == null ? void 0 : onDragStart();
|
|
1270
1291
|
}
|
|
@@ -1272,6 +1293,7 @@ function makeDraggable(element, options) {
|
|
|
1272
1293
|
currentDragger = null;
|
|
1273
1294
|
element.removeEventListener("pointermove", drag);
|
|
1274
1295
|
document.body.removeEventListener("pointerup", stopDrag);
|
|
1296
|
+
document.body.removeEventListener("pointercancel", stopDrag);
|
|
1275
1297
|
}
|
|
1276
1298
|
function stopDrag(e) {
|
|
1277
1299
|
if (!currentDragger)
|
|
@@ -1303,11 +1325,14 @@ var Scrollbar = class {
|
|
|
1303
1325
|
};
|
|
1304
1326
|
},
|
|
1305
1327
|
getWritable: () => false,
|
|
1328
|
+
getOriginScale: () => 1,
|
|
1306
1329
|
syncView: () => void 0
|
|
1307
1330
|
};
|
|
1308
1331
|
this.onCameraUpdated = () => {
|
|
1332
|
+
if (this.readonly)
|
|
1333
|
+
return;
|
|
1309
1334
|
const { scale, centerX, centerY } = this.view.camera;
|
|
1310
|
-
const originScale = this.getOriginScale();
|
|
1335
|
+
const originScale = this.option.getOriginScale();
|
|
1311
1336
|
const ratio = Math.round(originScale / scale * 1e3) / 1e3;
|
|
1312
1337
|
const scrollX = Math.round(centerX * originScale);
|
|
1313
1338
|
const scrollY = Math.round(centerY * originScale);
|
|
@@ -1333,7 +1358,7 @@ var Scrollbar = class {
|
|
|
1333
1358
|
this.onDragX = (transformedDrag) => {
|
|
1334
1359
|
if (this.cameraCache) {
|
|
1335
1360
|
const { x } = transformedDrag;
|
|
1336
|
-
const originScale = this.getOriginScale();
|
|
1361
|
+
const originScale = this.option.getOriginScale();
|
|
1337
1362
|
const { minX, maxX } = this.getScrollXRange(this.cameraCache);
|
|
1338
1363
|
const scrollX = Math.round(x / originScale);
|
|
1339
1364
|
let centerX = scrollX + this.cameraCache.centerX;
|
|
@@ -1351,7 +1376,7 @@ var Scrollbar = class {
|
|
|
1351
1376
|
this.onDragY = (transformedDrag) => {
|
|
1352
1377
|
if (this.cameraCache) {
|
|
1353
1378
|
const { y } = transformedDrag;
|
|
1354
|
-
const originScale = this.getOriginScale();
|
|
1379
|
+
const originScale = this.option.getOriginScale();
|
|
1355
1380
|
const { minY, maxY } = this.getScrollYRange(this.cameraCache);
|
|
1356
1381
|
const scrollY = Math.round(y / originScale);
|
|
1357
1382
|
let centerY = scrollY + this.cameraCache.centerY;
|
|
@@ -1373,21 +1398,24 @@ var Scrollbar = class {
|
|
|
1373
1398
|
this.scrollContainer.className = this.c("scrollbar-container");
|
|
1374
1399
|
this.container = container;
|
|
1375
1400
|
this.option = option;
|
|
1401
|
+
this.readonly = option.readonly || false;
|
|
1376
1402
|
this.view = view;
|
|
1377
1403
|
this.init();
|
|
1378
|
-
this.view.callbacks.on("onCameraUpdated", this.onCameraUpdated);
|
|
1379
1404
|
}
|
|
1380
1405
|
c(className) {
|
|
1381
1406
|
return `${this.namespace}-${className}`;
|
|
1382
1407
|
}
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1408
|
+
setReadonly(bol) {
|
|
1409
|
+
this.readonly = bol;
|
|
1410
|
+
if (this.readonly) {
|
|
1411
|
+
this.destroy();
|
|
1412
|
+
} else {
|
|
1413
|
+
this.init();
|
|
1414
|
+
}
|
|
1387
1415
|
}
|
|
1388
1416
|
getScrollXRange(camera) {
|
|
1389
1417
|
const { width } = this.option.getPageSize();
|
|
1390
|
-
const originScale = this.getOriginScale();
|
|
1418
|
+
const originScale = this.option.getOriginScale();
|
|
1391
1419
|
const scale = camera.scale;
|
|
1392
1420
|
const ratio = Math.round(originScale / scale * 1e3) / 1e3;
|
|
1393
1421
|
const scrollWidth = width * (1 - ratio);
|
|
@@ -1397,7 +1425,7 @@ var Scrollbar = class {
|
|
|
1397
1425
|
}
|
|
1398
1426
|
getScrollYRange(camera) {
|
|
1399
1427
|
const { height } = this.option.getPageSize();
|
|
1400
|
-
const originScale = this.getOriginScale();
|
|
1428
|
+
const originScale = this.option.getOriginScale();
|
|
1401
1429
|
const scale = camera.scale;
|
|
1402
1430
|
const ratio = Math.round(originScale / scale * 1e3) / 1e3;
|
|
1403
1431
|
const scrollHeight = height * (1 - ratio);
|
|
@@ -1442,6 +1470,8 @@ var Scrollbar = class {
|
|
|
1442
1470
|
this.scrollbarContainerY.appendChild(this.scrollbarY);
|
|
1443
1471
|
this.scrollContainer.append(this.scrollbarContainerX, this.scrollbarContainerY);
|
|
1444
1472
|
this.container.appendChild(this.scrollContainer);
|
|
1473
|
+
this.view.callbacks.on("onCameraUpdated", this.onCameraUpdated);
|
|
1474
|
+
this.onCameraUpdated();
|
|
1445
1475
|
}
|
|
1446
1476
|
destroy() {
|
|
1447
1477
|
var _a, _b, _c, _d;
|
|
@@ -1690,7 +1720,7 @@ var NetlessAppPresentation = {
|
|
|
1690
1720
|
dispose2.add(view$$.addStateChangedListener(() => syncViewFromRemote(false, true)));
|
|
1691
1721
|
const box = context.getBox();
|
|
1692
1722
|
const app = dispose2.add(createPresentation(box, pages, jumpPage, pageIndex$, options.thumbnail));
|
|
1693
|
-
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.
|
|
1723
|
+
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.2";
|
|
1694
1724
|
app.scaleDocsToFit = scaleDocsToFit;
|
|
1695
1725
|
app.log = log;
|
|
1696
1726
|
if (options.justDocsViewReadonly) {
|
|
@@ -1725,17 +1755,33 @@ var NetlessAppPresentation = {
|
|
|
1725
1755
|
dispose2.add(context.emitter.on("writableChange", (isWritable) => {
|
|
1726
1756
|
app.setReadonly(!isWritable);
|
|
1727
1757
|
}));
|
|
1758
|
+
const getPageSize = () => {
|
|
1759
|
+
const { width, height } = app.page() || {};
|
|
1760
|
+
return { width: width || 0, height: height || 0 };
|
|
1761
|
+
};
|
|
1762
|
+
const getOriginScale = () => {
|
|
1763
|
+
const { size } = view;
|
|
1764
|
+
const { width, height } = getPageSize();
|
|
1765
|
+
return Math.min(size.height / height, size.width / width);
|
|
1766
|
+
};
|
|
1767
|
+
const moveCamera = (camera) => {
|
|
1768
|
+
if (context.getIsWritable()) {
|
|
1769
|
+
view.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: "immediately" }));
|
|
1770
|
+
syncView();
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
1773
|
+
throw new Error("[Presentation]: moveCamera must be called in writable room");
|
|
1774
|
+
};
|
|
1775
|
+
let scrollbar;
|
|
1728
1776
|
if (options.useScrollbar) {
|
|
1729
1777
|
dispose2.make(() => {
|
|
1730
|
-
|
|
1731
|
-
getPageSize
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
getWritable: () => context.getIsWritable(),
|
|
1736
|
-
syncView: () => syncView()
|
|
1778
|
+
scrollbar = new Scrollbar(app.contentDOM, {
|
|
1779
|
+
getPageSize,
|
|
1780
|
+
getOriginScale,
|
|
1781
|
+
syncView,
|
|
1782
|
+
getWritable: () => context.getIsWritable()
|
|
1737
1783
|
}, view);
|
|
1738
|
-
return () => scrollbar.destroy();
|
|
1784
|
+
return () => scrollbar == null ? void 0 : scrollbar.destroy();
|
|
1739
1785
|
});
|
|
1740
1786
|
}
|
|
1741
1787
|
context.emitter.on("destroy", () => dispose2());
|
|
@@ -1855,7 +1901,13 @@ var NetlessAppPresentation = {
|
|
|
1855
1901
|
const setDocsViewReadonly = (bol) => {
|
|
1856
1902
|
app.setDocsViewReadonly(bol);
|
|
1857
1903
|
};
|
|
1858
|
-
const
|
|
1904
|
+
const setReadonly = (bol) => {
|
|
1905
|
+
app.setReadonly(bol);
|
|
1906
|
+
if (scrollbar) {
|
|
1907
|
+
scrollbar.setReadonly(bol);
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
const controller = { app, view, context, jumpPage, prevPage, nextPage, pageState, toPdf, log, setDocsViewReadonly, setReadonly, moveCamera, getOriginScale };
|
|
1859
1911
|
dispose2.add(listen(window, "message", (ev) => {
|
|
1860
1912
|
if (ev.data === "@netless/_presentation_") {
|
|
1861
1913
|
if (typeof window !== "undefined")
|
|
@@ -1911,7 +1963,7 @@ var install = (register, options = {}) => {
|
|
|
1911
1963
|
};
|
|
1912
1964
|
|
|
1913
1965
|
// src/index.ts
|
|
1914
|
-
var version = "0.1.9-beta.
|
|
1966
|
+
var version = "0.1.9-beta.2";
|
|
1915
1967
|
|
|
1916
1968
|
exports.NetlessAppPresentation = NetlessAppPresentation;
|
|
1917
1969
|
exports.Presentation = Presentation;
|