@leafer-game/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 CHANGED
@@ -3875,6 +3875,10 @@ var LeaferUI = function(exports) {
3875
3875
  get url() {
3876
3876
  return this.config.url;
3877
3877
  }
3878
+ get crossOrigin() {
3879
+ const {crossOrigin: crossOrigin} = this.config;
3880
+ return isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin;
3881
+ }
3878
3882
  get completed() {
3879
3883
  return this.ready || !!this.error;
3880
3884
  }
@@ -3892,12 +3896,14 @@ var LeaferUI = function(exports) {
3892
3896
  ImageManager.isFormat("svg", config) && (this.isSVG = true);
3893
3897
  ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
3894
3898
  }
3895
- load(onSuccess, onError) {
3899
+ load(onSuccess, onError, thumbSize) {
3896
3900
  if (!this.loading) {
3897
3901
  this.loading = true;
3898
- const {crossOrigin: crossOrigin} = this.config;
3899
3902
  Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
3900
- return yield Platform.origin.loadImage(this.url, isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin, this).then(img => this.setView(img)).catch(e => {
3903
+ return yield Platform.origin.loadImage(this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
3904
+ if (thumbSize) this.setThumbView(img);
3905
+ this.setView(img);
3906
+ }).catch(e => {
3901
3907
  this.error = e;
3902
3908
  this.onComplete(false);
3903
3909
  });
@@ -3918,9 +3924,11 @@ var LeaferUI = function(exports) {
3918
3924
  }
3919
3925
  setView(img) {
3920
3926
  this.ready = true;
3921
- this.width = img.naturalWidth || img.width;
3922
- this.height = img.naturalHeight || img.height;
3923
- this.view = img;
3927
+ if (!this.width) {
3928
+ this.width = img.width;
3929
+ this.height = img.height;
3930
+ this.view = img;
3931
+ }
3924
3932
  this.onComplete(true);
3925
3933
  }
3926
3934
  onComplete(isSuccess) {
@@ -3966,6 +3974,19 @@ var LeaferUI = function(exports) {
3966
3974
  Platform.image.setPatternTransform(pattern, transform, paint);
3967
3975
  return pattern;
3968
3976
  }
3977
+ getLoadUrl(_thumbSize) {
3978
+ return this.url;
3979
+ }
3980
+ setThumbView(_view) {}
3981
+ getThumbSize() {
3982
+ return undefined;
3983
+ }
3984
+ getMinLevel() {
3985
+ return undefined;
3986
+ }
3987
+ getLevelData(_level) {
3988
+ return undefined;
3989
+ }
3969
3990
  clearLevels(_checkUse) {}
3970
3991
  destroy() {
3971
3992
  this.clearLevels();
@@ -6526,7 +6547,7 @@ var LeaferUI = function(exports) {
6526
6547
  this.levelMap = null;
6527
6548
  }
6528
6549
  }
6529
- const version = "1.12.2";
6550
+ const version = "1.12.3";
6530
6551
  class LeaferCanvas extends LeaferCanvasBase {
6531
6552
  get allowBackgroundColor() {
6532
6553
  return true;
@@ -9416,6 +9437,8 @@ var LeaferUI = function(exports) {
9416
9437
  exports.MoveEvent.MOVE = "move";
9417
9438
  exports.MoveEvent.DRAG_ANIMATE = "move.drag_animate";
9418
9439
  exports.MoveEvent.END = "move.end";
9440
+ exports.MoveEvent.PULL_DOWN = "move.pull_down";
9441
+ exports.MoveEvent.REACH_BOTTOM = "move.reach_bottom";
9419
9442
  exports.MoveEvent = __decorate([ registerUIEvent() ], exports.MoveEvent);
9420
9443
  exports.TouchEvent = class TouchEvent extends UIEvent {};
9421
9444
  exports.TouchEvent = __decorate([ registerUIEvent() ], exports.TouchEvent);
@@ -10790,7 +10813,7 @@ var LeaferUI = function(exports) {
10790
10813
  ignoreRender(ui, false);
10791
10814
  onLoadError(ui, event, error);
10792
10815
  leafPaint.loadId = undefined;
10793
- });
10816
+ }, paint.lod && image.getThumbSize());
10794
10817
  if (ui.placeholderColor) {
10795
10818
  if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
10796
10819
  if (!image.ready) {
@@ -12931,8 +12954,8 @@ var LeaferUI = function(exports) {
12931
12954
  this.each(item => item.stop());
12932
12955
  this.emitType(AnimateEvent.STOP);
12933
12956
  }
12934
- seek(time) {
12935
- this.each(item => item.seek(time));
12957
+ seek(time, includeDelay) {
12958
+ this.each(item => item.seek(time, includeDelay));
12936
12959
  this.emitType(AnimateEvent.SEEK);
12937
12960
  }
12938
12961
  kill(complete, killStyle) {