@leafer/worker 1.12.2 → 1.12.3
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/worker.js +53 -18
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +56 -18
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -23
package/dist/worker.module.js
CHANGED
|
@@ -4117,6 +4117,10 @@ class LeaferImage {
|
|
|
4117
4117
|
get url() {
|
|
4118
4118
|
return this.config.url;
|
|
4119
4119
|
}
|
|
4120
|
+
get crossOrigin() {
|
|
4121
|
+
const {crossOrigin: crossOrigin} = this.config;
|
|
4122
|
+
return isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin;
|
|
4123
|
+
}
|
|
4120
4124
|
get completed() {
|
|
4121
4125
|
return this.ready || !!this.error;
|
|
4122
4126
|
}
|
|
@@ -4134,12 +4138,14 @@ class LeaferImage {
|
|
|
4134
4138
|
ImageManager.isFormat("svg", config) && (this.isSVG = true);
|
|
4135
4139
|
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
4136
4140
|
}
|
|
4137
|
-
load(onSuccess, onError) {
|
|
4141
|
+
load(onSuccess, onError, thumbSize) {
|
|
4138
4142
|
if (!this.loading) {
|
|
4139
4143
|
this.loading = true;
|
|
4140
|
-
const {crossOrigin: crossOrigin} = this.config;
|
|
4141
4144
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
4142
|
-
return yield Platform.origin.loadImage(this.
|
|
4145
|
+
return yield Platform.origin.loadImage(this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
|
|
4146
|
+
if (thumbSize) this.setThumbView(img);
|
|
4147
|
+
this.setView(img);
|
|
4148
|
+
}).catch(e => {
|
|
4143
4149
|
this.error = e;
|
|
4144
4150
|
this.onComplete(false);
|
|
4145
4151
|
});
|
|
@@ -4160,9 +4166,11 @@ class LeaferImage {
|
|
|
4160
4166
|
}
|
|
4161
4167
|
setView(img) {
|
|
4162
4168
|
this.ready = true;
|
|
4163
|
-
this.width
|
|
4164
|
-
|
|
4165
|
-
|
|
4169
|
+
if (!this.width) {
|
|
4170
|
+
this.width = img.width;
|
|
4171
|
+
this.height = img.height;
|
|
4172
|
+
this.view = img;
|
|
4173
|
+
}
|
|
4166
4174
|
this.onComplete(true);
|
|
4167
4175
|
}
|
|
4168
4176
|
onComplete(isSuccess) {
|
|
@@ -4208,6 +4216,19 @@ class LeaferImage {
|
|
|
4208
4216
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
4209
4217
|
return pattern;
|
|
4210
4218
|
}
|
|
4219
|
+
getLoadUrl(_thumbSize) {
|
|
4220
|
+
return this.url;
|
|
4221
|
+
}
|
|
4222
|
+
setThumbView(_view) {}
|
|
4223
|
+
getThumbSize() {
|
|
4224
|
+
return undefined;
|
|
4225
|
+
}
|
|
4226
|
+
getMinLevel() {
|
|
4227
|
+
return undefined;
|
|
4228
|
+
}
|
|
4229
|
+
getLevelData(_level) {
|
|
4230
|
+
return undefined;
|
|
4231
|
+
}
|
|
4211
4232
|
clearLevels(_checkUse) {}
|
|
4212
4233
|
destroy() {
|
|
4213
4234
|
this.clearLevels();
|
|
@@ -6937,7 +6958,7 @@ class LeafLevelList {
|
|
|
6937
6958
|
}
|
|
6938
6959
|
}
|
|
6939
6960
|
|
|
6940
|
-
const version = "1.12.
|
|
6961
|
+
const version = "1.12.3";
|
|
6941
6962
|
|
|
6942
6963
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6943
6964
|
get allowBackgroundColor() {
|
|
@@ -10160,6 +10181,10 @@ MoveEvent.DRAG_ANIMATE = "move.drag_animate";
|
|
|
10160
10181
|
|
|
10161
10182
|
MoveEvent.END = "move.end";
|
|
10162
10183
|
|
|
10184
|
+
MoveEvent.PULL_DOWN = "move.pull_down";
|
|
10185
|
+
|
|
10186
|
+
MoveEvent.REACH_BOTTOM = "move.reach_bottom";
|
|
10187
|
+
|
|
10163
10188
|
MoveEvent = __decorate([ registerUIEvent() ], MoveEvent);
|
|
10164
10189
|
|
|
10165
10190
|
let TouchEvent = class TouchEvent extends UIEvent {};
|
|
@@ -11629,7 +11654,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11629
11654
|
ignoreRender(ui, false);
|
|
11630
11655
|
onLoadError(ui, event, error);
|
|
11631
11656
|
leafPaint.loadId = undefined;
|
|
11632
|
-
});
|
|
11657
|
+
}, paint.lod && image.getThumbSize());
|
|
11633
11658
|
if (ui.placeholderColor) {
|
|
11634
11659
|
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
11635
11660
|
if (!image.ready) {
|
|
@@ -15884,15 +15909,28 @@ TextEditor = __decorate([ registerInnerEditor() ], TextEditor);
|
|
|
15884
15909
|
|
|
15885
15910
|
Plugin.add("text-editor", "editor");
|
|
15886
15911
|
|
|
15912
|
+
function getScrollType(leafer) {
|
|
15913
|
+
const {scroll: scroll, disabled: disabled} = leafer.app.config.move;
|
|
15914
|
+
return !scroll || disabled ? "" : scroll === true ? "free" : scroll;
|
|
15915
|
+
}
|
|
15916
|
+
|
|
15887
15917
|
function addViewport(leafer, mergeConfig, custom) {
|
|
15888
15918
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
15889
15919
|
if (leafer.isApp || custom) return;
|
|
15890
15920
|
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, e => {
|
|
15891
15921
|
const move = leafer.getValidMove(e.moveX, e.moveY, false);
|
|
15922
|
+
if (getScrollType(leafer).includes("limit")) {
|
|
15923
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
15924
|
+
if (testMove.x || testMove.y) {
|
|
15925
|
+
const maxX = 100, maxY = 200, resistance = e.moveType === "drag" ? .3 : .05;
|
|
15926
|
+
if (Math.abs(testMove.x) > maxX) move.x = 0; else move.x *= resistance;
|
|
15927
|
+
if (Math.abs(testMove.y) > maxY) move.y = 0; else move.y *= resistance;
|
|
15928
|
+
}
|
|
15929
|
+
}
|
|
15892
15930
|
leafer.zoomLayer.move(move);
|
|
15893
15931
|
}), leafer.on_(MoveEvent.DRAG_ANIMATE, () => {
|
|
15894
|
-
const
|
|
15895
|
-
if (
|
|
15932
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
15933
|
+
if (testMove.x || testMove.y) leafer.interaction.stopDragAnimate();
|
|
15896
15934
|
}), leafer.on_(MoveEvent.END, e => {
|
|
15897
15935
|
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
15898
15936
|
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
|
|
@@ -16198,15 +16236,15 @@ leafer.initType = function(type) {
|
|
|
16198
16236
|
};
|
|
16199
16237
|
|
|
16200
16238
|
leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
16201
|
-
const {
|
|
16239
|
+
const {disabled: disabled} = this.app.config.move;
|
|
16202
16240
|
move$4.set(moveX, moveY);
|
|
16203
|
-
|
|
16204
|
-
|
|
16205
|
-
if (
|
|
16206
|
-
if (checkLimit &&
|
|
16241
|
+
const scrollType = getScrollType(this);
|
|
16242
|
+
if (scrollType) {
|
|
16243
|
+
if (scrollType.includes("x")) move$4.y = 0; else if (scrollType.includes("y")) move$4.x = 0; else Math.abs(move$4.x) > Math.abs(move$4.y) ? move$4.y = 0 : move$4.x = 0;
|
|
16244
|
+
if (checkLimit && scrollType.includes("limit")) {
|
|
16207
16245
|
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
16208
16246
|
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "auto", move$4, true);
|
|
16209
|
-
if (
|
|
16247
|
+
if (scrollType.includes("x")) move$4.y = 0; else if (scrollType.includes("y")) move$4.x = 0;
|
|
16210
16248
|
}
|
|
16211
16249
|
}
|
|
16212
16250
|
return {
|
|
@@ -18289,8 +18327,8 @@ let AnimateList = class AnimateList extends Animate {
|
|
|
18289
18327
|
this.each(item => item.stop());
|
|
18290
18328
|
this.emitType(AnimateEvent.STOP);
|
|
18291
18329
|
}
|
|
18292
|
-
seek(time) {
|
|
18293
|
-
this.each(item => item.seek(time));
|
|
18330
|
+
seek(time, includeDelay) {
|
|
18331
|
+
this.each(item => item.seek(time, includeDelay));
|
|
18294
18332
|
this.emitType(AnimateEvent.SEEK);
|
|
18295
18333
|
}
|
|
18296
18334
|
kill(complete, killStyle) {
|