@netless/app-presentation 0.1.9-beta.6 → 0.1.9-beta.8
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 +53 -13
- package/dist/index.js +53 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -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 +40 -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,43 @@ 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, scale } = 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
|
+
if ((0, import_lodash.isNumber)(scale)) {
|
|
6947
|
+
let newScale = scale;
|
|
6948
|
+
const originScale = this.option.getOriginScale();
|
|
6949
|
+
if (scale < originScale) {
|
|
6950
|
+
newScale = originScale;
|
|
6951
|
+
}
|
|
6952
|
+
_camera.scale = newScale;
|
|
6953
|
+
}
|
|
6954
|
+
this.view.moveCamera(__spreadProps(__spreadValues({}, _camera), {
|
|
6955
|
+
animationMode: "immediately"
|
|
6956
|
+
}));
|
|
6957
|
+
this.option.syncView();
|
|
6958
|
+
};
|
|
6922
6959
|
this.scrollContainer.className = this.c("scrollbar-container");
|
|
6923
6960
|
this.container = container;
|
|
6924
6961
|
this.option = option;
|
|
@@ -7262,7 +7299,7 @@ var NetlessAppPresentation = {
|
|
|
7262
7299
|
};
|
|
7263
7300
|
const box = context.getBox();
|
|
7264
7301
|
const app = dispose2.add(createPresentation(box, pages, jumpPage, pageIndex$, view, options.thumbnail, options.useClipView));
|
|
7265
|
-
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.
|
|
7302
|
+
app.contentDOM.dataset.appPresentationVersion = "0.1.9-beta.8";
|
|
7266
7303
|
app.scaleDocsToFit = scaleDocsToFit;
|
|
7267
7304
|
app.log = log;
|
|
7268
7305
|
if (options.justDocsViewReadonly) {
|
|
@@ -7355,14 +7392,6 @@ var NetlessAppPresentation = {
|
|
|
7355
7392
|
});
|
|
7356
7393
|
}
|
|
7357
7394
|
};
|
|
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
7395
|
let scrollbar;
|
|
7367
7396
|
if (options.useScrollbar) {
|
|
7368
7397
|
dispose2.make(() => {
|
|
@@ -7377,6 +7406,16 @@ var NetlessAppPresentation = {
|
|
|
7377
7406
|
return () => scrollbar == null ? void 0 : scrollbar.destroy();
|
|
7378
7407
|
});
|
|
7379
7408
|
}
|
|
7409
|
+
const moveCamera = (camera) => {
|
|
7410
|
+
if (context.getIsWritable() && scrollbar) {
|
|
7411
|
+
if (!scrollbar) {
|
|
7412
|
+
throw new Error("[Presentation]: moveCamera must be called when appOptions: useScrollbar is true");
|
|
7413
|
+
}
|
|
7414
|
+
scrollbar.moveCamera(camera);
|
|
7415
|
+
return;
|
|
7416
|
+
}
|
|
7417
|
+
throw new Error("[Presentation]: moveCamera must be called in writable room");
|
|
7418
|
+
};
|
|
7380
7419
|
context.emitter.on("destroy", () => dispose2());
|
|
7381
7420
|
const reportProgress = (progress, result) => {
|
|
7382
7421
|
window.postMessage({ type: "@netless/_result_save_pdf_", appId: context.appId, progress, result }, "*");
|
|
@@ -7579,7 +7618,7 @@ var install = (register, options = {}) => {
|
|
|
7579
7618
|
};
|
|
7580
7619
|
|
|
7581
7620
|
// src/index.ts
|
|
7582
|
-
var version = "0.1.9-beta.
|
|
7621
|
+
var version = "0.1.9-beta.8";
|
|
7583
7622
|
/*! Bundled license information:
|
|
7584
7623
|
|
|
7585
7624
|
lodash/lodash.js:
|
|
@@ -7593,5 +7632,5 @@ lodash/lodash.js:
|
|
|
7593
7632
|
*)
|
|
7594
7633
|
*/
|
|
7595
7634
|
|
|
7596
|
-
export { NetlessAppPresentation, Presentation, NetlessAppPresentation as default, install, version };
|
|
7635
|
+
export { NetlessAppPresentation, Presentation, Scrollbar, NetlessAppPresentation as default, install, version };
|
|
7597
7636
|
//# sourceMappingURL=index.mjs.map
|