@leafer/core 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/lib/core.cjs CHANGED
@@ -4110,6 +4110,10 @@ class LeaferImage {
4110
4110
  get url() {
4111
4111
  return this.config.url;
4112
4112
  }
4113
+ get crossOrigin() {
4114
+ const {crossOrigin: crossOrigin} = this.config;
4115
+ return isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin;
4116
+ }
4113
4117
  get completed() {
4114
4118
  return this.ready || !!this.error;
4115
4119
  }
@@ -4127,12 +4131,14 @@ class LeaferImage {
4127
4131
  ImageManager.isFormat("svg", config) && (this.isSVG = true);
4128
4132
  ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
4129
4133
  }
4130
- load(onSuccess, onError) {
4134
+ load(onSuccess, onError, thumbSize) {
4131
4135
  if (!this.loading) {
4132
4136
  this.loading = true;
4133
- const {crossOrigin: crossOrigin} = this.config;
4134
4137
  Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
4135
- return yield Platform.origin.loadImage(this.url, isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin, this).then(img => this.setView(img)).catch(e => {
4138
+ return yield Platform.origin.loadImage(this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
4139
+ if (thumbSize) this.setThumbView(img);
4140
+ this.setView(img);
4141
+ }).catch(e => {
4136
4142
  this.error = e;
4137
4143
  this.onComplete(false);
4138
4144
  });
@@ -4153,9 +4159,11 @@ class LeaferImage {
4153
4159
  }
4154
4160
  setView(img) {
4155
4161
  this.ready = true;
4156
- this.width = img.naturalWidth || img.width;
4157
- this.height = img.naturalHeight || img.height;
4158
- this.view = img;
4162
+ if (!this.width) {
4163
+ this.width = img.width;
4164
+ this.height = img.height;
4165
+ this.view = img;
4166
+ }
4159
4167
  this.onComplete(true);
4160
4168
  }
4161
4169
  onComplete(isSuccess) {
@@ -4201,6 +4209,19 @@ class LeaferImage {
4201
4209
  Platform.image.setPatternTransform(pattern, transform, paint);
4202
4210
  return pattern;
4203
4211
  }
4212
+ getLoadUrl(_thumbSize) {
4213
+ return this.url;
4214
+ }
4215
+ setThumbView(_view) {}
4216
+ getThumbSize() {
4217
+ return undefined;
4218
+ }
4219
+ getMinLevel() {
4220
+ return undefined;
4221
+ }
4222
+ getLevelData(_level) {
4223
+ return undefined;
4224
+ }
4204
4225
  clearLevels(_checkUse) {}
4205
4226
  destroy() {
4206
4227
  this.clearLevels();
@@ -6930,7 +6951,7 @@ class LeafLevelList {
6930
6951
  }
6931
6952
  }
6932
6953
 
6933
- const version = "1.12.2";
6954
+ const version = "1.12.3";
6934
6955
 
6935
6956
  exports.AlignHelper = AlignHelper;
6936
6957
 
package/lib/core.esm.js CHANGED
@@ -4108,6 +4108,10 @@ class LeaferImage {
4108
4108
  get url() {
4109
4109
  return this.config.url;
4110
4110
  }
4111
+ get crossOrigin() {
4112
+ const {crossOrigin: crossOrigin} = this.config;
4113
+ return isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin;
4114
+ }
4111
4115
  get completed() {
4112
4116
  return this.ready || !!this.error;
4113
4117
  }
@@ -4125,12 +4129,14 @@ class LeaferImage {
4125
4129
  ImageManager.isFormat("svg", config) && (this.isSVG = true);
4126
4130
  ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
4127
4131
  }
4128
- load(onSuccess, onError) {
4132
+ load(onSuccess, onError, thumbSize) {
4129
4133
  if (!this.loading) {
4130
4134
  this.loading = true;
4131
- const {crossOrigin: crossOrigin} = this.config;
4132
4135
  Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
4133
- return yield Platform.origin.loadImage(this.url, isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin, this).then(img => this.setView(img)).catch(e => {
4136
+ return yield Platform.origin.loadImage(this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
4137
+ if (thumbSize) this.setThumbView(img);
4138
+ this.setView(img);
4139
+ }).catch(e => {
4134
4140
  this.error = e;
4135
4141
  this.onComplete(false);
4136
4142
  });
@@ -4151,9 +4157,11 @@ class LeaferImage {
4151
4157
  }
4152
4158
  setView(img) {
4153
4159
  this.ready = true;
4154
- this.width = img.naturalWidth || img.width;
4155
- this.height = img.naturalHeight || img.height;
4156
- this.view = img;
4160
+ if (!this.width) {
4161
+ this.width = img.width;
4162
+ this.height = img.height;
4163
+ this.view = img;
4164
+ }
4157
4165
  this.onComplete(true);
4158
4166
  }
4159
4167
  onComplete(isSuccess) {
@@ -4199,6 +4207,19 @@ class LeaferImage {
4199
4207
  Platform.image.setPatternTransform(pattern, transform, paint);
4200
4208
  return pattern;
4201
4209
  }
4210
+ getLoadUrl(_thumbSize) {
4211
+ return this.url;
4212
+ }
4213
+ setThumbView(_view) {}
4214
+ getThumbSize() {
4215
+ return undefined;
4216
+ }
4217
+ getMinLevel() {
4218
+ return undefined;
4219
+ }
4220
+ getLevelData(_level) {
4221
+ return undefined;
4222
+ }
4202
4223
  clearLevels(_checkUse) {}
4203
4224
  destroy() {
4204
4225
  this.clearLevels();
@@ -6928,6 +6949,6 @@ class LeafLevelList {
6928
6949
  }
6929
6950
  }
6930
6951
 
6931
- const version = "1.12.2";
6952
+ const version = "1.12.3";
6932
6953
 
6933
6954
  export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, FourNumberHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useModule, version, visibleType };