leafer-ui 1.9.12 → 1.10.1

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.
@@ -1,43 +1,3 @@
1
- const Platform = {
2
- toURL(text, fileType) {
3
- let url = encodeURIComponent(text);
4
- if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
5
- return url;
6
- },
7
- image: {
8
- hitCanvasSize: 100,
9
- maxCacheSize: 2560 * 1600,
10
- maxPatternSize: 4096 * 2160,
11
- crossOrigin: "anonymous",
12
- getRealURL(url) {
13
- const {prefix: prefix, suffix: suffix} = Platform.image;
14
- if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
15
- if (prefix && url[0] === "/") url = prefix + url;
16
- return url;
17
- }
18
- }
19
- };
20
-
21
- const IncrementId = {
22
- RUNTIME: "runtime",
23
- LEAF: "leaf",
24
- TASK: "task",
25
- CNAVAS: "canvas",
26
- IMAGE: "image",
27
- types: {},
28
- create(typeName) {
29
- const {types: types} = I$2;
30
- if (types[typeName]) {
31
- return types[typeName]++;
32
- } else {
33
- types[typeName] = 1;
34
- return 0;
35
- }
36
- }
37
- };
38
-
39
- const I$2 = IncrementId;
40
-
41
1
  var Answer;
42
2
 
43
3
  (function(Answer) {
@@ -247,9 +207,80 @@ class LeafData {
247
207
  }
248
208
  }
249
209
 
210
+ const {floor: floor$2, max: max$5} = Math;
211
+
212
+ const Platform = {
213
+ toURL(text, fileType) {
214
+ let url = encodeURIComponent(text);
215
+ if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
216
+ return url;
217
+ },
218
+ image: {
219
+ hitCanvasSize: 100,
220
+ maxCacheSize: 2560 * 1600,
221
+ maxPatternSize: 4096 * 2160,
222
+ crossOrigin: "anonymous",
223
+ isLarge(size, scaleX, scaleY, largeSize) {
224
+ return size.width * size.height * (scaleX ? scaleX * scaleY : 1) > (largeSize || image$1.maxCacheSize);
225
+ },
226
+ isSuperLarge(size, scaleX, scaleY) {
227
+ return image$1.isLarge(size, scaleX, scaleY, image$1.maxPatternSize);
228
+ },
229
+ getRealURL(url) {
230
+ const {prefix: prefix, suffix: suffix} = Platform.image;
231
+ if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
232
+ if (prefix && url[0] === "/") url = prefix + url;
233
+ return url;
234
+ },
235
+ resize(image, width, height, xGap, yGap, clip, smooth, opacity, _filters) {
236
+ const canvas = Platform.origin.createCanvas(max$5(floor$2(width + (xGap || 0)), 1), max$5(floor$2(height + (yGap || 0)), 1));
237
+ const ctx = canvas.getContext("2d");
238
+ if (opacity) ctx.globalAlpha = opacity;
239
+ ctx.imageSmoothingEnabled = smooth === false ? false : true;
240
+ if (clip) {
241
+ const scaleX = width / clip.width, scaleY = height / clip.height;
242
+ ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
243
+ ctx.drawImage(image, 0, 0, image.width, image.height);
244
+ } else ctx.drawImage(image, 0, 0, width, height);
245
+ return canvas;
246
+ },
247
+ setPatternTransform(pattern, transform, paint) {
248
+ try {
249
+ if (transform && pattern.setTransform) {
250
+ pattern.setTransform(transform);
251
+ transform = undefined;
252
+ }
253
+ } catch (_a) {}
254
+ if (paint) DataHelper.stintSet(paint, "transform", transform);
255
+ }
256
+ }
257
+ };
258
+
259
+ const {image: image$1} = Platform;
260
+
261
+ const IncrementId = {
262
+ RUNTIME: "runtime",
263
+ LEAF: "leaf",
264
+ TASK: "task",
265
+ CNAVAS: "canvas",
266
+ IMAGE: "image",
267
+ types: {},
268
+ create(typeName) {
269
+ const {types: types} = I$2;
270
+ if (types[typeName]) {
271
+ return types[typeName]++;
272
+ } else {
273
+ types[typeName] = 1;
274
+ return 0;
275
+ }
276
+ }
277
+ };
278
+
279
+ const I$2 = IncrementId;
280
+
250
281
  let tempA, tempB, tempTo;
251
282
 
252
- const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
283
+ const {max: max$4} = Math, tempFour = [ 0, 0, 0, 0 ];
253
284
 
254
285
  const FourNumberHelper = {
255
286
  zero: [ ...tempFour ],
@@ -301,9 +332,9 @@ const FourNumberHelper = {
301
332
  return data;
302
333
  },
303
334
  max(t, other, change) {
304
- if (isNumber(t) && isNumber(other)) return max$5(t, other);
335
+ if (isNumber(t) && isNumber(other)) return max$4(t, other);
305
336
  toTempAB(t, other, change);
306
- return set$2(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
337
+ return set$2(tempTo, max$4(tempA[0], tempB[0]), max$4(tempA[1], tempB[1]), max$4(tempA[2], tempB[2]), max$4(tempA[3], tempB[3]));
307
338
  },
308
339
  add(t, other, change) {
309
340
  if (isNumber(t) && isNumber(other)) return t + other;
@@ -320,7 +351,7 @@ const FourNumberHelper = {
320
351
 
321
352
  const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
322
353
 
323
- const {round: round$3, pow: pow$1, PI: PI$3} = Math;
354
+ const {round: round$3, pow: pow$1, max: max$3, floor: floor$1, PI: PI$3} = Math;
324
355
 
325
356
  const MathHelper = {
326
357
  within(value, min, max) {
@@ -373,6 +404,9 @@ const MathHelper = {
373
404
  scaleData.scaleY = scale.y;
374
405
  }
375
406
  },
407
+ getFloorScale(num, min = 1) {
408
+ return max$3(floor$1(num), min) / num;
409
+ },
376
410
  randInt: randInt,
377
411
  randColor(opacity) {
378
412
  return `rgba(${randInt(255)},${randInt(255)},${randInt(255)},${opacity || 1})`;
@@ -1202,7 +1236,7 @@ const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1202
1236
 
1203
1237
  const {float: float$1, fourNumber: fourNumber} = MathHelper;
1204
1238
 
1205
- const {floor: floor$2, ceil: ceil$2} = Math;
1239
+ const {floor: floor, ceil: ceil$1} = Math;
1206
1240
 
1207
1241
  let right$1, bottom$1, boundsRight, boundsBottom;
1208
1242
 
@@ -1294,20 +1328,20 @@ const BoundsHelper = {
1294
1328
  toOuterOf(t, matrix, to) {
1295
1329
  to || (to = t);
1296
1330
  if (matrix.b === 0 && matrix.c === 0) {
1297
- const {a: a, d: d} = matrix;
1331
+ const {a: a, d: d, e: e, f: f} = matrix;
1298
1332
  if (a > 0) {
1299
1333
  to.width = t.width * a;
1300
- to.x = matrix.e + t.x * a;
1334
+ to.x = e + t.x * a;
1301
1335
  } else {
1302
1336
  to.width = t.width * -a;
1303
- to.x = matrix.e + t.x * a - to.width;
1337
+ to.x = e + t.x * a - to.width;
1304
1338
  }
1305
1339
  if (d > 0) {
1306
1340
  to.height = t.height * d;
1307
- to.y = matrix.f + t.y * d;
1341
+ to.y = f + t.y * d;
1308
1342
  } else {
1309
1343
  to.height = t.height * -d;
1310
- to.y = matrix.f + t.y * d - to.height;
1344
+ to.y = f + t.y * d - to.height;
1311
1345
  }
1312
1346
  } else {
1313
1347
  point.x = t.x;
@@ -1359,10 +1393,10 @@ const BoundsHelper = {
1359
1393
  },
1360
1394
  ceil(t) {
1361
1395
  const {x: x, y: y} = t;
1362
- t.x = floor$2(t.x);
1363
- t.y = floor$2(t.y);
1364
- t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
1365
- t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
1396
+ t.x = floor(t.x);
1397
+ t.y = floor(t.y);
1398
+ t.width = x > t.x ? ceil$1(t.width + x - t.x) : ceil$1(t.width);
1399
+ t.height = y > t.y ? ceil$1(t.height + y - t.y) : ceil$1(t.height);
1366
1400
  },
1367
1401
  unsign(t) {
1368
1402
  if (t.width < 0) {
@@ -2592,7 +2626,7 @@ const RectHelper = {
2592
2626
  }
2593
2627
  };
2594
2628
 
2595
- const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$4, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
2629
+ const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil, abs: abs$4, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
2596
2630
 
2597
2631
  const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
2598
2632
 
@@ -2700,7 +2734,7 @@ const BezierHelper = {
2700
2734
  let totalRadian = endRadian - startRadian;
2701
2735
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2702
2736
  if (anticlockwise) totalRadian -= PI2;
2703
- const parts = ceil$1(abs$4(totalRadian / PI_2));
2737
+ const parts = ceil(abs$4(totalRadian / PI_2));
2704
2738
  const partRadian = totalRadian / parts;
2705
2739
  const partRadian4Sin = sin$3(partRadian / 4);
2706
2740
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
@@ -3708,7 +3742,9 @@ class TaskItem {
3708
3742
  run() {
3709
3743
  return __awaiter(this, void 0, void 0, function*() {
3710
3744
  try {
3711
- if (this.task && !this.isComplete && this.parent.running) yield this.task();
3745
+ if (this.isComplete) return;
3746
+ if (this.canUse && !this.canUse()) return this.cancel();
3747
+ if (this.task && this.parent.running) yield this.task();
3712
3748
  } catch (error) {
3713
3749
  debug$a.error(error);
3714
3750
  }
@@ -3716,8 +3752,7 @@ class TaskItem {
3716
3752
  }
3717
3753
  complete() {
3718
3754
  this.isComplete = true;
3719
- this.parent = null;
3720
- this.task = null;
3755
+ this.parent = this.task = this.canUse = null;
3721
3756
  }
3722
3757
  cancel() {
3723
3758
  this.isCancel = true;
@@ -3760,7 +3795,7 @@ class TaskProcessor {
3760
3795
  if (config) DataHelper.assign(this.config, config);
3761
3796
  this.empty();
3762
3797
  }
3763
- add(taskCallback, options) {
3798
+ add(taskCallback, options, canUse) {
3764
3799
  let start, parallel, time, delay;
3765
3800
  const task = new TaskItem(taskCallback);
3766
3801
  task.parent = this;
@@ -3771,9 +3806,11 @@ class TaskProcessor {
3771
3806
  start = options.start;
3772
3807
  time = options.time;
3773
3808
  delay = options.delay;
3809
+ if (!canUse) canUse = options.canUse;
3774
3810
  }
3775
3811
  if (time) task.time = time;
3776
3812
  if (parallel === false) task.parallel = false;
3813
+ if (canUse) task.canUse = canUse;
3777
3814
  if (isUndefined(delay)) {
3778
3815
  this.push(task, start);
3779
3816
  } else {
@@ -3843,15 +3880,10 @@ class TaskProcessor {
3843
3880
  this.timer = setTimeout(() => this.nextTask());
3844
3881
  return;
3845
3882
  }
3846
- if (task.isCancel) {
3847
- this.index++;
3848
- this.runTask();
3849
- return;
3850
- }
3851
3883
  task.run().then(() => {
3852
3884
  this.onTask(task);
3853
3885
  this.index++;
3854
- this.nextTask();
3886
+ task.isCancel ? this.runTask() : this.nextTask();
3855
3887
  }).catch(error => {
3856
3888
  this.onError(error);
3857
3889
  });
@@ -4027,8 +4059,6 @@ const I$1 = ImageManager;
4027
4059
 
4028
4060
  const {IMAGE: IMAGE, create: create$1} = IncrementId;
4029
4061
 
4030
- const {floor: floor$1, max: max$4} = Math;
4031
-
4032
4062
  class LeaferImage {
4033
4063
  get url() {
4034
4064
  return this.config.url;
@@ -4053,10 +4083,9 @@ class LeaferImage {
4053
4083
  load(onSuccess, onError) {
4054
4084
  if (!this.loading) {
4055
4085
  this.loading = true;
4056
- let {loadImage: loadImage, loadImageWithProgress: loadImageWithProgress} = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
4057
- if (onProgress) loadImage = loadImageWithProgress;
4086
+ const {crossOrigin: crossOrigin} = this.config;
4058
4087
  Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
4059
- return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch(e => {
4088
+ return yield Platform.origin.loadImage(this.url, isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin, this).then(img => this.setView(img)).catch(e => {
4060
4089
  this.error = e;
4061
4090
  this.onComplete(false);
4062
4091
  });
@@ -4082,9 +4111,6 @@ class LeaferImage {
4082
4111
  this.view = img;
4083
4112
  this.onComplete(true);
4084
4113
  }
4085
- onProgress(progress) {
4086
- this.progress = progress;
4087
- }
4088
4114
  onComplete(isSuccess) {
4089
4115
  let odd;
4090
4116
  this.waitComplete.forEach((item, index) => {
@@ -4103,7 +4129,7 @@ class LeaferImage {
4103
4129
  getFull(_filters) {
4104
4130
  return this.view;
4105
4131
  }
4106
- getCanvas(width, height, opacity, _filters, xGap, yGap, smooth) {
4132
+ getCanvas(width, height, opacity, filters, xGap, yGap, smooth) {
4107
4133
  width || (width = this.width);
4108
4134
  height || (height = this.height);
4109
4135
  if (this.cache) {
@@ -4116,11 +4142,7 @@ class LeaferImage {
4116
4142
  }
4117
4143
  if (data) return data;
4118
4144
  }
4119
- const canvas = Platform.origin.createCanvas(max$4(floor$1(width + (xGap || 0)), 1), max$4(floor$1(height + (yGap || 0)), 1));
4120
- const ctx = canvas.getContext("2d");
4121
- if (opacity) ctx.globalAlpha = opacity;
4122
- ctx.imageSmoothingEnabled = smooth === false ? false : true;
4123
- ctx.drawImage(this.view, 0, 0, width, height);
4145
+ const canvas = Platform.image.resize(this.view, width, height, xGap, yGap, undefined, smooth, opacity, filters);
4124
4146
  this.cache = this.use > 1 ? {
4125
4147
  data: canvas,
4126
4148
  params: arguments
@@ -4129,13 +4151,7 @@ class LeaferImage {
4129
4151
  }
4130
4152
  getPattern(canvas, repeat, transform, paint) {
4131
4153
  const pattern = Platform.canvas.createPattern(canvas, repeat);
4132
- try {
4133
- if (transform && pattern.setTransform) {
4134
- pattern.setTransform(transform);
4135
- transform = undefined;
4136
- }
4137
- } catch (_a) {}
4138
- if (paint) DataHelper.stintSet(paint, "transform", transform);
4154
+ Platform.image.setPatternTransform(pattern, transform, paint);
4139
4155
  return pattern;
4140
4156
  }
4141
4157
  destroy() {
@@ -5809,12 +5825,12 @@ const {toBounds: toBounds} = PathBounds;
5809
5825
 
5810
5826
  const LeafBounds = {
5811
5827
  __updateWorldBounds() {
5812
- const layout = this.__layout;
5813
- toOuterOf$2(layout.renderBounds, this.__world, this.__world);
5814
- if (layout.resized) {
5815
- if (layout.resized === "inner") this.__onUpdateSize();
5828
+ const {__layout: __layout, __world: __world} = this;
5829
+ toOuterOf$2(__layout.renderBounds, __world, __world);
5830
+ if (__layout.resized) {
5831
+ if (__layout.resized === "inner") this.__onUpdateSize();
5816
5832
  if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
5817
- layout.resized = undefined;
5833
+ __layout.resized = undefined;
5818
5834
  }
5819
5835
  if (this.__hasWorldEvent) BoundsEvent.emitWorld(this);
5820
5836
  },
@@ -6012,7 +6028,7 @@ const tempScaleData$1 = {};
6012
6028
 
6013
6029
  const {LEAF: LEAF, create: create} = IncrementId;
6014
6030
 
6015
- const {stintSet: stintSet$3} = DataHelper;
6031
+ const {stintSet: stintSet$4} = DataHelper;
6016
6032
 
6017
6033
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
6018
6034
 
@@ -6295,8 +6311,8 @@ let Leaf = class Leaf {
6295
6311
  const cameraWorld = this.__cameraWorld, world = this.__world;
6296
6312
  multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
6297
6313
  toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
6298
- stintSet$3(cameraWorld, "half", world.half);
6299
- stintSet$3(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6314
+ stintSet$4(cameraWorld, "half", world.half);
6315
+ stintSet$4(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6300
6316
  return cameraWorld;
6301
6317
  } else {
6302
6318
  return this.__world;
@@ -6819,7 +6835,7 @@ class LeafLevelList {
6819
6835
  }
6820
6836
  }
6821
6837
 
6822
- const version = "1.9.12";
6838
+ const version = "1.10.1";
6823
6839
 
6824
6840
  const debug$5 = Debug.get("LeaferCanvas");
6825
6841
 
@@ -7800,6 +7816,7 @@ class Picker {
7800
7816
  hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
7801
7817
  if (child.isBranch) {
7802
7818
  if (hit || child.__ignoreHitWorld) {
7819
+ if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point)) continue;
7803
7820
  if (child.topChildren) this.eachFind(child.topChildren, false);
7804
7821
  this.eachFind(child.children, child.__onlyHitMask);
7805
7822
  if (child.isBranchLeaf) this.hitChild(child, point);
@@ -7992,7 +8009,7 @@ const Transition = {
7992
8009
 
7993
8010
  const {parse: parse, objectToCanvasData: objectToCanvasData} = PathConvert;
7994
8011
 
7995
- const {stintSet: stintSet$2} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
8012
+ const {stintSet: stintSet$3} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
7996
8013
 
7997
8014
  const emptyPaint = {};
7998
8015
 
@@ -8059,7 +8076,7 @@ class UIData extends LeafData {
8059
8076
  setFill(value) {
8060
8077
  if (this.__naturalWidth) this.__removeNaturalSize();
8061
8078
  if (isString(value) || !value) {
8062
- stintSet$2(this, "__isTransparentFill", hasTransparent$2(value));
8079
+ stintSet$3(this, "__isTransparentFill", hasTransparent$2(value));
8063
8080
  this.__isFills && this.__removePaint("fill", true);
8064
8081
  this._fill = value;
8065
8082
  } else if (isObject(value)) {
@@ -8068,7 +8085,7 @@ class UIData extends LeafData {
8068
8085
  }
8069
8086
  setStroke(value) {
8070
8087
  if (isString(value) || !value) {
8071
- stintSet$2(this, "__isTransparentStroke", hasTransparent$2(value));
8088
+ stintSet$3(this, "__isTransparentStroke", hasTransparent$2(value));
8072
8089
  this.__isStrokes && this.__removePaint("stroke", true);
8073
8090
  this._stroke = value;
8074
8091
  } else if (isObject(value)) {
@@ -8126,11 +8143,11 @@ class UIData extends LeafData {
8126
8143
  if (removeInput) this.__removeInput(attrName);
8127
8144
  PaintImage.recycleImage(attrName, this);
8128
8145
  if (attrName === "fill") {
8129
- stintSet$2(this, "__isAlphaPixelFill", undefined);
8146
+ stintSet$3(this, "__isAlphaPixelFill", undefined);
8130
8147
  this._fill = this.__isFills = undefined;
8131
8148
  } else {
8132
- stintSet$2(this, "__isAlphaPixelStroke", undefined);
8133
- stintSet$2(this, "__hasMultiStrokeStyle", undefined);
8149
+ stintSet$3(this, "__isAlphaPixelStroke", undefined);
8150
+ stintSet$3(this, "__hasMultiStrokeStyle", undefined);
8134
8151
  this._stroke = this.__isStrokes = undefined;
8135
8152
  }
8136
8153
  }
@@ -8279,7 +8296,7 @@ class CanvasData extends RectData {
8279
8296
  }
8280
8297
  }
8281
8298
 
8282
- const {max: max$3, add: add$1} = FourNumberHelper;
8299
+ const {max: max$2, add: add$1} = FourNumberHelper;
8283
8300
 
8284
8301
  const UIBounds = {
8285
8302
  __updateStrokeSpread() {
@@ -8295,7 +8312,7 @@ const UIBounds = {
8295
8312
  }
8296
8313
  if (data.__useArrow) spread += strokeWidth * 5;
8297
8314
  if (box) {
8298
- spread = max$3(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
8315
+ spread = max$2(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
8299
8316
  boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
8300
8317
  }
8301
8318
  this.__layout.strokeBoxSpread = boxSpread;
@@ -8305,35 +8322,35 @@ const UIBounds = {
8305
8322
  let spread = 0;
8306
8323
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
8307
8324
  if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
8308
- if (blur) spread = max$3(spread, blur);
8325
+ if (blur) spread = max$2(spread, blur);
8309
8326
  if (filter) spread = add$1(spread, Filter.getSpread(filter));
8310
8327
  if (renderSpread) spread = add$1(spread, renderSpread);
8311
8328
  if (strokeSpread) spread = add$1(spread, strokeSpread);
8312
8329
  let shapeSpread = spread;
8313
- if (innerShadow) shapeSpread = max$3(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
8314
- if (backgroundBlur) shapeSpread = max$3(shapeSpread, backgroundBlur);
8330
+ if (innerShadow) shapeSpread = max$2(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
8331
+ if (backgroundBlur) shapeSpread = max$2(shapeSpread, backgroundBlur);
8315
8332
  this.__layout.renderShapeSpread = shapeSpread;
8316
- return box ? max$3(box.__updateRenderSpread(), spread) : spread;
8333
+ return box ? max$2(box.__updateRenderSpread(), spread) : spread;
8317
8334
  }
8318
8335
  };
8319
8336
 
8320
- const {stintSet: stintSet$1} = DataHelper;
8337
+ const {stintSet: stintSet$2} = DataHelper;
8321
8338
 
8322
8339
  const UIRender = {
8323
8340
  __updateChange() {
8324
8341
  const data = this.__;
8325
8342
  if (data.__useStroke) {
8326
8343
  const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
8327
- stintSet$1(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
8328
- stintSet$1(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
8344
+ stintSet$2(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
8345
+ stintSet$2(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
8329
8346
  }
8330
8347
  if (data.__useEffect) {
8331
8348
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8332
- stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
8349
+ stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
8333
8350
  data.__useEffect = !!(shadow || otherEffect);
8334
8351
  }
8335
8352
  data.__checkSingle();
8336
- stintSet$1(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
8353
+ stintSet$2(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
8337
8354
  },
8338
8355
  __drawFast(canvas, options) {
8339
8356
  drawFast(this, canvas, options);
@@ -8349,24 +8366,24 @@ const UIRender = {
8349
8366
  this.__nowWorld = this.__getNowWorld(options);
8350
8367
  const {shadow: shadow, innerShadow: innerShadow, filter: filter} = data;
8351
8368
  if (shadow) Effect.shadow(this, canvas, shape);
8352
- if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
8353
- if (fill) data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
8369
+ if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
8370
+ if (fill) data.__isFills ? Paint.fills(fill, this, canvas, options) : Paint.fill(fill, this, canvas, options);
8354
8371
  if (__drawAfterFill) this.__drawAfterFill(canvas, options);
8355
8372
  if (innerShadow) Effect.innerShadow(this, canvas, shape);
8356
- if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
8373
+ if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
8357
8374
  if (filter) Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
8358
8375
  if (shape.worldCanvas) shape.worldCanvas.recycle();
8359
8376
  shape.canvas.recycle();
8360
8377
  } else {
8361
- if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
8378
+ if (__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
8362
8379
  if (__isFastShadow) {
8363
8380
  const shadow = data.shadow[0], {scaleX: scaleX, scaleY: scaleY} = this.getRenderScaleData(true, shadow.scaleFixed);
8364
8381
  canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
8365
8382
  }
8366
- if (fill) data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
8383
+ if (fill) data.__isFills ? Paint.fills(fill, this, canvas, options) : Paint.fill(fill, this, canvas, options);
8367
8384
  if (__isFastShadow) canvas.restore();
8368
8385
  if (__drawAfterFill) this.__drawAfterFill(canvas, options);
8369
- if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
8386
+ if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
8370
8387
  }
8371
8388
  } else {
8372
8389
  if (data.__pathInputed) drawFast(this, canvas, options); else this.__drawFast(canvas, options);
@@ -8375,9 +8392,9 @@ const UIRender = {
8375
8392
  __drawShape(canvas, options) {
8376
8393
  this.__drawRenderPath(canvas);
8377
8394
  const data = this.__, {fill: fill, stroke: stroke} = data;
8378
- if (fill && !options.ignoreFill) data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill("#000000", this, canvas);
8395
+ if (fill && !options.ignoreFill) data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas, options) : Paint.fill("#000000", this, canvas, options);
8379
8396
  if (data.__isCanvas) this.__drawAfterFill(canvas, options);
8380
- if (stroke && !options.ignoreStroke) data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke("#000000", this, canvas);
8397
+ if (stroke && !options.ignoreStroke) data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke("#000000", this, canvas, options);
8381
8398
  },
8382
8399
  __drawAfterFill(canvas, options) {
8383
8400
  if (this.__.__clipAfterFill) {
@@ -8392,10 +8409,10 @@ const UIRender = {
8392
8409
  function drawFast(ui, canvas, options) {
8393
8410
  const {fill: fill, stroke: stroke, __drawAfterFill: __drawAfterFill, __fillAfterStroke: __fillAfterStroke} = ui.__;
8394
8411
  ui.__drawRenderPath(canvas);
8395
- if (__fillAfterStroke) Paint.stroke(stroke, ui, canvas);
8396
- if (fill) Paint.fill(fill, ui, canvas);
8412
+ if (__fillAfterStroke) Paint.stroke(stroke, ui, canvas, options);
8413
+ if (fill) Paint.fill(fill, ui, canvas, options);
8397
8414
  if (__drawAfterFill) ui.__drawAfterFill(canvas, options);
8398
- if (stroke && !__fillAfterStroke) Paint.stroke(stroke, ui, canvas);
8415
+ if (stroke && !__fillAfterStroke) Paint.stroke(stroke, ui, canvas, options);
8399
8416
  }
8400
8417
 
8401
8418
  const RectRender = {
@@ -8533,8 +8550,8 @@ let UI = UI_1 = class UI extends Leaf {
8533
8550
  drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
8534
8551
  } else drawer.rect(x, y, width, height);
8535
8552
  }
8536
- drawImagePlaceholder(canvas, _image) {
8537
- Paint.fill(this.__.placeholderColor, this, canvas);
8553
+ drawImagePlaceholder(_paint, canvas, renderOptions) {
8554
+ Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
8538
8555
  }
8539
8556
  animate(keyframe, _options, _type, _isTemp) {
8540
8557
  this.set(keyframe);
@@ -9556,7 +9573,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
9556
9573
 
9557
9574
  Canvas = __decorate([ registerUI() ], Canvas);
9558
9575
 
9559
- const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
9576
+ const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$1} = DataHelper;
9560
9577
 
9561
9578
  let Text = class Text extends UI {
9562
9579
  get __tag() {
@@ -9568,13 +9585,14 @@ let Text = class Text extends UI {
9568
9585
  }
9569
9586
  __updateTextDrawData() {
9570
9587
  const data = this.__;
9571
- const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
9588
+ const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding, width: width, height: height} = data;
9572
9589
  data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
9573
9590
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
9574
- data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
9575
9591
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
9576
9592
  data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
9577
- data.__clipText = textOverflow !== "show" && !data.__autoSize;
9593
+ stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
9594
+ stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
9595
+ stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
9578
9596
  data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
9579
9597
  }
9580
9598
  __updateBoxBounds() {
@@ -9982,7 +10000,7 @@ class UIEvent extends Event {
9982
10000
  }
9983
10001
  }
9984
10002
 
9985
- const {min: min, max: max$2, abs: abs$2} = Math, {float: float, sign: sign} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
10003
+ const {min: min, max: max$1, abs: abs$2} = Math, {float: float, sign: sign} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
9986
10004
 
9987
10005
  const tempContent = new Bounds, tempDragBounds = new Bounds;
9988
10006
 
@@ -10039,7 +10057,7 @@ const DragBoundsHelper = {
10039
10057
  bSize = float(tempDragBounds.maxX - tempContent.maxX);
10040
10058
  aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
10041
10059
  bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
10042
- correctScaleX *= max$2(aScale, bScale);
10060
+ correctScaleX *= max$1(aScale, bScale);
10043
10061
  } else {
10044
10062
  if (scale.x < 0) {
10045
10063
  if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
@@ -10057,9 +10075,9 @@ const DragBoundsHelper = {
10057
10075
  bSize = float(tempDragBounds.maxY - tempContent.maxY);
10058
10076
  aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
10059
10077
  bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
10060
- correctScaleY *= max$2(aScale, bScale);
10078
+ correctScaleY *= max$1(aScale, bScale);
10061
10079
  if (lockRatio) {
10062
- aScale = max$2(abs$2(correctScaleX), abs$2(correctScaleY));
10080
+ aScale = max$1(abs$2(correctScaleX), abs$2(correctScaleY));
10063
10081
  correctScaleX = sign(correctScaleX) * aScale;
10064
10082
  correctScaleY = sign(correctScaleY) * aScale;
10065
10083
  }
@@ -10225,6 +10243,12 @@ MoveEvent.END = "move.end";
10225
10243
 
10226
10244
  MoveEvent = __decorate([ registerUIEvent() ], MoveEvent);
10227
10245
 
10246
+ let TouchEvent = class TouchEvent extends UIEvent {};
10247
+
10248
+ TouchEvent = __decorate([ registerUIEvent() ], TouchEvent);
10249
+
10250
+ const MyTouchEvent = TouchEvent;
10251
+
10228
10252
  let RotateEvent = class RotateEvent extends PointerEvent$1 {};
10229
10253
 
10230
10254
  RotateEvent.BEFORE_ROTATE = "rotate.before_rotate";
@@ -11601,102 +11625,163 @@ class Interaction extends InteractionBase {
11601
11625
  }
11602
11626
  }
11603
11627
 
11604
- function fillText(ui, canvas) {
11605
- const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
11606
- if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
11607
- let row;
11608
- for (let i = 0, len = rows.length; i < len; i++) {
11609
- row = rows[i];
11610
- if (row.text) canvas.fillText(row.text, row.x, row.y); else if (row.data) row.data.forEach(charData => {
11611
- canvas.fillText(charData.char, charData.x, row.y);
11612
- });
11613
- }
11614
- if (decorationY) {
11615
- const {decorationColor: decorationColor, decorationHeight: decorationHeight} = data.__textDrawData;
11616
- if (decorationColor) canvas.fillStyle = decorationColor;
11617
- rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
11618
- }
11619
- }
11620
-
11621
- function fill(fill, ui, canvas) {
11628
+ function fill(fill, ui, canvas, renderOptions) {
11622
11629
  canvas.fillStyle = fill;
11623
- fillPathOrText(ui, canvas);
11630
+ fillPathOrText(ui, canvas, renderOptions);
11624
11631
  }
11625
11632
 
11626
- function fills(fills, ui, canvas) {
11627
- let item;
11633
+ function fills(fills, ui, canvas, renderOptions) {
11634
+ let item, originPaint, countImage;
11628
11635
  for (let i = 0, len = fills.length; i < len; i++) {
11629
- item = fills[i];
11636
+ item = fills[i], originPaint = item.originPaint;
11630
11637
  if (item.image) {
11631
- if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font)) continue;
11638
+ countImage ? countImage++ : countImage = 1;
11639
+ if (PaintImage.checkImage(item, !ui.__.__font, ui, canvas, renderOptions)) continue;
11632
11640
  if (!item.style) {
11633
- if (!i && item.image.isPlacehold) ui.drawImagePlaceholder(canvas, item.image);
11641
+ if (countImage === 1 && item.image.isPlacehold) ui.drawImagePlaceholder(item, canvas, renderOptions);
11634
11642
  continue;
11635
11643
  }
11636
11644
  }
11637
11645
  canvas.fillStyle = item.style;
11638
- if (item.transform || item.scaleFixed) {
11646
+ if (item.transform || originPaint.scaleFixed) {
11639
11647
  canvas.save();
11640
11648
  if (item.transform) canvas.transform(item.transform);
11641
- if (item.scaleFixed) {
11649
+ if (originPaint.scaleFixed) {
11642
11650
  const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
11643
- if (item.scaleFixed === true || item.scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) canvas.scale(1 / scaleX, 1 / scaleY);
11651
+ if (originPaint.scaleFixed === true || originPaint.scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) canvas.scale(1 / scaleX, 1 / scaleY);
11644
11652
  }
11645
- if (item.blendMode) canvas.blendMode = item.blendMode;
11646
- fillPathOrText(ui, canvas);
11653
+ if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
11654
+ fillPathOrText(ui, canvas, renderOptions);
11647
11655
  canvas.restore();
11648
11656
  } else {
11649
- if (item.blendMode) {
11650
- canvas.saveBlendMode(item.blendMode);
11651
- fillPathOrText(ui, canvas);
11657
+ if (originPaint.blendMode) {
11658
+ canvas.saveBlendMode(originPaint.blendMode);
11659
+ fillPathOrText(ui, canvas, renderOptions);
11652
11660
  canvas.restoreBlendMode();
11653
- } else fillPathOrText(ui, canvas);
11661
+ } else fillPathOrText(ui, canvas, renderOptions);
11662
+ }
11663
+ }
11664
+ }
11665
+
11666
+ function fillPathOrText(ui, canvas, renderOptions) {
11667
+ ui.__.__font ? Paint.fillText(ui, canvas, renderOptions) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
11668
+ }
11669
+
11670
+ function fillText(ui, canvas, _renderOptions) {
11671
+ const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
11672
+ if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
11673
+ let row;
11674
+ for (let i = 0, len = rows.length; i < len; i++) {
11675
+ row = rows[i];
11676
+ if (row.text) canvas.fillText(row.text, row.x, row.y); else if (row.data) row.data.forEach(charData => {
11677
+ canvas.fillText(charData.char, charData.x, row.y);
11678
+ });
11679
+ }
11680
+ if (decorationY) {
11681
+ const {decorationColor: decorationColor, decorationHeight: decorationHeight} = data.__textDrawData;
11682
+ if (decorationColor) canvas.fillStyle = decorationColor;
11683
+ rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
11684
+ }
11685
+ }
11686
+
11687
+ function stroke(stroke, ui, canvas, renderOptions) {
11688
+ const data = ui.__;
11689
+ if (!data.__strokeWidth) return;
11690
+ if (data.__font) {
11691
+ Paint.strokeText(stroke, ui, canvas, renderOptions);
11692
+ } else {
11693
+ switch (data.strokeAlign) {
11694
+ case "center":
11695
+ drawCenter$1(stroke, 1, ui, canvas, renderOptions);
11696
+ break;
11697
+
11698
+ case "inside":
11699
+ drawInside(stroke, ui, canvas, renderOptions);
11700
+ break;
11701
+
11702
+ case "outside":
11703
+ drawOutside(stroke, ui, canvas, renderOptions);
11704
+ break;
11654
11705
  }
11655
11706
  }
11656
11707
  }
11657
11708
 
11658
- function fillPathOrText(ui, canvas) {
11659
- ui.__.__font ? fillText(ui, canvas) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
11709
+ function strokes(strokes, ui, canvas, renderOptions) {
11710
+ Paint.stroke(strokes, ui, canvas, renderOptions);
11711
+ }
11712
+
11713
+ function drawCenter$1(stroke, strokeWidthScale, ui, canvas, renderOptions) {
11714
+ const data = ui.__;
11715
+ if (isObject(stroke)) {
11716
+ Paint.drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas, renderOptions);
11717
+ } else {
11718
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
11719
+ canvas.stroke();
11720
+ }
11721
+ if (data.__useArrow) Paint.strokeArrow(stroke, ui, canvas, renderOptions);
11722
+ }
11723
+
11724
+ function drawInside(stroke, ui, canvas, renderOptions) {
11725
+ canvas.save();
11726
+ canvas.clipUI(ui);
11727
+ drawCenter$1(stroke, 2, ui, canvas, renderOptions);
11728
+ canvas.restore();
11729
+ }
11730
+
11731
+ function drawOutside(stroke, ui, canvas, renderOptions) {
11732
+ const data = ui.__;
11733
+ if (data.__fillAfterStroke) {
11734
+ drawCenter$1(stroke, 2, ui, canvas, renderOptions);
11735
+ } else {
11736
+ const {renderBounds: renderBounds} = ui.__layout;
11737
+ const out = canvas.getSameCanvas(true, true);
11738
+ ui.__drawRenderPath(out);
11739
+ drawCenter$1(stroke, 2, ui, out, renderOptions);
11740
+ out.clipUI(data);
11741
+ out.clearWorld(renderBounds);
11742
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
11743
+ out.recycle(ui.__nowWorld);
11744
+ }
11660
11745
  }
11661
11746
 
11662
- function strokeText(stroke, ui, canvas) {
11747
+ function strokeText(stroke, ui, canvas, renderOptions) {
11663
11748
  switch (ui.__.strokeAlign) {
11664
11749
  case "center":
11665
- drawCenter$1(stroke, 1, ui, canvas);
11750
+ drawCenter(stroke, 1, ui, canvas, renderOptions);
11666
11751
  break;
11667
11752
 
11668
11753
  case "inside":
11669
- drawAlign(stroke, "inside", ui, canvas);
11754
+ drawAlign(stroke, "inside", ui, canvas, renderOptions);
11670
11755
  break;
11671
11756
 
11672
11757
  case "outside":
11673
- ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, "outside", ui, canvas);
11758
+ ui.__.__fillAfterStroke ? drawCenter(stroke, 2, ui, canvas, renderOptions) : drawAlign(stroke, "outside", ui, canvas, renderOptions);
11674
11759
  break;
11675
11760
  }
11676
11761
  }
11677
11762
 
11678
- function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
11763
+ function drawCenter(stroke, strokeWidthScale, ui, canvas, renderOptions) {
11679
11764
  const data = ui.__;
11680
11765
  if (isObject(stroke)) {
11681
- drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
11766
+ Paint.drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas, renderOptions);
11682
11767
  } else {
11683
11768
  canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
11684
- drawTextStroke(ui, canvas);
11769
+ Paint.drawTextStroke(ui, canvas, renderOptions);
11685
11770
  }
11686
11771
  }
11687
11772
 
11688
- function drawAlign(stroke, align, ui, canvas) {
11773
+ function drawAlign(stroke, align, ui, canvas, renderOptions) {
11689
11774
  const out = canvas.getSameCanvas(true, true);
11690
11775
  out.font = ui.__.__font;
11691
- drawCenter$1(stroke, 2, ui, out);
11776
+ drawCenter(stroke, 2, ui, out, renderOptions);
11692
11777
  out.blendMode = align === "outside" ? "destination-out" : "destination-in";
11693
- fillText(ui, out);
11778
+ Paint.fillText(ui, out, renderOptions);
11694
11779
  out.blendMode = "normal";
11695
11780
  LeafHelper.copyCanvasByWorld(ui, canvas, out);
11696
11781
  out.recycle(ui.__nowWorld);
11697
11782
  }
11698
11783
 
11699
- function drawTextStroke(ui, canvas) {
11784
+ function drawTextStroke(ui, canvas, _renderOptions) {
11700
11785
  let row, data = ui.__.__textDrawData;
11701
11786
  const {rows: rows, decorationY: decorationY} = data;
11702
11787
  for (let i = 0, len = rows.length; i < len; i++) {
@@ -11711,89 +11796,29 @@ function drawTextStroke(ui, canvas) {
11711
11796
  }
11712
11797
  }
11713
11798
 
11714
- function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
11799
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas, renderOptions) {
11715
11800
  let item;
11716
11801
  const data = ui.__, {__hasMultiStrokeStyle: __hasMultiStrokeStyle} = data;
11717
11802
  __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
11718
11803
  for (let i = 0, len = strokes.length; i < len; i++) {
11719
11804
  item = strokes[i];
11720
- if (item.image && PaintImage.checkImage(ui, canvas, item, false)) continue;
11805
+ if (item.image && PaintImage.checkImage(item, false, ui, canvas, renderOptions)) continue;
11721
11806
  if (item.style) {
11722
11807
  if (__hasMultiStrokeStyle) {
11723
11808
  const {strokeStyle: strokeStyle} = item;
11724
11809
  strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
11725
11810
  } else canvas.strokeStyle = item.style;
11726
- if (item.blendMode) {
11727
- canvas.saveBlendMode(item.blendMode);
11728
- isText ? drawTextStroke(ui, canvas) : canvas.stroke();
11811
+ if (item.originPaint.blendMode) {
11812
+ canvas.saveBlendMode(item.originPaint.blendMode);
11813
+ isText ? Paint.drawTextStroke(ui, canvas, renderOptions) : canvas.stroke();
11729
11814
  canvas.restoreBlendMode();
11730
11815
  } else {
11731
- isText ? drawTextStroke(ui, canvas) : canvas.stroke();
11816
+ isText ? Paint.drawTextStroke(ui, canvas, renderOptions) : canvas.stroke();
11732
11817
  }
11733
11818
  }
11734
11819
  }
11735
11820
  }
11736
11821
 
11737
- function stroke(stroke, ui, canvas) {
11738
- const data = ui.__;
11739
- if (!data.__strokeWidth) return;
11740
- if (data.__font) {
11741
- strokeText(stroke, ui, canvas);
11742
- } else {
11743
- switch (data.strokeAlign) {
11744
- case "center":
11745
- drawCenter(stroke, 1, ui, canvas);
11746
- break;
11747
-
11748
- case "inside":
11749
- drawInside(stroke, ui, canvas);
11750
- break;
11751
-
11752
- case "outside":
11753
- drawOutside(stroke, ui, canvas);
11754
- break;
11755
- }
11756
- }
11757
- }
11758
-
11759
- function strokes(strokes, ui, canvas) {
11760
- stroke(strokes, ui, canvas);
11761
- }
11762
-
11763
- function drawCenter(stroke, strokeWidthScale, ui, canvas) {
11764
- const data = ui.__;
11765
- if (isObject(stroke)) {
11766
- drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
11767
- } else {
11768
- canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
11769
- canvas.stroke();
11770
- }
11771
- if (data.__useArrow) Paint.strokeArrow(stroke, ui, canvas);
11772
- }
11773
-
11774
- function drawInside(stroke, ui, canvas) {
11775
- canvas.save();
11776
- canvas.clipUI(ui);
11777
- drawCenter(stroke, 2, ui, canvas);
11778
- canvas.restore();
11779
- }
11780
-
11781
- function drawOutside(stroke, ui, canvas) {
11782
- const data = ui.__;
11783
- if (data.__fillAfterStroke) {
11784
- drawCenter(stroke, 2, ui, canvas);
11785
- } else {
11786
- const {renderBounds: renderBounds} = ui.__layout;
11787
- const out = canvas.getSameCanvas(true, true);
11788
- ui.__drawRenderPath(out);
11789
- drawCenter(stroke, 2, ui, out);
11790
- out.clipUI(data);
11791
- out.clearWorld(renderBounds);
11792
- LeafHelper.copyCanvasByWorld(ui, canvas, out);
11793
- out.recycle(ui.__nowWorld);
11794
- }
11795
- }
11796
-
11797
11822
  const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = BoundsHelper;
11798
11823
 
11799
11824
  const tempBounds$1 = {};
@@ -11881,62 +11906,63 @@ function compute(attrName, ui) {
11881
11906
  if (leafPaints.some(item => item.image)) isAlphaPixel = true;
11882
11907
  isTransparent = true;
11883
11908
  }
11884
- }
11885
- if (attrName === "fill") {
11886
- stintSet(data, "__isAlphaPixelFill", isAlphaPixel);
11887
- stintSet(data, "__isTransparentFill", isTransparent);
11909
+ if (attrName === "fill") {
11910
+ stintSet(data, "__isAlphaPixelFill", isAlphaPixel);
11911
+ stintSet(data, "__isTransparentFill", isTransparent);
11912
+ } else {
11913
+ stintSet(data, "__isAlphaPixelStroke", isAlphaPixel);
11914
+ stintSet(data, "__isTransparentStroke", isTransparent);
11915
+ stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
11916
+ }
11888
11917
  } else {
11889
- stintSet(data, "__isAlphaPixelStroke", isAlphaPixel);
11890
- stintSet(data, "__isTransparentStroke", isTransparent);
11891
- stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
11918
+ data.__removePaint(attrName, false);
11892
11919
  }
11893
11920
  }
11894
11921
 
11895
11922
  function getLeafPaint(attrName, paint, ui) {
11896
11923
  if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
11897
- let data;
11924
+ let leafPaint;
11898
11925
  const {boxBounds: boxBounds} = ui.__layout;
11899
11926
  switch (paint.type) {
11900
11927
  case "image":
11901
- data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
11928
+ leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
11902
11929
  break;
11903
11930
 
11904
11931
  case "linear":
11905
- data = PaintGradient.linearGradient(paint, boxBounds);
11932
+ leafPaint = PaintGradient.linearGradient(paint, boxBounds);
11906
11933
  break;
11907
11934
 
11908
11935
  case "radial":
11909
- data = PaintGradient.radialGradient(paint, boxBounds);
11936
+ leafPaint = PaintGradient.radialGradient(paint, boxBounds);
11910
11937
  break;
11911
11938
 
11912
11939
  case "angular":
11913
- data = PaintGradient.conicGradient(paint, boxBounds);
11940
+ leafPaint = PaintGradient.conicGradient(paint, boxBounds);
11914
11941
  break;
11915
11942
 
11916
11943
  case "solid":
11917
11944
  const {type: type, color: color, opacity: opacity} = paint;
11918
- data = {
11945
+ leafPaint = {
11919
11946
  type: type,
11920
11947
  style: ColorConvert.string(color, opacity)
11921
11948
  };
11922
11949
  break;
11923
11950
 
11924
11951
  default:
11925
- if (!isUndefined(paint.r)) data = {
11952
+ if (!isUndefined(paint.r)) leafPaint = {
11926
11953
  type: "solid",
11927
11954
  style: ColorConvert.string(paint)
11928
11955
  };
11929
11956
  }
11930
- if (data) {
11931
- if (isString(data.style) && hasTransparent$1(data.style)) data.isTransparent = true;
11957
+ if (leafPaint) {
11958
+ leafPaint.originPaint = paint;
11959
+ if (isString(leafPaint.style) && hasTransparent$1(leafPaint.style)) leafPaint.isTransparent = true;
11932
11960
  if (paint.style) {
11933
11961
  if (paint.style.strokeWidth === 0) return undefined;
11934
- data.strokeStyle = paint.style;
11962
+ leafPaint.strokeStyle = paint.style;
11935
11963
  }
11936
- if (paint.editing) data.editing = paint.editing;
11937
- if (paint.blendMode) data.blendMode = paint.blendMode;
11938
11964
  }
11939
- return data;
11965
+ return leafPaint;
11940
11966
  }
11941
11967
 
11942
11968
  const PaintModule = {
@@ -11949,88 +11975,118 @@ const PaintModule = {
11949
11975
  strokes: strokes,
11950
11976
  strokeText: strokeText,
11951
11977
  drawTextStroke: drawTextStroke,
11978
+ drawStrokesStyle: drawStrokesStyle,
11952
11979
  shape: shape
11953
11980
  };
11954
11981
 
11955
- let origin = {}, tempMatrix$1 = getMatrixData();
11956
-
11957
- const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
11958
-
11959
- function stretchMode(data, box, scaleX, scaleY) {
11960
- const transform = get$3();
11961
- translate$1(transform, box.x, box.y);
11962
- if (scaleX) scaleHelper(transform, scaleX, scaleY);
11963
- data.transform = transform;
11964
- }
11982
+ let cache, box = new Bounds;
11965
11983
 
11966
- function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
11967
- const transform = get$3();
11968
- translate$1(transform, box.x + x, box.y + y);
11969
- scaleHelper(transform, scaleX, scaleY);
11970
- if (rotation) rotateOfOuter$1(transform, {
11971
- x: box.x + box.width / 2,
11972
- y: box.y + box.height / 2
11973
- }, rotation);
11974
- data.transform = transform;
11975
- }
11984
+ const {isSame: isSame} = BoundsHelper;
11976
11985
 
11977
- function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
11978
- const transform = get$3();
11979
- layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
11980
- if (clipScaleX) {
11981
- if (rotation || skew) {
11982
- set(tempMatrix$1);
11983
- scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
11984
- multiplyParent(transform, tempMatrix$1);
11985
- } else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
11986
+ function image(ui, attrName, paint, boxBounds, firstUse) {
11987
+ let leafPaint, event;
11988
+ const image = ImageManager.get(paint);
11989
+ if (cache && paint === cache.paint && isSame(boxBounds, cache.boxBounds)) {
11990
+ leafPaint = cache.leafPaint;
11991
+ } else {
11992
+ leafPaint = {
11993
+ type: paint.type,
11994
+ image: image
11995
+ };
11996
+ if (image.hasAlphaPixel) leafPaint.isTransparent = true;
11997
+ cache = image.use > 1 ? {
11998
+ leafPaint: leafPaint,
11999
+ paint: paint,
12000
+ boxBounds: box.set(boxBounds)
12001
+ } : null;
11986
12002
  }
11987
- data.transform = transform;
11988
- }
11989
-
11990
- function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, skew, align, freeTransform) {
11991
- const transform = get$3();
11992
- if (freeTransform) {
11993
- layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
12003
+ if (firstUse || image.loading) event = {
12004
+ image: image,
12005
+ attrName: attrName,
12006
+ attrValue: paint
12007
+ };
12008
+ if (image.ready) {
12009
+ checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds);
12010
+ if (firstUse) {
12011
+ onLoad(ui, event);
12012
+ onLoadSuccess(ui, event);
12013
+ }
12014
+ } else if (image.error) {
12015
+ if (firstUse) onLoadError(ui, event, image.error);
11994
12016
  } else {
11995
- if (rotation) {
11996
- if (align === "center") {
11997
- rotateOfOuter$1(transform, {
11998
- x: width / 2,
11999
- y: height / 2
12000
- }, rotation);
12001
- } else {
12002
- rotate(transform, rotation);
12003
- switch (rotation) {
12004
- case 90:
12005
- translate$1(transform, height, 0);
12006
- break;
12007
-
12008
- case 180:
12009
- translate$1(transform, width, height);
12010
- break;
12011
-
12012
- case 270:
12013
- translate$1(transform, 0, width);
12014
- break;
12017
+ if (firstUse) {
12018
+ ignoreRender(ui, true);
12019
+ onLoad(ui, event);
12020
+ }
12021
+ leafPaint.loadId = image.load(() => {
12022
+ ignoreRender(ui, false);
12023
+ if (!ui.destroyed) {
12024
+ if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
12025
+ if (image.hasAlphaPixel) ui.__layout.hitCanvasChanged = true;
12026
+ ui.forceUpdate("surface");
12015
12027
  }
12028
+ onLoadSuccess(ui, event);
12016
12029
  }
12030
+ leafPaint.loadId = undefined;
12031
+ }, error => {
12032
+ ignoreRender(ui, false);
12033
+ onLoadError(ui, event, error);
12034
+ leafPaint.loadId = undefined;
12035
+ });
12036
+ if (ui.placeholderColor) {
12037
+ if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
12038
+ if (!image.ready) {
12039
+ image.isPlacehold = true;
12040
+ ui.forceUpdate("surface");
12041
+ }
12042
+ }, ui.placeholderDelay);
12017
12043
  }
12018
- origin.x = box.x + x;
12019
- origin.y = box.y + y;
12020
- translate$1(transform, origin.x, origin.y);
12021
- if (scaleX) scaleOfOuter$1(transform, origin, scaleX, scaleY);
12022
12044
  }
12023
- data.transform = transform;
12045
+ return leafPaint;
12024
12046
  }
12025
12047
 
12026
- function layout(transform, box, x, y, scaleX, scaleY, rotation, skew) {
12027
- if (rotation) rotate(transform, rotation);
12028
- if (skew) skewHelper(transform, skew.x, skew.y);
12029
- if (scaleX) scaleHelper(transform, scaleX, scaleY);
12030
- translate$1(transform, box.x + x, box.y + y);
12048
+ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
12049
+ if (attrName === "fill" && !ui.__.__naturalWidth) {
12050
+ const data = ui.__;
12051
+ data.__naturalWidth = image.width / data.pixelRatio;
12052
+ data.__naturalHeight = image.height / data.pixelRatio;
12053
+ if (data.__autoSide) {
12054
+ ui.forceUpdate("width");
12055
+ if (ui.__proxyData) {
12056
+ ui.setProxyAttr("width", data.width);
12057
+ ui.setProxyAttr("height", data.height);
12058
+ }
12059
+ return false;
12060
+ }
12061
+ }
12062
+ if (!leafPaint.data) PaintImage.createData(leafPaint, image, paint, boxBounds);
12063
+ return true;
12064
+ }
12065
+
12066
+ function onLoad(ui, event) {
12067
+ emit(ui, ImageEvent.LOAD, event);
12068
+ }
12069
+
12070
+ function onLoadSuccess(ui, event) {
12071
+ emit(ui, ImageEvent.LOADED, event);
12072
+ }
12073
+
12074
+ function onLoadError(ui, event, error) {
12075
+ event.error = error;
12076
+ ui.forceUpdate("surface");
12077
+ emit(ui, ImageEvent.ERROR, event);
12031
12078
  }
12032
12079
 
12033
- const {get: get$2, translate: translate} = MatrixHelper;
12080
+ function emit(ui, type, data) {
12081
+ if (ui.hasEvent(type)) ui.emitEvent(new ImageEvent(type, data));
12082
+ }
12083
+
12084
+ function ignoreRender(ui, value) {
12085
+ const {leafer: leafer} = ui;
12086
+ if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
12087
+ }
12088
+
12089
+ const {get: get$3, translate: translate$1} = MatrixHelper;
12034
12090
 
12035
12091
  const tempBox = new Bounds;
12036
12092
 
@@ -12039,17 +12095,13 @@ const tempScaleData = {};
12039
12095
  const tempImage = {};
12040
12096
 
12041
12097
  function createData(leafPaint, image, paint, box) {
12042
- const {changeful: changeful, sync: sync, scaleFixed: scaleFixed} = paint;
12043
- if (changeful) leafPaint.changeful = changeful;
12044
- if (sync) leafPaint.sync = sync;
12045
- if (scaleFixed) leafPaint.scaleFixed = scaleFixed;
12046
- leafPaint.data = getPatternData(paint, box, image);
12098
+ leafPaint.data = PaintImage.getPatternData(paint, box, image);
12047
12099
  }
12048
12100
 
12049
12101
  function getPatternData(paint, box, image) {
12050
12102
  if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
12051
12103
  if (paint.mode === "strench") paint.mode = "stretch";
12052
- let {width: width, height: height} = image;
12104
+ const {width: width, height: height} = image;
12053
12105
  const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters} = paint;
12054
12106
  const sameBox = box.width === width && box.height === height;
12055
12107
  const data = {
@@ -12080,8 +12132,8 @@ function getPatternData(paint, box, image) {
12080
12132
  case "stretch":
12081
12133
  if (!sameBox) {
12082
12134
  scaleX = box.width / width, scaleY = box.height / height;
12083
- stretchMode(data, box, scaleX, scaleY);
12084
- }
12135
+ PaintImage.stretchMode(data, box, scaleX, scaleY);
12136
+ } else if (scaleX) scaleX = scaleY = undefined;
12085
12137
  break;
12086
12138
 
12087
12139
  case "normal":
@@ -12089,13 +12141,13 @@ function getPatternData(paint, box, image) {
12089
12141
  if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
12090
12142
  let clipScaleX, clipScaleY;
12091
12143
  if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
12092
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
12144
+ PaintImage.clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
12093
12145
  if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
12094
12146
  }
12095
12147
  break;
12096
12148
 
12097
12149
  case "repeat":
12098
- if (!sameBox || scaleX || rotation || skew) repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
12150
+ if (!sameBox || scaleX || rotation || skew) PaintImage.repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
12099
12151
  if (!repeat) data.repeat = "repeat";
12100
12152
  const count = isObject(repeat);
12101
12153
  if (gap || count) data.gap = getGapData(gap, count && repeat, tempImage.width, tempImage.height, box);
@@ -12104,18 +12156,16 @@ function getPatternData(paint, box, image) {
12104
12156
  case "fit":
12105
12157
  case "cover":
12106
12158
  default:
12107
- if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
12159
+ if (scaleX) PaintImage.fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
12108
12160
  }
12109
12161
  if (!data.transform) {
12110
- if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
12162
+ if (box.x || box.y) translate$1(data.transform = get$3(), box.x, box.y);
12111
12163
  }
12112
- data.width = width;
12113
- data.height = height;
12114
12164
  if (scaleX) {
12115
12165
  data.scaleX = scaleX;
12116
12166
  data.scaleY = scaleY;
12117
12167
  }
12118
- if (opacity) data.opacity = opacity;
12168
+ if (opacity && opacity < 1) data.opacity = opacity;
12119
12169
  if (filters) data.filters = filters;
12120
12170
  if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
12121
12171
  return data;
@@ -12137,234 +12187,194 @@ function getGapValue(gap, size, totalSize, rows) {
12137
12187
  return gap === "auto" ? value < 0 ? 0 : value : value;
12138
12188
  }
12139
12189
 
12140
- let cache, box = new Bounds;
12190
+ let origin = {}, tempMatrix$1 = getMatrixData();
12141
12191
 
12142
- const {isSame: isSame} = BoundsHelper;
12192
+ const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
12143
12193
 
12144
- function image(ui, attrName, paint, boxBounds, firstUse) {
12145
- let leafPaint, event;
12146
- const image = ImageManager.get(paint);
12147
- if (cache && paint === cache.paint && isSame(boxBounds, cache.boxBounds)) {
12148
- leafPaint = cache.leafPaint;
12149
- } else {
12150
- leafPaint = {
12151
- type: paint.type,
12152
- image: image
12153
- };
12154
- if (image.hasAlphaPixel) leafPaint.isTransparent = true;
12155
- cache = image.use > 1 ? {
12156
- leafPaint: leafPaint,
12157
- paint: paint,
12158
- boxBounds: box.set(boxBounds)
12159
- } : null;
12160
- }
12161
- if (firstUse || image.loading) event = {
12162
- image: image,
12163
- attrName: attrName,
12164
- attrValue: paint
12165
- };
12166
- if (image.ready) {
12167
- checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds);
12168
- if (firstUse) {
12169
- onLoad(ui, event);
12170
- onLoadSuccess(ui, event);
12171
- }
12172
- } else if (image.error) {
12173
- if (firstUse) onLoadError(ui, event, image.error);
12174
- } else {
12175
- if (firstUse) {
12176
- ignoreRender(ui, true);
12177
- onLoad(ui, event);
12178
- }
12179
- leafPaint.loadId = image.load(() => {
12180
- ignoreRender(ui, false);
12181
- if (!ui.destroyed) {
12182
- if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
12183
- if (image.hasAlphaPixel) ui.__layout.hitCanvasChanged = true;
12184
- ui.forceUpdate("surface");
12185
- }
12186
- onLoadSuccess(ui, event);
12187
- }
12188
- leafPaint.loadId = undefined;
12189
- }, error => {
12190
- ignoreRender(ui, false);
12191
- onLoadError(ui, event, error);
12192
- leafPaint.loadId = undefined;
12193
- });
12194
- if (ui.placeholderColor) {
12195
- if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
12196
- if (!image.ready) {
12197
- image.isPlacehold = true;
12198
- ui.forceUpdate("surface");
12199
- }
12200
- }, ui.placeholderDelay);
12201
- }
12202
- }
12203
- return leafPaint;
12194
+ function stretchMode(data, box, scaleX, scaleY) {
12195
+ const transform = get$2(), {x: x, y: y} = box;
12196
+ if (x || y) translate(transform, x, y); else transform.onlyScale = true;
12197
+ scaleHelper(transform, scaleX, scaleY);
12198
+ data.transform = transform;
12204
12199
  }
12205
12200
 
12206
- function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
12207
- if (attrName === "fill" && !ui.__.__naturalWidth) {
12208
- const data = ui.__;
12209
- data.__naturalWidth = image.width / data.pixelRatio;
12210
- data.__naturalHeight = image.height / data.pixelRatio;
12211
- if (data.__autoSide) {
12212
- ui.forceUpdate("width");
12213
- if (ui.__proxyData) {
12214
- ui.setProxyAttr("width", data.width);
12215
- ui.setProxyAttr("height", data.height);
12216
- }
12217
- return false;
12218
- }
12219
- }
12220
- if (!leafPaint.data) createData(leafPaint, image, paint, boxBounds);
12221
- return true;
12201
+ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
12202
+ const transform = get$2();
12203
+ translate(transform, box.x + x, box.y + y);
12204
+ scaleHelper(transform, scaleX, scaleY);
12205
+ if (rotation) rotateOfOuter$1(transform, {
12206
+ x: box.x + box.width / 2,
12207
+ y: box.y + box.height / 2
12208
+ }, rotation);
12209
+ data.transform = transform;
12222
12210
  }
12223
12211
 
12224
- function onLoad(ui, event) {
12225
- emit(ui, ImageEvent.LOAD, event);
12212
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
12213
+ const transform = get$2();
12214
+ layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
12215
+ if (clipScaleX) {
12216
+ if (rotation || skew) {
12217
+ set(tempMatrix$1);
12218
+ scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
12219
+ multiplyParent(transform, tempMatrix$1);
12220
+ } else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
12221
+ }
12222
+ data.transform = transform;
12226
12223
  }
12227
12224
 
12228
- function onLoadSuccess(ui, event) {
12229
- emit(ui, ImageEvent.LOADED, event);
12230
- }
12225
+ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, skew, align, freeTransform) {
12226
+ const transform = get$2();
12227
+ if (freeTransform) {
12228
+ layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
12229
+ } else {
12230
+ if (rotation) {
12231
+ if (align === "center") {
12232
+ rotateOfOuter$1(transform, {
12233
+ x: width / 2,
12234
+ y: height / 2
12235
+ }, rotation);
12236
+ } else {
12237
+ rotate(transform, rotation);
12238
+ switch (rotation) {
12239
+ case 90:
12240
+ translate(transform, height, 0);
12241
+ break;
12231
12242
 
12232
- function onLoadError(ui, event, error) {
12233
- event.error = error;
12234
- ui.forceUpdate("surface");
12235
- emit(ui, ImageEvent.ERROR, event);
12236
- }
12243
+ case 180:
12244
+ translate(transform, width, height);
12245
+ break;
12237
12246
 
12238
- function emit(ui, type, data) {
12239
- if (ui.hasEvent(type)) ui.emitEvent(new ImageEvent(type, data));
12247
+ case 270:
12248
+ translate(transform, 0, width);
12249
+ break;
12250
+ }
12251
+ }
12252
+ }
12253
+ origin.x = box.x + x;
12254
+ origin.y = box.y + y;
12255
+ translate(transform, origin.x, origin.y);
12256
+ if (scaleX) scaleOfOuter$1(transform, origin, scaleX, scaleY);
12257
+ }
12258
+ data.transform = transform;
12240
12259
  }
12241
12260
 
12242
- function ignoreRender(ui, value) {
12243
- const {leafer: leafer} = ui;
12244
- if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
12261
+ function layout(transform, box, x, y, scaleX, scaleY, rotation, skew) {
12262
+ if (rotation) rotate(transform, rotation);
12263
+ if (skew) skewHelper(transform, skew.x, skew.y);
12264
+ if (scaleX) scaleHelper(transform, scaleX, scaleY);
12265
+ translate(transform, box.x + x, box.y + y);
12245
12266
  }
12246
12267
 
12247
12268
  const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
12248
12269
 
12249
- const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
12270
+ const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$1} = Math;
12250
12271
 
12251
- function createPattern(ui, paint, pixelRatio) {
12252
- let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
12253
- const id = scaleX + "-" + scaleY + "-" + pixelRatio;
12272
+ function createPatternTask(paint, ui, canvas, renderOptions) {
12273
+ if (!paint.patternTask) {
12274
+ paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
12275
+ paint.patternTask = null;
12276
+ if (canvas.bounds.hit(ui.__nowWorld)) PaintImage.createPattern(paint, ui, canvas, renderOptions);
12277
+ ui.forceUpdate("surface");
12278
+ }), 300);
12279
+ }
12280
+ }
12281
+
12282
+ function createPattern(paint, ui, canvas, renderOptions) {
12283
+ let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
12254
12284
  if (paint.patternId !== id && !ui.destroyed) {
12255
- const {image: image, data: data} = paint;
12256
- let imageScale, imageMatrix, {width: width, height: height, scaleX: sx, scaleY: sy, transform: transform, repeat: repeat, gap: gap} = data;
12257
- scaleX *= pixelRatio;
12258
- scaleY *= pixelRatio;
12259
- if (sx) {
12260
- sx = abs$1(sx);
12261
- sy = abs$1(sy);
12262
- imageMatrix = get$1();
12263
- copy$1(imageMatrix, transform);
12264
- scale(imageMatrix, 1 / sx, 1 / sy);
12265
- scaleX *= sx;
12266
- scaleY *= sy;
12267
- }
12268
- width *= scaleX;
12269
- height *= scaleY;
12270
- const size = width * height;
12271
- if (!repeat) {
12272
- if (size > Platform.image.maxCacheSize) return false;
12273
- }
12274
- let maxSize = Platform.image.maxPatternSize;
12275
- if (image.isSVG) {
12276
- const ws = width / image.width;
12277
- if (ws > 1) imageScale = ws / ceil(ws);
12278
- } else {
12279
- const imageSize = image.width * image.height;
12280
- if (maxSize > imageSize) maxSize = imageSize;
12281
- }
12282
- if (size > maxSize) imageScale = Math.sqrt(size / maxSize);
12283
- if (imageScale) {
12284
- scaleX /= imageScale;
12285
- scaleY /= imageScale;
12286
- width /= imageScale;
12287
- height /= imageScale;
12288
- }
12289
- if (sx) {
12290
- scaleX /= sx;
12291
- scaleY /= sy;
12292
- }
12293
- const xGap = gap && gap.x * scaleX;
12294
- const yGap = gap && gap.y * scaleY;
12295
- if (transform || scaleX !== 1 || scaleY !== 1) {
12296
- const canvasWidth = width + (xGap || 0);
12297
- const canvasHeight = height + (yGap || 0);
12298
- scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
12299
- scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
12300
- if (!imageMatrix) {
12285
+ if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
12286
+ const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
12287
+ let imageMatrix, xGap, yGap, {width: width, height: height} = image;
12288
+ if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
12289
+ width *= scaleX;
12290
+ height *= scaleY;
12291
+ if (gap) {
12292
+ xGap = gap.x * scaleX / abs$1(data.scaleX || 1);
12293
+ yGap = gap.y * scaleY / abs$1(data.scaleY || 1);
12294
+ }
12295
+ if (transform || scaleX !== 1 || scaleY !== 1) {
12296
+ scaleX *= getFloorScale(width + (xGap || 0));
12297
+ scaleY *= getFloorScale(height + (yGap || 0));
12301
12298
  imageMatrix = get$1();
12302
12299
  if (transform) copy$1(imageMatrix, transform);
12300
+ scale(imageMatrix, 1 / scaleX, 1 / scaleY);
12303
12301
  }
12304
- scale(imageMatrix, 1 / scaleX, 1 / scaleY);
12302
+ const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
12303
+ const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
12304
+ paint.style = pattern;
12305
+ paint.patternId = id;
12305
12306
  }
12306
- const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
12307
- const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
12308
- paint.style = pattern;
12309
- paint.patternId = id;
12310
- return true;
12307
+ }
12308
+ }
12309
+
12310
+ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
12311
+ const {image: image} = paint;
12312
+ let fixScale, maxSize = Platform.image.maxPatternSize, imageSize = image.width * image.height;
12313
+ if (image.isSVG) {
12314
+ if (imageScaleX > 1) fixScale = Math.ceil(imageScaleX) / imageScaleX;
12311
12315
  } else {
12312
- return false;
12316
+ if (maxSize > imageSize) maxSize = imageSize;
12313
12317
  }
12318
+ if ((imageSize *= imageScaleX * imageScaleY) > maxSize) fixScale = Math.sqrt(maxSize / imageSize);
12319
+ return fixScale;
12314
12320
  }
12315
12321
 
12316
- function checkImage(ui, canvas, paint, allowDraw) {
12317
- const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
12318
- const {pixelRatio: pixelRatio} = canvas, {data: data} = paint;
12319
- if (!data || paint.patternId === scaleX + "-" + scaleY + "-" + pixelRatio && !Export.running) {
12322
+ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
12323
+ const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
12324
+ const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting} = renderOptions;
12325
+ if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
12320
12326
  return false;
12321
12327
  } else {
12322
- if (allowDraw) {
12328
+ if (drawImage) {
12323
12329
  if (data.repeat) {
12324
- allowDraw = false;
12325
- } else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
12326
- let {width: width, height: height} = data;
12327
- width *= scaleX * pixelRatio;
12328
- height *= scaleY * pixelRatio;
12329
- if (data.scaleX) {
12330
- width *= data.scaleX;
12331
- height *= data.scaleY;
12332
- }
12333
- allowDraw = width * height > Platform.image.maxCacheSize;
12330
+ drawImage = false;
12331
+ } else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
12332
+ drawImage = Platform.image.isLarge(image, scaleX, scaleY);
12334
12333
  }
12335
12334
  }
12336
- if (allowDraw) {
12335
+ if (drawImage) {
12337
12336
  if (ui.__.__isFastShadow) {
12338
12337
  canvas.fillStyle = paint.style || "#000";
12339
12338
  canvas.fill();
12340
12339
  }
12341
- drawImage(ui, canvas, paint, data);
12340
+ PaintImage.drawImage(paint, scaleX, scaleY, ui, canvas, renderOptions);
12342
12341
  return true;
12343
12342
  } else {
12344
- if (!paint.style || paint.sync || Export.running) {
12345
- createPattern(ui, paint, pixelRatio);
12346
- } else {
12347
- if (!paint.patternTask) {
12348
- paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
12349
- paint.patternTask = null;
12350
- if (canvas.bounds.hit(ui.__nowWorld)) createPattern(ui, paint, pixelRatio);
12351
- ui.forceUpdate("surface");
12352
- }), 300);
12353
- }
12354
- }
12343
+ if (!paint.style || originPaint.sync || exporting) PaintImage.createPattern(paint, ui, canvas, renderOptions); else PaintImage.createPatternTask(paint, ui, canvas, renderOptions);
12355
12344
  return false;
12356
12345
  }
12357
12346
  }
12358
12347
  }
12359
12348
 
12360
- function drawImage(ui, canvas, paint, data) {
12361
- canvas.save();
12362
- canvas.clipUI(ui);
12363
- if (paint.blendMode) canvas.blendMode = paint.blendMode;
12364
- if (data.opacity) canvas.opacity *= data.opacity;
12365
- if (data.transform) canvas.transform(data.transform);
12366
- canvas.drawImage(paint.image.getFull(data.filters), 0, 0, data.width, data.height);
12367
- canvas.restore();
12349
+ function drawImage(paint, _imageScaleX, _imageScaleY, ui, canvas, _renderOptions) {
12350
+ const {data: data, image: image} = paint, {blendMode: blendMode} = paint.originPaint, {opacity: opacity, transform: transform} = data, view = image.getFull(data.filters), u = ui.__;
12351
+ let {width: width, height: height} = image, clipUI;
12352
+ if ((clipUI = transform && !transform.onlyScale || u.path || u.cornerRadius) || opacity || blendMode) {
12353
+ canvas.save();
12354
+ clipUI && canvas.clipUI(ui);
12355
+ blendMode && (canvas.blendMode = blendMode);
12356
+ opacity && (canvas.opacity *= opacity);
12357
+ transform && canvas.transform(transform);
12358
+ canvas.drawImage(view, 0, 0, width, height);
12359
+ canvas.restore();
12360
+ } else {
12361
+ if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
12362
+ canvas.drawImage(view, 0, 0, width, height);
12363
+ }
12364
+ }
12365
+
12366
+ function getImageRenderScaleData(paint, ui, canvas, _renderOptions) {
12367
+ const scaleData = ui.getRenderScaleData(true, paint.originPaint.scaleFixed), {data: data} = paint;
12368
+ if (canvas) {
12369
+ const {pixelRatio: pixelRatio} = canvas;
12370
+ scaleData.scaleX *= pixelRatio;
12371
+ scaleData.scaleY *= pixelRatio;
12372
+ }
12373
+ if (data && data.scaleX) {
12374
+ scaleData.scaleX *= Math.abs(data.scaleX);
12375
+ scaleData.scaleY *= Math.abs(data.scaleY);
12376
+ }
12377
+ return scaleData;
12368
12378
  }
12369
12379
 
12370
12380
  function recycleImage(attrName, data) {
@@ -12396,8 +12406,12 @@ function recycleImage(attrName, data) {
12396
12406
  const PaintImageModule = {
12397
12407
  image: image,
12398
12408
  checkImage: checkImage,
12399
- createPattern: createPattern,
12409
+ drawImage: drawImage,
12410
+ getImageRenderScaleData: getImageRenderScaleData,
12400
12411
  recycleImage: recycleImage,
12412
+ createPatternTask: createPatternTask,
12413
+ createPattern: createPattern,
12414
+ getPatternFixScale: getPatternFixScale,
12401
12415
  createData: createData,
12402
12416
  getPatternData: getPatternData,
12403
12417
  stretchMode: stretchMode,
@@ -12853,10 +12867,8 @@ function createRows(drawData, content, style) {
12853
12867
  bounds = drawData.bounds;
12854
12868
  findMaxWidth = !bounds.width && !style.autoSizeAlign;
12855
12869
  const {__letterSpacing: __letterSpacing, paraIndent: paraIndent, textCase: textCase} = style;
12856
- const {canvas: canvas} = Platform;
12857
- const {width: width, height: height} = bounds;
12858
- const charMode = width || height || __letterSpacing || textCase !== "none";
12859
- if (charMode) {
12870
+ const {canvas: canvas} = Platform, {width: width} = bounds;
12871
+ if (style.__isCharMode) {
12860
12872
  const wrap = style.textWrap !== "none";
12861
12873
  const breakAll = style.textWrap === "break";
12862
12874
  paraStart = true;
@@ -12985,12 +12997,19 @@ const TextMode = 2;
12985
12997
  function layoutChar(drawData, style, width, _height) {
12986
12998
  const {rows: rows} = drawData;
12987
12999
  const {textAlign: textAlign, paraIndent: paraIndent, letterSpacing: letterSpacing} = style;
12988
- let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
13000
+ const justifyLast = width && textAlign.includes("both");
13001
+ const justify = justifyLast || width && textAlign.includes("justify");
13002
+ const justifyLetter = justify && textAlign.includes("letter");
13003
+ let charX, remainingWidth, addWordWidth, addLetterWidth, indentWidth, mode, wordChar, wordsLength, isLastWord, canJustify;
12989
13004
  rows.forEach(row => {
12990
13005
  if (row.words) {
12991
13006
  indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
12992
- addWordWidth = width && (textAlign === "justify" || textAlign === "both") && wordsLength > 1 ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
12993
- mode = letterSpacing || row.isOverflow ? CharMode : addWordWidth > .01 ? WordMode : TextMode;
13007
+ if (justify) {
13008
+ canJustify = !row.paraEnd || justifyLast;
13009
+ remainingWidth = width - row.width - indentWidth;
13010
+ if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
13011
+ }
13012
+ mode = letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
12994
13013
  if (row.isOverflow && !letterSpacing) row.textMode = true;
12995
13014
  if (mode === TextMode) {
12996
13015
  row.x += indentWidth;
@@ -13008,11 +13027,15 @@ function layoutChar(drawData, style, width, _height) {
13008
13027
  charX = toWordChar(word.data, charX, wordChar);
13009
13028
  if (row.isOverflow || wordChar.char !== " ") row.data.push(wordChar);
13010
13029
  } else {
13011
- charX = toChar(word.data, charX, row.data, row.isOverflow);
13030
+ charX = toChar(word.data, charX, row.data, row.isOverflow, canJustify && addLetterWidth);
13012
13031
  }
13013
- if (addWordWidth && (!row.paraEnd || textAlign === "both") && index !== wordsLength - 1) {
13014
- charX += addWordWidth;
13015
- row.width += addWordWidth;
13032
+ if (canJustify) {
13033
+ isLastWord = index === wordsLength - 1;
13034
+ if (addWordWidth) {
13035
+ if (!isLastWord) charX += addWordWidth, row.width += addWordWidth;
13036
+ } else if (addLetterWidth) {
13037
+ row.width += addLetterWidth * (word.data.length - (isLastWord ? 1 : 0));
13038
+ }
13016
13039
  }
13017
13040
  });
13018
13041
  }
@@ -13038,13 +13061,14 @@ function toWordChar(data, charX, wordChar) {
13038
13061
  return charX;
13039
13062
  }
13040
13063
 
13041
- function toChar(data, charX, rowData, isOverflow) {
13064
+ function toChar(data, charX, rowData, isOverflow, addLetterWidth) {
13042
13065
  data.forEach(char => {
13043
13066
  if (isOverflow || char.char !== " ") {
13044
13067
  char.x = charX;
13045
13068
  rowData.push(char);
13046
13069
  }
13047
13070
  charX += char.width;
13071
+ addLetterWidth && (charX += addLetterWidth);
13048
13072
  });
13049
13073
  return charX;
13050
13074
  }
@@ -13186,10 +13210,10 @@ function getDrawData(content, style) {
13186
13210
  let x = 0, y = 0;
13187
13211
  let width = style.__getInput("width") || 0;
13188
13212
  let height = style.__getInput("height") || 0;
13189
- const {textDecoration: textDecoration, __font: __font, __padding: padding} = style;
13213
+ const {__padding: padding} = style;
13190
13214
  if (padding) {
13191
- if (width) x = padding[left], width -= padding[right] + padding[left]; else if (!style.autoSizeAlign) x = padding[left];
13192
- if (height) y = padding[top], height -= padding[top] + padding[bottom]; else if (!style.autoSizeAlign) y = padding[top];
13215
+ if (width) x = padding[left], width -= padding[right] + padding[left], !width && (width = .01); else if (!style.autoSizeAlign) x = padding[left];
13216
+ if (height) y = padding[top], height -= padding[top] + padding[bottom], !height && (height = .01); else if (!style.autoSizeAlign) y = padding[top];
13193
13217
  }
13194
13218
  const drawData = {
13195
13219
  bounds: {
@@ -13200,14 +13224,14 @@ function getDrawData(content, style) {
13200
13224
  },
13201
13225
  rows: [],
13202
13226
  paraNumber: 0,
13203
- font: Platform.canvas.font = __font
13227
+ font: Platform.canvas.font = style.__font
13204
13228
  };
13205
13229
  createRows(drawData, content, style);
13206
13230
  if (padding) padAutoText(padding, drawData, style, width, height);
13207
13231
  layoutText(drawData, style);
13208
- layoutChar(drawData, style, width);
13232
+ if (style.__isCharMode) layoutChar(drawData, style, width);
13209
13233
  if (drawData.overflow) clipText(drawData, style, x, width);
13210
- if (textDecoration !== "none") decorationText(drawData, style);
13234
+ if (style.textDecoration !== "none") decorationText(drawData, style);
13211
13235
  return drawData;
13212
13236
  }
13213
13237
 
@@ -13280,4 +13304,4 @@ Object.assign(Creator, {
13280
13304
 
13281
13305
  useCanvas();
13282
13306
 
13283
- export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, 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, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
13307
+ export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, 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, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };