@leafer-ui/worker 1.12.2 → 1.12.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/worker.cjs +1 -1
- package/dist/worker.esm.js +1 -1
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +38 -13
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +40 -13
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.module.js
CHANGED
|
@@ -246,11 +246,13 @@ const Platform = {
|
|
|
246
246
|
const ctx = canvas.getContext("2d");
|
|
247
247
|
if (opacity) ctx.globalAlpha = opacity;
|
|
248
248
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
if (image) {
|
|
250
|
+
if (clip) {
|
|
251
|
+
const scaleX = width / clip.width, scaleY = height / clip.height;
|
|
252
|
+
ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
|
|
253
|
+
ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
254
|
+
} else ctx.drawImage(image, 0, 0, width, height);
|
|
255
|
+
}
|
|
254
256
|
return canvas;
|
|
255
257
|
},
|
|
256
258
|
setPatternTransform(pattern, transform, paint) {
|
|
@@ -4117,6 +4119,10 @@ class LeaferImage {
|
|
|
4117
4119
|
get url() {
|
|
4118
4120
|
return this.config.url;
|
|
4119
4121
|
}
|
|
4122
|
+
get crossOrigin() {
|
|
4123
|
+
const {crossOrigin: crossOrigin} = this.config;
|
|
4124
|
+
return isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin;
|
|
4125
|
+
}
|
|
4120
4126
|
get completed() {
|
|
4121
4127
|
return this.ready || !!this.error;
|
|
4122
4128
|
}
|
|
@@ -4134,12 +4140,14 @@ class LeaferImage {
|
|
|
4134
4140
|
ImageManager.isFormat("svg", config) && (this.isSVG = true);
|
|
4135
4141
|
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
4136
4142
|
}
|
|
4137
|
-
load(onSuccess, onError) {
|
|
4143
|
+
load(onSuccess, onError, thumbSize) {
|
|
4138
4144
|
if (!this.loading) {
|
|
4139
4145
|
this.loading = true;
|
|
4140
|
-
const {crossOrigin: crossOrigin} = this.config;
|
|
4141
4146
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
4142
|
-
return yield Platform.origin.loadImage(this.
|
|
4147
|
+
return yield Platform.origin.loadImage(this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
|
|
4148
|
+
if (thumbSize) this.setThumbView(img);
|
|
4149
|
+
this.setView(img);
|
|
4150
|
+
}).catch(e => {
|
|
4143
4151
|
this.error = e;
|
|
4144
4152
|
this.onComplete(false);
|
|
4145
4153
|
});
|
|
@@ -4160,9 +4168,11 @@ class LeaferImage {
|
|
|
4160
4168
|
}
|
|
4161
4169
|
setView(img) {
|
|
4162
4170
|
this.ready = true;
|
|
4163
|
-
this.width
|
|
4164
|
-
|
|
4165
|
-
|
|
4171
|
+
if (!this.width) {
|
|
4172
|
+
this.width = img.width;
|
|
4173
|
+
this.height = img.height;
|
|
4174
|
+
this.view = img;
|
|
4175
|
+
}
|
|
4166
4176
|
this.onComplete(true);
|
|
4167
4177
|
}
|
|
4168
4178
|
onComplete(isSuccess) {
|
|
@@ -4208,6 +4218,19 @@ class LeaferImage {
|
|
|
4208
4218
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
4209
4219
|
return pattern;
|
|
4210
4220
|
}
|
|
4221
|
+
getLoadUrl(_thumbSize) {
|
|
4222
|
+
return this.url;
|
|
4223
|
+
}
|
|
4224
|
+
setThumbView(_view) {}
|
|
4225
|
+
getThumbSize(_lod) {
|
|
4226
|
+
return undefined;
|
|
4227
|
+
}
|
|
4228
|
+
getMinLevel() {
|
|
4229
|
+
return undefined;
|
|
4230
|
+
}
|
|
4231
|
+
getLevelData(_level, _width, _height) {
|
|
4232
|
+
return undefined;
|
|
4233
|
+
}
|
|
4211
4234
|
clearLevels(_checkUse) {}
|
|
4212
4235
|
destroy() {
|
|
4213
4236
|
this.clearLevels();
|
|
@@ -6937,7 +6960,7 @@ class LeafLevelList {
|
|
|
6937
6960
|
}
|
|
6938
6961
|
}
|
|
6939
6962
|
|
|
6940
|
-
const version = "1.12.
|
|
6963
|
+
const version = "1.12.4";
|
|
6941
6964
|
|
|
6942
6965
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6943
6966
|
get allowBackgroundColor() {
|
|
@@ -10160,6 +10183,10 @@ MoveEvent.DRAG_ANIMATE = "move.drag_animate";
|
|
|
10160
10183
|
|
|
10161
10184
|
MoveEvent.END = "move.end";
|
|
10162
10185
|
|
|
10186
|
+
MoveEvent.PULL_DOWN = "move.pull_down";
|
|
10187
|
+
|
|
10188
|
+
MoveEvent.REACH_BOTTOM = "move.reach_bottom";
|
|
10189
|
+
|
|
10163
10190
|
MoveEvent = __decorate([ registerUIEvent() ], MoveEvent);
|
|
10164
10191
|
|
|
10165
10192
|
let TouchEvent = class TouchEvent extends UIEvent {};
|
|
@@ -11629,7 +11656,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11629
11656
|
ignoreRender(ui, false);
|
|
11630
11657
|
onLoadError(ui, event, error);
|
|
11631
11658
|
leafPaint.loadId = undefined;
|
|
11632
|
-
});
|
|
11659
|
+
}, paint.lod && image.getThumbSize(paint.lod));
|
|
11633
11660
|
if (ui.placeholderColor) {
|
|
11634
11661
|
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
11635
11662
|
if (!image.ready) {
|