@netless/app-presentation 0.1.9-beta.6 → 0.1.9-beta.7
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 +65 -3
- package/dist/index.global.js +45 -13
- package/dist/index.js +45 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app-presentation.ts +11 -9
- package/src/index.ts +1 -0
- package/src/scrollbar/index.ts +32 -1
package/dist/index.mjs
CHANGED
|
@@ -4171,7 +4171,7 @@ var require_lodash = __commonJS({
|
|
|
4171
4171
|
return baseIsMatch(object, source, getMatchData(source), customizer);
|
|
4172
4172
|
}
|
|
4173
4173
|
function isNaN(value) {
|
|
4174
|
-
return
|
|
4174
|
+
return isNumber2(value) && value != +value;
|
|
4175
4175
|
}
|
|
4176
4176
|
function isNative(value) {
|
|
4177
4177
|
if (isMaskable(value)) {
|
|
@@ -4185,7 +4185,7 @@ var require_lodash = __commonJS({
|
|
|
4185
4185
|
function isNil(value) {
|
|
4186
4186
|
return value == null;
|
|
4187
4187
|
}
|
|
4188
|
-
function
|
|
4188
|
+
function isNumber2(value) {
|
|
4189
4189
|
return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
|
|
4190
4190
|
}
|
|
4191
4191
|
function isPlainObject(value) {
|
|
@@ -5251,7 +5251,7 @@ var require_lodash = __commonJS({
|
|
|
5251
5251
|
lodash.isNative = isNative;
|
|
5252
5252
|
lodash.isNil = isNil;
|
|
5253
5253
|
lodash.isNull = isNull;
|
|
5254
|
-
lodash.isNumber =
|
|
5254
|
+
lodash.isNumber = isNumber2;
|
|
5255
5255
|
lodash.isObject = isObject;
|
|
5256
5256
|
lodash.isObjectLike = isObjectLike;
|
|
5257
5257
|
lodash.isPlainObject = isPlainObject;
|
|
@@ -6919,6 +6919,35 @@ var Scrollbar = class {
|
|
|
6919
6919
|
this.option.syncView();
|
|
6920
6920
|
(_b = (_a = this.option.scrollbarEventCallback) == null ? void 0 : _a.onScrollbarDragEnd) == null ? void 0 : _b.call(_a);
|
|
6921
6921
|
};
|
|
6922
|
+
this.moveCamera = (camera) => {
|
|
6923
|
+
const { centerX, centerY } = camera;
|
|
6924
|
+
const cacheCamera = this.view.camera;
|
|
6925
|
+
const _camera = {};
|
|
6926
|
+
if ((0, import_lodash.isNumber)(centerX)) {
|
|
6927
|
+
const { minX, maxX } = this.getScrollXRange(cacheCamera);
|
|
6928
|
+
let newCenterX = centerX;
|
|
6929
|
+
if (centerX < minX) {
|
|
6930
|
+
newCenterX = minX;
|
|
6931
|
+
} else if (centerX > maxX) {
|
|
6932
|
+
newCenterX = maxX;
|
|
6933
|
+
}
|
|
6934
|
+
_camera.centerX = newCenterX;
|
|
6935
|
+
}
|
|
6936
|
+
if ((0, import_lodash.isNumber)(centerY)) {
|
|
6937
|
+
const { minY, maxY } = this.getScrollYRange(cacheCamera);
|
|
6938
|
+
let newCenterY = centerY;
|
|
6939
|
+
if (centerY < minY) {
|
|
6940
|
+
newCenterY = minY;
|
|
6941
|
+
} else if (centerY > maxY) {
|
|
6942
|
+
newCenterY = maxY;
|
|
6943
|
+
}
|
|
6944
|
+
_camera.centerY = newCenterY;
|
|
6945
|
+
}
|
|
6946
|
+
this.view.moveCamera(__spreadProps(__spreadValues({}, _camera), {
|
|
6947
|
+
animationMode: "immediately"
|
|
6948
|
+
}));
|
|
6949
|
+
this.option.syncView();
|
|
6950
|
+
};
|
|
6922
6951
|
this.scrollContainer.className = this.c("scrollbar-container");
|
|
6923
6952
|
this.container = container;
|
|
6924
6953
|
this.option = option;
|
|
@@ -7262,7 +7291,7 @@ var NetlessAppPresentation = {
|
|
|
7262
7291
|
};
|
|
7263
7292
|
const box = context.getBox();
|
|
7264
7293
|
const app = dispose2.add(createPresentation(box, pages, jumpPage, pageIndex$, view, options.thumbnail, options.useClipView));
|
|
7265
|
-
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.
|
|
7294
|
+
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.7";
|
|
7266
7295
|
app.scaleDocsToFit = scaleDocsToFit;
|
|
7267
7296
|
app.log = log;
|
|
7268
7297
|
if (options.justDocsViewReadonly) {
|
|
@@ -7355,14 +7384,6 @@ var NetlessAppPresentation = {
|
|
|
7355
7384
|
});
|
|
7356
7385
|
}
|
|
7357
7386
|
};
|
|
7358
|
-
const moveCamera = (camera) => {
|
|
7359
|
-
if (context.getIsWritable()) {
|
|
7360
|
-
view.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: "immediately" }));
|
|
7361
|
-
syncView();
|
|
7362
|
-
return;
|
|
7363
|
-
}
|
|
7364
|
-
throw new Error("[Presentation]: moveCamera must be called in writable room");
|
|
7365
|
-
};
|
|
7366
7387
|
let scrollbar;
|
|
7367
7388
|
if (options.useScrollbar) {
|
|
7368
7389
|
dispose2.make(() => {
|
|
@@ -7377,6 +7398,16 @@ var NetlessAppPresentation = {
|
|
|
7377
7398
|
return () => scrollbar == null ? void 0 : scrollbar.destroy();
|
|
7378
7399
|
});
|
|
7379
7400
|
}
|
|
7401
|
+
const moveCamera = (camera) => {
|
|
7402
|
+
if (context.getIsWritable() && scrollbar) {
|
|
7403
|
+
if (!scrollbar) {
|
|
7404
|
+
throw new Error("[Presentation]: moveCamera must be called when appOptions: useScrollbar is true");
|
|
7405
|
+
}
|
|
7406
|
+
scrollbar.moveCamera(camera);
|
|
7407
|
+
return;
|
|
7408
|
+
}
|
|
7409
|
+
throw new Error("[Presentation]: moveCamera must be called in writable room");
|
|
7410
|
+
};
|
|
7380
7411
|
context.emitter.on("destroy", () => dispose2());
|
|
7381
7412
|
const reportProgress = (progress, result) => {
|
|
7382
7413
|
window.postMessage({ type: "@netless/_result_save_pdf_", appId: context.appId, progress, result }, "*");
|
|
@@ -7579,7 +7610,7 @@ var install = (register, options = {}) => {
|
|
|
7579
7610
|
};
|
|
7580
7611
|
|
|
7581
7612
|
// src/index.ts
|
|
7582
|
-
var version = "0.1.9-beta.
|
|
7613
|
+
var version = "0.1.9-beta.7";
|
|
7583
7614
|
/*! Bundled license information:
|
|
7584
7615
|
|
|
7585
7616
|
lodash/lodash.js:
|
|
@@ -7593,5 +7624,5 @@ lodash/lodash.js:
|
|
|
7593
7624
|
*)
|
|
7594
7625
|
*/
|
|
7595
7626
|
|
|
7596
|
-
export { NetlessAppPresentation, Presentation, NetlessAppPresentation as default, install, version };
|
|
7627
|
+
export { NetlessAppPresentation, Presentation, Scrollbar, NetlessAppPresentation as default, install, version };
|
|
7597
7628
|
//# sourceMappingURL=index.mjs.map
|