leafer-ui 1.9.0 → 1.9.2

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.
@@ -476,9 +476,8 @@ const MatrixHelper = {
476
476
  t.e = child.e * a + child.f * c + e;
477
477
  t.f = child.e * b + child.f * d + f;
478
478
  },
479
- multiplyParent(t, parent, to, abcdChanged, childScaleData, scrollData) {
480
- let {e: e, f: f} = t;
481
- if (scrollData) e += scrollData.scrollX, f += scrollData.scrollY;
479
+ multiplyParent(t, parent, to, abcdChanged, childScaleData) {
480
+ const {e: e, f: f} = t;
482
481
  to || (to = t);
483
482
  if (isUndefined(abcdChanged)) abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
484
483
  if (abcdChanged) {
@@ -709,19 +708,19 @@ const PointHelper = {
709
708
  },
710
709
  tempToInnerOf(t, matrix) {
711
710
  const {tempPoint: temp} = P$5;
712
- copy$b(temp, t);
711
+ copy$a(temp, t);
713
712
  toInnerPoint$2(matrix, temp, temp);
714
713
  return temp;
715
714
  },
716
715
  tempToOuterOf(t, matrix) {
717
716
  const {tempPoint: temp} = P$5;
718
- copy$b(temp, t);
717
+ copy$a(temp, t);
719
718
  toOuterPoint$3(matrix, temp, temp);
720
719
  return temp;
721
720
  },
722
721
  tempToInnerRadiusPointOf(t, matrix) {
723
722
  const {tempRadiusPoint: temp} = P$5;
724
- copy$b(temp, t);
723
+ copy$a(temp, t);
725
724
  P$5.toInnerRadiusPointOf(t, matrix, temp);
726
725
  return temp;
727
726
  },
@@ -797,7 +796,7 @@ const PointHelper = {
797
796
 
798
797
  const P$5 = PointHelper;
799
798
 
800
- const {getDistanceFrom: getDistanceFrom, copy: copy$b, getAtan2: getAtan2} = P$5;
799
+ const {getDistanceFrom: getDistanceFrom, copy: copy$a, getAtan2: getAtan2} = P$5;
801
800
 
802
801
  class Point {
803
802
  constructor(x, y) {
@@ -1191,6 +1190,12 @@ const BoundsHelper = {
1191
1190
  t.x += x;
1192
1191
  t.y += y;
1193
1192
  },
1193
+ scroll(t, data) {
1194
+ if (data.scrollY || data.scrollX) {
1195
+ t.x += data.scrollX;
1196
+ t.y += data.scrollY;
1197
+ }
1198
+ },
1194
1199
  getByMove(t, x, y) {
1195
1200
  t = Object.assign({}, t);
1196
1201
  B.move(t, x, y);
@@ -1200,7 +1205,7 @@ const BoundsHelper = {
1200
1205
  if (!to) {
1201
1206
  to = t;
1202
1207
  } else {
1203
- copy$a(to, t);
1208
+ copy$9(to, t);
1204
1209
  }
1205
1210
  if (parent) {
1206
1211
  to.offsetX = -(B.maxX(parent) - t.x);
@@ -1352,7 +1357,7 @@ const BoundsHelper = {
1352
1357
  if (bounds && (bounds.width || bounds.height)) {
1353
1358
  if (first) {
1354
1359
  first = false;
1355
- if (!addMode) copy$a(t, bounds);
1360
+ if (!addMode) copy$9(t, bounds);
1356
1361
  } else {
1357
1362
  add$1(t, bounds);
1358
1363
  }
@@ -1439,7 +1444,7 @@ const BoundsHelper = {
1439
1444
 
1440
1445
  const B = BoundsHelper;
1441
1446
 
1442
- const {add: add$1, copy: copy$a} = B;
1447
+ const {add: add$1, copy: copy$9} = B;
1443
1448
 
1444
1449
  class Bounds {
1445
1450
  get minX() {
@@ -1654,17 +1659,17 @@ class Debug {
1654
1659
  showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
1655
1660
  }
1656
1661
  log(...messages) {
1657
- if (D$4.enable) {
1658
- if (D$4.filterList.length && D$4.filterList.every(name => name !== this.name)) return;
1659
- if (D$4.excludeList.length && D$4.excludeList.some(name => name === this.name)) return;
1662
+ if (D$5.enable) {
1663
+ if (D$5.filterList.length && D$5.filterList.every(name => name !== this.name)) return;
1664
+ if (D$5.excludeList.length && D$5.excludeList.some(name => name === this.name)) return;
1660
1665
  console.log("%c" + this.name, "color:#21ae62", ...messages);
1661
1666
  }
1662
1667
  }
1663
1668
  tip(...messages) {
1664
- if (D$4.enable) this.warn(...messages);
1669
+ if (D$5.enable) this.warn(...messages);
1665
1670
  }
1666
1671
  warn(...messages) {
1667
- if (D$4.showWarn) console.warn(this.name, ...messages);
1672
+ if (D$5.showWarn) console.warn(this.name, ...messages);
1668
1673
  }
1669
1674
  repeat(name, ...messages) {
1670
1675
  if (!this.repeatMap[name]) {
@@ -1692,7 +1697,7 @@ function getNameList(name) {
1692
1697
  return name;
1693
1698
  }
1694
1699
 
1695
- const D$4 = Debug;
1700
+ const D$5 = Debug;
1696
1701
 
1697
1702
  const debug$g = Debug.get("RunTime");
1698
1703
 
@@ -2137,7 +2142,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
2137
2142
 
2138
2143
  __decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
2139
2144
 
2140
- const {copy: copy$9, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math;
2145
+ const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2141
2146
 
2142
2147
  const minSize = {
2143
2148
  width: 1,
@@ -2181,7 +2186,7 @@ class LeaferCanvasBase extends Canvas$1 {
2181
2186
  this.innerId = IncrementId.create(IncrementId.CNAVAS);
2182
2187
  const {width: width, height: height, pixelRatio: pixelRatio} = config;
2183
2188
  this.autoLayout = !width || !height;
2184
- this.size.pixelRatio = pixelRatio | Platform.devicePixelRatio;
2189
+ this.size.pixelRatio = pixelRatio || Platform.devicePixelRatio;
2185
2190
  this.config = config;
2186
2191
  this.init();
2187
2192
  }
@@ -2302,44 +2307,44 @@ class LeaferCanvasBase extends Canvas$1 {
2302
2307
  const {pixelRatio: pixelRatio} = this;
2303
2308
  this.filter = `blur(${blur * pixelRatio}px)`;
2304
2309
  }
2305
- copyWorld(canvas, from, to, blendMode) {
2310
+ copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
2306
2311
  if (blendMode) this.blendMode = blendMode;
2307
2312
  if (from) {
2308
- const {pixelRatio: pixelRatio} = this;
2309
- if (!to) to = from;
2310
- this.drawImage(canvas.view, from.x * pixelRatio, from.y * pixelRatio, from.width * pixelRatio, from.height * pixelRatio, to.x * pixelRatio, to.y * pixelRatio, to.width * pixelRatio, to.height * pixelRatio);
2313
+ this.setTempPixelBounds(from, ceilPixel);
2314
+ if (!to) to = tempPixelBounds; else this.setTempPixelBounds2(to, ceilPixel), to = tempPixelBounds2;
2315
+ this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, to.x, to.y, to.width, to.height);
2311
2316
  } else {
2312
2317
  this.drawImage(canvas.view, 0, 0);
2313
2318
  }
2314
2319
  if (blendMode) this.blendMode = "source-over";
2315
2320
  }
2316
- copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode) {
2317
- if (blendMode) this.blendMode = blendMode;
2321
+ copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
2318
2322
  if (fromWorld.b || fromWorld.c) {
2319
2323
  this.save();
2320
2324
  this.resetTransform();
2321
- this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld));
2325
+ this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld), blendMode, ceilPixel);
2322
2326
  this.restore();
2323
2327
  } else {
2324
- const {pixelRatio: pixelRatio} = this;
2325
- this.drawImage(canvas.view, fromWorld.x * pixelRatio, fromWorld.y * pixelRatio, fromWorld.width * pixelRatio, fromWorld.height * pixelRatio, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
2328
+ if (blendMode) this.blendMode = blendMode;
2329
+ this.setTempPixelBounds(fromWorld, ceilPixel);
2330
+ this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
2331
+ if (blendMode) this.blendMode = "source-over";
2326
2332
  }
2327
- if (blendMode) this.blendMode = "source-over";
2328
2333
  }
2329
- copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform) {
2334
+ copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
2330
2335
  this.resetTransform();
2331
- this.copyWorld(canvas, from, to, blendMode);
2336
+ this.copyWorld(canvas, from, to, blendMode, ceilPixel);
2332
2337
  if (!onlyResetTransform) this.useWorldTransform();
2333
2338
  }
2334
2339
  useGrayscaleAlpha(bounds) {
2335
- this.setTempBounds(bounds, true, true);
2340
+ this.setTempPixelBounds(bounds, true, true);
2336
2341
  let alpha, pixel;
2337
- const {context: context} = this, imageData = context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height), {data: data} = imageData;
2342
+ const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
2338
2343
  for (let i = 0, len = data.length; i < len; i += 4) {
2339
2344
  pixel = data[i] * .299 + data[i + 1] * .587 + data[i + 2] * .114;
2340
2345
  if (alpha = data[i + 3]) data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
2341
2346
  }
2342
- context.putImageData(imageData, tempBounds$1.x, tempBounds$1.y);
2347
+ context.putImageData(imageData, tempPixelBounds.x, tempPixelBounds.y);
2343
2348
  }
2344
2349
  useMask(maskCanvas, fromBounds, toBounds) {
2345
2350
  this.copyWorld(maskCanvas, fromBounds, toBounds, "destination-in");
@@ -2347,42 +2352,48 @@ class LeaferCanvasBase extends Canvas$1 {
2347
2352
  useEraser(eraserCanvas, fromBounds, toBounds) {
2348
2353
  this.copyWorld(eraserCanvas, fromBounds, toBounds, "destination-out");
2349
2354
  }
2350
- fillWorld(bounds, color, blendMode) {
2355
+ fillWorld(bounds, color, blendMode, ceilPixel) {
2351
2356
  if (blendMode) this.blendMode = blendMode;
2352
2357
  this.fillStyle = color;
2353
- this.setTempBounds(bounds);
2354
- this.fillRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2358
+ this.setTempPixelBounds(bounds, ceilPixel);
2359
+ this.fillRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2355
2360
  if (blendMode) this.blendMode = "source-over";
2356
2361
  }
2357
- strokeWorld(bounds, color, blendMode) {
2362
+ strokeWorld(bounds, color, blendMode, ceilPixel) {
2358
2363
  if (blendMode) this.blendMode = blendMode;
2359
2364
  this.strokeStyle = color;
2360
- this.setTempBounds(bounds);
2361
- this.strokeRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2365
+ this.setTempPixelBounds(bounds, ceilPixel);
2366
+ this.strokeRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2362
2367
  if (blendMode) this.blendMode = "source-over";
2363
2368
  }
2364
- clipWorld(bounds, ceilPixel) {
2369
+ clipWorld(bounds, ceilPixel = true) {
2365
2370
  this.beginPath();
2366
- this.setTempBounds(bounds, ceilPixel);
2367
- this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2371
+ this.setTempPixelBounds(bounds, ceilPixel);
2372
+ this.rect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2368
2373
  this.clip();
2369
2374
  }
2370
2375
  clipUI(ruleData) {
2371
2376
  ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
2372
2377
  }
2373
- clearWorld(bounds, ceilPixel) {
2374
- this.setTempBounds(bounds, ceilPixel);
2375
- this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2378
+ clearWorld(bounds, ceilPixel = true) {
2379
+ this.setTempPixelBounds(bounds, ceilPixel);
2380
+ this.clearRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2376
2381
  }
2377
2382
  clear() {
2378
2383
  const {pixelRatio: pixelRatio} = this;
2379
2384
  this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
2380
2385
  }
2381
- setTempBounds(bounds, ceil, intersect) {
2382
- tempBounds$1.set(bounds);
2383
- if (intersect) tempBounds$1.intersect(this.bounds);
2384
- tempBounds$1.scale(this.pixelRatio);
2385
- if (ceil) tempBounds$1.ceil();
2386
+ setTempPixelBounds(bounds, ceil, intersect) {
2387
+ this.copyToPixelBounds(tempPixelBounds, bounds, ceil, intersect);
2388
+ }
2389
+ setTempPixelBounds2(bounds, ceil, intersect) {
2390
+ this.copyToPixelBounds(tempPixelBounds2, bounds, ceil, intersect);
2391
+ }
2392
+ copyToPixelBounds(pixelBounds, bounds, ceil, intersect) {
2393
+ pixelBounds.set(bounds);
2394
+ if (intersect) pixelBounds.intersect(this.bounds);
2395
+ pixelBounds.scale(this.pixelRatio);
2396
+ if (ceil) pixelBounds.ceil();
2386
2397
  }
2387
2398
  isSameSize(size) {
2388
2399
  return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
@@ -2390,7 +2401,7 @@ class LeaferCanvasBase extends Canvas$1 {
2390
2401
  getSameCanvas(useSameWorldTransform, useSameSmooth) {
2391
2402
  const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
2392
2403
  canvas.save();
2393
- if (useSameWorldTransform) copy$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2404
+ if (useSameWorldTransform) copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2394
2405
  if (useSameSmooth) canvas.smooth = this.smooth;
2395
2406
  canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
2396
2407
  return canvas;
@@ -2398,7 +2409,7 @@ class LeaferCanvasBase extends Canvas$1 {
2398
2409
  recycle(clearBounds) {
2399
2410
  if (!this.recycled) {
2400
2411
  this.restore();
2401
- clearBounds ? this.clearWorld(clearBounds, true) : this.clear();
2412
+ clearBounds ? this.clearWorld(clearBounds) : this.clear();
2402
2413
  this.manager ? this.manager.recycle(this) : this.destroy();
2403
2414
  }
2404
2415
  }
@@ -2779,7 +2790,7 @@ const EllipseHelper = {
2779
2790
  }
2780
2791
  };
2781
2792
 
2782
- const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
2793
+ const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
2783
2794
 
2784
2795
  const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2785
2796
 
@@ -2999,7 +3010,7 @@ const PathConvert = {
2999
3010
  i += 5;
3000
3011
  break;
3001
3012
 
3002
- case D$3:
3013
+ case D$4:
3003
3014
  x = old[i + 1];
3004
3015
  y = old[i + 2];
3005
3016
  curveMode ? roundRect$2(data, x, y, old[i + 3], old[i + 4], [ old[i + 5], old[i + 6], old[i + 7], old[i + 8] ]) : copyData(data, old, i, 9);
@@ -3100,7 +3111,7 @@ const PathConvert = {
3100
3111
 
3101
3112
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
3102
3113
 
3103
- const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
3114
+ const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
3104
3115
 
3105
3116
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3106
3117
 
@@ -3136,7 +3147,7 @@ const PathCommandDataHelper = {
3136
3147
  } else {
3137
3148
  const fourCorners = MathHelper.fourNumber(cornerRadius);
3138
3149
  if (fourCorners) {
3139
- data.push(D$2, x, y, width, height, ...fourCorners);
3150
+ data.push(D$3, x, y, width, height, ...fourCorners);
3140
3151
  } else {
3141
3152
  data.push(N$2, x, y, width, height);
3142
3153
  }
@@ -3279,7 +3290,7 @@ class PathCreator {
3279
3290
  paint() {}
3280
3291
  }
3281
3292
 
3282
- const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1} = PathCommandMap;
3293
+ const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$2, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1} = PathCommandMap;
3283
3294
 
3284
3295
  const debug$c = Debug.get("PathDrawer");
3285
3296
 
@@ -3321,7 +3332,7 @@ const PathDrawer = {
3321
3332
  i += 5;
3322
3333
  break;
3323
3334
 
3324
- case D$1:
3335
+ case D$2:
3325
3336
  drawer.roundRect(data[i + 1], data[i + 2], data[i + 3], data[i + 4], [ data[i + 5], data[i + 6], data[i + 7], data[i + 8] ]);
3326
3337
  i += 9;
3327
3338
  break;
@@ -3364,11 +3375,11 @@ const PathDrawer = {
3364
3375
  }
3365
3376
  };
3366
3377
 
3367
- const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
3378
+ const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D$1, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
3368
3379
 
3369
3380
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3370
3381
 
3371
- const {addPointBounds: addPointBounds, copy: copy$8, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3382
+ const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3372
3383
 
3373
3384
  const debug$b = Debug.get("PathBounds");
3374
3385
 
@@ -3440,17 +3451,17 @@ const PathBounds = {
3440
3451
  i += 5;
3441
3452
  break;
3442
3453
 
3443
- case D:
3454
+ case D$1:
3444
3455
  case X:
3445
3456
  x = data[i + 1];
3446
3457
  y = data[i + 2];
3447
3458
  addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
3448
- i += command === D ? 9 : 6;
3459
+ i += command === D$1 ? 9 : 6;
3449
3460
  break;
3450
3461
 
3451
3462
  case G:
3452
3463
  ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
3453
- i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3464
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3454
3465
  x = setEndPoint.x;
3455
3466
  y = setEndPoint.y;
3456
3467
  i += 9;
@@ -3468,7 +3479,7 @@ const PathBounds = {
3468
3479
 
3469
3480
  case O:
3470
3481
  arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
3471
- i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3482
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3472
3483
  x = setEndPoint.x;
3473
3484
  y = setEndPoint.y;
3474
3485
  i += 7;
@@ -3485,7 +3496,7 @@ const PathBounds = {
3485
3496
 
3486
3497
  case U:
3487
3498
  arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
3488
- i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3499
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3489
3500
  x = setEndPoint.x;
3490
3501
  y = setEndPoint.y;
3491
3502
  i += 6;
@@ -4138,6 +4149,17 @@ function positionType(defaultValue, checkFiniteNumber) {
4138
4149
  }));
4139
4150
  }
4140
4151
 
4152
+ function scrollType(defaultValue, checkFiniteNumber) {
4153
+ return decorateLeafAttr(defaultValue, key => attr({
4154
+ set(value) {
4155
+ if (this.__setAttr(key, value, checkFiniteNumber)) {
4156
+ this.__layout.matrixChanged || this.__layout.matrixChange();
4157
+ this.__scrollWorld || (this.__scrollWorld = {});
4158
+ }
4159
+ }
4160
+ }));
4161
+ }
4162
+
4141
4163
  function autoLayoutType(defaultValue) {
4142
4164
  return decorateLeafAttr(defaultValue, key => attr({
4143
4165
  set(value) {
@@ -4476,7 +4498,7 @@ function registerUIEvent() {
4476
4498
  };
4477
4499
  }
4478
4500
 
4479
- const {copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
4501
+ const {copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
4480
4502
 
4481
4503
  const matrix$1 = {}, {round: round} = Math;
4482
4504
 
@@ -4552,7 +4574,7 @@ const LeafHelper = {
4552
4574
  x: x,
4553
4575
  y: y
4554
4576
  };
4555
- isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true);
4577
+ isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
4556
4578
  L.moveLocal(t, local.x, local.y, transition);
4557
4579
  },
4558
4580
  moveLocal(t, x, y = 0, transition) {
@@ -4574,9 +4596,9 @@ const LeafHelper = {
4574
4596
  if (scaleY) transition = scaleY;
4575
4597
  scaleY = scaleX;
4576
4598
  }
4577
- copy$7(matrix$1, o);
4599
+ copy$6(matrix$1, o);
4578
4600
  scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4579
- if (t.origin || t.around) {
4601
+ if (L.hasHighPosition(t)) {
4580
4602
  L.setTransform(t, matrix$1, resize, transition);
4581
4603
  } else {
4582
4604
  const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
@@ -4593,9 +4615,9 @@ const LeafHelper = {
4593
4615
  },
4594
4616
  rotateOfLocal(t, origin, angle, transition) {
4595
4617
  const o = t.__localMatrix;
4596
- copy$7(matrix$1, o);
4618
+ copy$6(matrix$1, o);
4597
4619
  rotateOfOuter$2(matrix$1, origin, angle);
4598
- if (t.origin || t.around) L.setTransform(t, matrix$1, false, transition); else t.set({
4620
+ if (L.hasHighPosition(t)) L.setTransform(t, matrix$1, false, transition); else t.set({
4599
4621
  x: t.x + matrix$1.e - o.e,
4600
4622
  y: t.y + matrix$1.f - o.f,
4601
4623
  rotation: MathHelper.formatRotation(t.rotation + angle)
@@ -4605,24 +4627,28 @@ const LeafHelper = {
4605
4627
  L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4606
4628
  },
4607
4629
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4608
- copy$7(matrix$1, t.__localMatrix);
4630
+ copy$6(matrix$1, t.__localMatrix);
4609
4631
  skewOfOuter(matrix$1, origin, skewX, skewY);
4610
4632
  L.setTransform(t, matrix$1, resize, transition);
4611
4633
  },
4612
4634
  transformWorld(t, transform, resize, transition) {
4613
- copy$7(matrix$1, t.worldTransform);
4635
+ copy$6(matrix$1, t.worldTransform);
4614
4636
  multiplyParent$3(matrix$1, transform);
4615
- if (t.parent) divideParent(matrix$1, t.parent.worldTransform);
4637
+ if (t.parent) divideParent(matrix$1, t.parent.scrollWorldTransform);
4616
4638
  L.setTransform(t, matrix$1, resize, transition);
4617
4639
  },
4618
4640
  transform(t, transform, resize, transition) {
4619
- copy$7(matrix$1, t.localTransform);
4641
+ copy$6(matrix$1, t.localTransform);
4620
4642
  multiplyParent$3(matrix$1, transform);
4621
4643
  L.setTransform(t, matrix$1, resize, transition);
4622
4644
  },
4623
4645
  setTransform(t, transform, resize, transition) {
4624
4646
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
4625
4647
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
4648
+ if (L.hasOffset(t)) {
4649
+ layout.x -= data.offsetX;
4650
+ layout.y -= data.offsetY;
4651
+ }
4626
4652
  if (resize) {
4627
4653
  const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
4628
4654
  delete layout.scaleX, delete layout.scaleY;
@@ -4650,14 +4676,20 @@ const LeafHelper = {
4650
4676
  return innerOrigin;
4651
4677
  },
4652
4678
  getRelativeWorld(t, relative, temp) {
4653
- copy$7(matrix$1, t.worldTransform);
4654
- divideParent(matrix$1, relative.worldTransform);
4679
+ copy$6(matrix$1, t.worldTransform);
4680
+ divideParent(matrix$1, relative.scrollWorldTransform);
4655
4681
  return temp ? matrix$1 : Object.assign({}, matrix$1);
4656
4682
  },
4657
4683
  drop(t, parent, index, resize) {
4658
4684
  t.setTransform(L.getRelativeWorld(t, parent, true), resize);
4659
4685
  parent.add(t, index);
4660
4686
  },
4687
+ hasHighPosition(t) {
4688
+ return t.origin || t.around || L.hasOffset(t);
4689
+ },
4690
+ hasOffset(t) {
4691
+ return t.offsetX || t.offsetY;
4692
+ },
4661
4693
  hasParent(p, parent) {
4662
4694
  if (!parent) return false;
4663
4695
  while (p) {
@@ -4683,8 +4715,7 @@ const L = LeafHelper;
4683
4715
  const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
4684
4716
 
4685
4717
  function getTempLocal(t, world) {
4686
- t.__layout.update();
4687
- return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
4718
+ return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
4688
4719
  }
4689
4720
 
4690
4721
  const LeafBoundsHelper = {
@@ -4809,7 +4840,7 @@ const WaitHelper = {
4809
4840
 
4810
4841
  const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
4811
4842
 
4812
- const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$6} = BoundsHelper;
4843
+ const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$5} = BoundsHelper;
4813
4844
 
4814
4845
  const localContent = "_localContentBounds";
4815
4846
 
@@ -5048,7 +5079,7 @@ class LeafLayout {
5048
5079
  matrix = getRelativeWorld$1(leaf, relative, true);
5049
5080
  }
5050
5081
  if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
5051
- copy$6(layoutBounds, bounds);
5082
+ copy$5(layoutBounds, bounds);
5052
5083
  PointHelper.copy(layoutBounds, point);
5053
5084
  if (unscale) {
5054
5085
  const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
@@ -5236,6 +5267,8 @@ ChildEvent.UNMOUNTED = "unmounted";
5236
5267
 
5237
5268
  ChildEvent.DESTROY = "destroy";
5238
5269
 
5270
+ const SCROLL = "property.scroll";
5271
+
5239
5272
  class PropertyEvent extends Event {
5240
5273
  constructor(type, target, attrName, oldValue, newValue) {
5241
5274
  super(type, target);
@@ -5249,6 +5282,13 @@ PropertyEvent.CHANGE = "property.change";
5249
5282
 
5250
5283
  PropertyEvent.LEAFER_CHANGE = "property.leafer_change";
5251
5284
 
5285
+ PropertyEvent.SCROLL = SCROLL;
5286
+
5287
+ const extraPropertyEventMap = {
5288
+ scrollX: SCROLL,
5289
+ scrollY: SCROLL
5290
+ };
5291
+
5252
5292
  class ImageEvent extends Event {
5253
5293
  constructor(type, data) {
5254
5294
  super(type);
@@ -5524,7 +5564,9 @@ class Eventer {
5524
5564
  if (!id) return;
5525
5565
  const list = isArray(id) ? id : [ id ];
5526
5566
  list.forEach(item => {
5527
- if (!item.listener) isArray(item.type) && item.type.forEach(v => item.current.off(v[0], v[1], v[3])); else item.current.off(item.type, item.listener, item.options);
5567
+ if (item) {
5568
+ if (!item.listener) isArray(item.type) && item.type.forEach(v => item.current.off(v[0], v[1], v[3])); else item.current.off(item.type, item.listener, item.options);
5569
+ }
5528
5570
  });
5529
5571
  list.length = 0;
5530
5572
  }
@@ -5618,8 +5660,6 @@ const LeafDataProxy = {
5618
5660
  }
5619
5661
  if (isObject(newValue) || oldValue !== newValue) {
5620
5662
  this.__realSetAttr(name, newValue);
5621
- const {CHANGE: CHANGE} = PropertyEvent;
5622
- const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
5623
5663
  if (this.isLeafer) {
5624
5664
  this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
5625
5665
  const transformEventName = leaferTransformAttrMap[name];
@@ -5627,10 +5667,10 @@ const LeafDataProxy = {
5627
5667
  this.emitEvent(new LeaferEvent(transformEventName, this));
5628
5668
  this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this));
5629
5669
  }
5630
- } else {
5631
- if (this.hasEvent(CHANGE)) this.emitEvent(event);
5632
5670
  }
5633
- this.leafer.emitEvent(event);
5671
+ this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue);
5672
+ const extraPropertyEvent = extraPropertyEventMap[name];
5673
+ if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue);
5634
5674
  return true;
5635
5675
  } else {
5636
5676
  return false;
@@ -5640,6 +5680,11 @@ const LeafDataProxy = {
5640
5680
  return true;
5641
5681
  }
5642
5682
  },
5683
+ emitPropertyEvent(type, name, oldValue, newValue) {
5684
+ const event = new PropertyEvent(type, this, name, oldValue, newValue);
5685
+ this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
5686
+ this.leafer.emitEvent(event);
5687
+ },
5643
5688
  __realSetAttr(name, newValue) {
5644
5689
  const data = this.__;
5645
5690
  data[name] = newValue;
@@ -5658,8 +5703,9 @@ const {toPoint: toPoint$3, tempPoint: tempPoint} = AroundHelper;
5658
5703
 
5659
5704
  const LeafMatrix = {
5660
5705
  __updateWorldMatrix() {
5661
- const {parent: parent, __layout: __layout} = this;
5662
- multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__, parent && (parent.scrollY || parent.scrollX) && parent.__);
5706
+ const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
5707
+ multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
5708
+ if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
5663
5709
  },
5664
5710
  __updateLocalMatrix() {
5665
5711
  if (this.__local) {
@@ -5685,7 +5731,7 @@ const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafH
5685
5731
 
5686
5732
  const {updateBounds: updateBounds$1} = BranchHelper;
5687
5733
 
5688
- const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5} = BoundsHelper;
5734
+ const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4} = BoundsHelper;
5689
5735
 
5690
5736
  const {toBounds: toBounds$1} = PathBounds;
5691
5737
 
@@ -5756,7 +5802,7 @@ const LeafBounds = {
5756
5802
  __updateLocalRenderBounds() {
5757
5803
  toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
5758
5804
  },
5759
- __updateBoxBounds() {
5805
+ __updateBoxBounds(_secondLayout, _bounds) {
5760
5806
  const b = this.__layout.boxBounds;
5761
5807
  const data = this.__;
5762
5808
  if (data.__pathInputed) {
@@ -5790,13 +5836,13 @@ const LeafBounds = {
5790
5836
  data.__naturalWidth = layout.boxBounds.width;
5791
5837
  data.__naturalHeight = layout.boxBounds.height;
5792
5838
  },
5793
- __updateStrokeBounds() {
5839
+ __updateStrokeBounds(_bounds) {
5794
5840
  const layout = this.__layout;
5795
5841
  copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5796
5842
  },
5797
- __updateRenderBounds() {
5843
+ __updateRenderBounds(_bounds) {
5798
5844
  const layout = this.__layout;
5799
- layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5845
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
5800
5846
  }
5801
5847
  };
5802
5848
 
@@ -5895,7 +5941,7 @@ const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: m
5895
5941
 
5896
5942
  const {toOuterOf: toOuterOf} = BoundsHelper;
5897
5943
 
5898
- const {copy: copy$4, move: move} = PointHelper;
5944
+ const {copy: copy$3, move: move} = PointHelper;
5899
5945
 
5900
5946
  const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
5901
5947
 
@@ -5943,6 +5989,10 @@ let Leaf = class Leaf {
5943
5989
  get localTransform() {
5944
5990
  return this.__layout.getTransform("local");
5945
5991
  }
5992
+ get scrollWorldTransform() {
5993
+ this.updateLayout();
5994
+ return this.__scrollWorld || this.__world;
5995
+ }
5946
5996
  get boxBounds() {
5947
5997
  return this.getBounds("box", "inner");
5948
5998
  }
@@ -5959,7 +6009,7 @@ let Leaf = class Leaf {
5959
6009
  return this.getBounds("render");
5960
6010
  }
5961
6011
  get worldOpacity() {
5962
- this.__layout.update();
6012
+ this.updateLayout();
5963
6013
  return this.__worldOpacity;
5964
6014
  }
5965
6015
  get __worldFlipped() {
@@ -6134,10 +6184,10 @@ let Leaf = class Leaf {
6134
6184
  __updateLocalBoxBounds() {}
6135
6185
  __updateLocalStrokeBounds() {}
6136
6186
  __updateLocalRenderBounds() {}
6137
- __updateBoxBounds() {}
6187
+ __updateBoxBounds(_secondLayout, _bounds) {}
6138
6188
  __updateContentBounds() {}
6139
- __updateStrokeBounds() {}
6140
- __updateRenderBounds() {}
6189
+ __updateStrokeBounds(_bounds) {}
6190
+ __updateRenderBounds(_bounds) {}
6141
6191
  __updateAutoLayout() {}
6142
6192
  __updateFlowLayout() {}
6143
6193
  __updateNaturalSize() {}
@@ -6209,14 +6259,14 @@ let Leaf = class Leaf {
6209
6259
  if (this.parent) {
6210
6260
  this.parent.worldToInner(world, to, distance, relative);
6211
6261
  } else {
6212
- if (to) copy$4(to, world);
6262
+ if (to) copy$3(to, world);
6213
6263
  }
6214
6264
  }
6215
6265
  localToWorld(local, to, distance, relative) {
6216
6266
  if (this.parent) {
6217
6267
  this.parent.innerToWorld(local, to, distance, relative);
6218
6268
  } else {
6219
- if (to) copy$4(to, local);
6269
+ if (to) copy$3(to, local);
6220
6270
  }
6221
6271
  }
6222
6272
  worldToInner(world, to, distance, relative) {
@@ -6437,14 +6487,14 @@ let Branch = class Branch extends Leaf {
6437
6487
  }
6438
6488
  return 0;
6439
6489
  }
6440
- __updateBoxBounds() {
6441
- setListWithFn(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6490
+ __updateBoxBounds(_secondLayout, bounds) {
6491
+ setListWithFn(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6442
6492
  }
6443
- __updateStrokeBounds() {
6444
- setListWithFn(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6493
+ __updateStrokeBounds(bounds) {
6494
+ setListWithFn(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6445
6495
  }
6446
- __updateRenderBounds() {
6447
- setListWithFn(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6496
+ __updateRenderBounds(bounds) {
6497
+ setListWithFn(bounds || this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6448
6498
  }
6449
6499
  __updateSortChildren() {
6450
6500
  let affectSort;
@@ -6691,7 +6741,7 @@ class LeafLevelList {
6691
6741
  }
6692
6742
  }
6693
6743
 
6694
- const version = "1.9.0";
6744
+ const version = "1.9.2";
6695
6745
 
6696
6746
  const debug$5 = Debug.get("LeaferCanvas");
6697
6747
 
@@ -7406,8 +7456,8 @@ class Renderer {
7406
7456
  const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
7407
7457
  canvas.save();
7408
7458
  bounds.spread(Renderer.clipSpread).ceil();
7409
- canvas.clearWorld(bounds, true);
7410
- canvas.clipWorld(bounds, true);
7459
+ canvas.clearWorld(bounds);
7460
+ canvas.clipWorld(bounds);
7411
7461
  this.__render(bounds, realBounds);
7412
7462
  canvas.restore();
7413
7463
  Run.end(t);
@@ -7630,6 +7680,7 @@ class Picker {
7630
7680
  hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
7631
7681
  if (child.isBranch) {
7632
7682
  if (hit || child.__ignoreHitWorld) {
7683
+ if (child.topChildren) this.eachFind(child.topChildren, false);
7633
7684
  this.eachFind(child.children, child.__onlyHitMask);
7634
7685
  if (child.isBranchLeaf) this.hitChild(child, point);
7635
7686
  }
@@ -7977,7 +8028,7 @@ class BoxData extends GroupData {
7977
8028
  }
7978
8029
  get __clipAfterFill() {
7979
8030
  const t = this;
7980
- return t.overflow === "hide" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
8031
+ return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
7981
8032
  }
7982
8033
  }
7983
8034
 
@@ -8133,6 +8184,41 @@ const UIBounds = {
8133
8184
  }
8134
8185
  };
8135
8186
 
8187
+ const DragBoundsHelper = {
8188
+ getValidMove(content, dragBounds, dragBoundsType, move, change) {
8189
+ const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
8190
+ const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
8191
+ if (!change) move = Object.assign({}, move);
8192
+ const isBiggerWidth = content.width > dragBounds.width;
8193
+ const isBiggerHeight = content.height > dragBounds.height;
8194
+ if (isBiggerWidth && dragBoundsType !== "outer") {
8195
+ if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
8196
+ } else {
8197
+ if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
8198
+ }
8199
+ if (isBiggerHeight && dragBoundsType !== "outer") {
8200
+ if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
8201
+ } else {
8202
+ if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
8203
+ }
8204
+ move.x = MathHelper.float(move.x);
8205
+ move.y = MathHelper.float(move.y);
8206
+ return move;
8207
+ },
8208
+ axisMove(leaf, move) {
8209
+ const {draggable: draggable} = leaf;
8210
+ if (draggable === "x") move.y = 0;
8211
+ if (draggable === "y") move.x = 0;
8212
+ },
8213
+ limitMove(leaf, move) {
8214
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8215
+ if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
8216
+ D.axisMove(leaf, move);
8217
+ }
8218
+ };
8219
+
8220
+ const D = DragBoundsHelper;
8221
+
8136
8222
  const {stintSet: stintSet$1} = DataHelper;
8137
8223
 
8138
8224
  const UIRender = {
@@ -8447,9 +8533,9 @@ __decorate([ positionType(0, true) ], UI.prototype, "offsetX", void 0);
8447
8533
 
8448
8534
  __decorate([ positionType(0, true) ], UI.prototype, "offsetY", void 0);
8449
8535
 
8450
- __decorate([ positionType(0, true) ], UI.prototype, "scrollX", void 0);
8536
+ __decorate([ scrollType(0, true) ], UI.prototype, "scrollX", void 0);
8451
8537
 
8452
- __decorate([ positionType(0, true) ], UI.prototype, "scrollY", void 0);
8538
+ __decorate([ scrollType(0, true) ], UI.prototype, "scrollY", void 0);
8453
8539
 
8454
8540
  __decorate([ autoLayoutType() ], UI.prototype, "origin", void 0);
8455
8541
 
@@ -8479,6 +8565,8 @@ __decorate([ dataType(false) ], UI.prototype, "draggable", void 0);
8479
8565
 
8480
8566
  __decorate([ dataType() ], UI.prototype, "dragBounds", void 0);
8481
8567
 
8568
+ __decorate([ dataType("auto") ], UI.prototype, "dragBoundsType", void 0);
8569
+
8482
8570
  __decorate([ dataType(false) ], UI.prototype, "editable", void 0);
8483
8571
 
8484
8572
  __decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
@@ -8901,7 +8989,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8901
8989
  zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
8902
8990
  return Plugin.need("view");
8903
8991
  }
8904
- getValidMove(moveX, moveY) {
8992
+ getValidMove(moveX, moveY, _checkLimit) {
8905
8993
  return {
8906
8994
  x: moveX,
8907
8995
  y: moveY
@@ -8990,12 +9078,10 @@ __decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
8990
9078
 
8991
9079
  Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], Rect);
8992
9080
 
8993
- const {copy: copy$3, add: add, includes: includes$1} = BoundsHelper;
9081
+ const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
8994
9082
 
8995
9083
  const rect$1 = Rect.prototype, group = Group.prototype;
8996
9084
 
8997
- const childrenRenderBounds = {};
8998
-
8999
9085
  let Box = class Box extends Group {
9000
9086
  get __tag() {
9001
9087
  return "Box";
@@ -9041,22 +9127,24 @@ let Box = class Box extends Group {
9041
9127
  __updateRenderBounds() {
9042
9128
  let isOverflow;
9043
9129
  if (this.children.length) {
9044
- const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} = this.__layout;
9045
- super.__updateRenderBounds();
9046
- copy$3(childrenRenderBounds, renderBounds);
9130
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
9131
+ const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
9132
+ super.__updateRenderBounds(childrenRenderBounds);
9133
+ scroll(childrenRenderBounds, data);
9047
9134
  this.__updateRectRenderBounds();
9048
- if (data.scrollY || data.scrollX) {
9049
- childrenRenderBounds.x += data.scrollX;
9050
- childrenRenderBounds.y += data.scrollY;
9051
- }
9052
9135
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
9053
- if (isOverflow && data.overflow !== "hide") add(renderBounds, childrenRenderBounds);
9136
+ if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
9054
9137
  } else this.__updateRectRenderBounds();
9055
9138
  DataHelper.stintSet(this, "isOverflow", isOverflow);
9056
- this.__updateScrollBar();
9139
+ this.__checkScroll();
9057
9140
  }
9058
9141
  __updateRectRenderBounds() {}
9059
- __updateScrollBar() {}
9142
+ __updateWorldBounds() {
9143
+ if (this.hasScroller) this.__updateScroll();
9144
+ super.__updateWorldBounds();
9145
+ }
9146
+ __checkScroll() {}
9147
+ __updateScroll() {}
9060
9148
  __updateRectChange() {}
9061
9149
  __updateChange() {
9062
9150
  super.__updateChange();
@@ -9071,7 +9159,7 @@ let Box = class Box extends Group {
9071
9159
  this.__renderRect(canvas, options);
9072
9160
  if (this.children.length) this.__renderGroup(canvas, options);
9073
9161
  }
9074
- if (this.scrollBar) this.scrollBar.__render(canvas, options);
9162
+ if (this.hasScroller) this.scroller.__render(canvas, options);
9075
9163
  }
9076
9164
  __drawContent(canvas, options) {
9077
9165
  this.__renderGroup(canvas, options);
@@ -9441,7 +9529,7 @@ let Text = class Text extends UI {
9441
9529
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
9442
9530
  data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
9443
9531
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
9444
- data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize}px ${fontFamily}`;
9532
+ data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
9445
9533
  data.__clipText = textOverflow !== "show" && !data.__autoSize;
9446
9534
  data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
9447
9535
  }
@@ -9744,7 +9832,7 @@ let App = class App extends Leafer {
9744
9832
  if (this.viewReady) this.renderer.update();
9745
9833
  }
9746
9834
  __render(canvas, options) {
9747
- if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
9835
+ if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
9748
9836
  }
9749
9837
  __onResize(event) {
9750
9838
  this.forEach(leafer => leafer.resize(event));
@@ -9912,26 +10000,11 @@ let DragEvent$1 = class DragEvent extends PointerEvent$1 {
9912
10000
  const move = leaf.getLocalPoint(total, null, true);
9913
10001
  PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9914
10002
  if (checkLimit) this.limitMove(leaf, move);
10003
+ DragBoundsHelper.axisMove(leaf, move);
9915
10004
  return move;
9916
10005
  }
9917
10006
  static limitMove(leaf, move) {
9918
- const {draggable: draggable, dragBounds: dragBounds} = leaf;
9919
- if (dragBounds) this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, move, true);
9920
- if (draggable === "x") move.y = 0;
9921
- if (draggable === "y") move.x = 0;
9922
- }
9923
- static getMoveInDragBounds(childBox, dragBounds, move, change) {
9924
- const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9925
- const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9926
- if (!change) move = Object.assign({}, move);
9927
- if (BoundsHelper.includes(childBox, dragBounds)) {
9928
- if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
9929
- if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
9930
- } else {
9931
- if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
9932
- if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
9933
- }
9934
- return move;
10007
+ DragBoundsHelper.limitMove(leaf, move);
9935
10008
  }
9936
10009
  getPageMove(total) {
9937
10010
  this.assignMove(total);
@@ -10216,11 +10289,12 @@ class Dragger {
10216
10289
  const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
10217
10290
  list.forEach(leaf => {
10218
10291
  if (leaf.draggable) {
10292
+ const axisDrag = isString(leaf.draggable);
10219
10293
  const move = DragEvent$1.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
10220
10294
  x: totalX,
10221
10295
  y: totalY
10222
- }, checkLimitMove);
10223
- if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
10296
+ }, checkLimitMove || axisDrag);
10297
+ if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
10224
10298
  }
10225
10299
  });
10226
10300
  }
@@ -11585,18 +11659,22 @@ const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIn
11585
11659
 
11586
11660
  function shape(ui, current, options) {
11587
11661
  const canvas = current.getSameCanvas();
11588
- const nowWorld = ui.__nowWorld;
11662
+ const nowWorld = ui.__nowWorld, currentBounds = current.bounds;
11589
11663
  let bounds, matrix, fitMatrix, shapeBounds, worldCanvas;
11590
- let {scaleX: scaleX, scaleY: scaleY} = nowWorld;
11591
- if (scaleX < 0) scaleX = -scaleX;
11592
- if (scaleY < 0) scaleY = -scaleY;
11593
- if (current.bounds.includes(nowWorld)) {
11664
+ let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
11665
+ if (currentBounds.includes(nowWorld)) {
11594
11666
  worldCanvas = canvas;
11595
11667
  bounds = shapeBounds = nowWorld;
11596
11668
  } else {
11597
11669
  const {renderShapeSpread: spread} = ui.__layout;
11598
- const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [ spread * scaleY, spread * scaleX ]) : current.bounds, nowWorld);
11599
- fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
11670
+ let worldClipBounds;
11671
+ if (Platform.fullImageShadow) {
11672
+ worldClipBounds = nowWorld;
11673
+ } else {
11674
+ const spreadBounds = spread ? getSpread(currentBounds, scaleX === scaleY ? spread * scaleX : [ spread * scaleY, spread * scaleX ]) : currentBounds;
11675
+ worldClipBounds = getIntersectData(spreadBounds, nowWorld);
11676
+ }
11677
+ fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
11600
11678
  let {a: fitScaleX, d: fitScaleY} = fitMatrix;
11601
11679
  if (fitMatrix.a < 1) {
11602
11680
  worldCanvas = current.getSameCanvas();
@@ -12303,7 +12381,7 @@ function shadow(ui, current, shape) {
12303
12381
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
12304
12382
  }
12305
12383
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12306
- if (end && index < end) other.clearWorld(copyBounds, true);
12384
+ if (end && index < end) other.clearWorld(copyBounds);
12307
12385
  });
12308
12386
  other.recycle(copyBounds);
12309
12387
  }
@@ -12367,7 +12445,7 @@ function innerShadow(ui, current, shape) {
12367
12445
  }
12368
12446
  other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
12369
12447
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12370
- if (end && index < end) other.clearWorld(copyBounds, true);
12448
+ if (end && index < end) other.clearWorld(copyBounds);
12371
12449
  });
12372
12450
  other.recycle(copyBounds);
12373
12451
  }
@@ -12466,7 +12544,7 @@ function copyContent(leaf, canvas, content, maskOpacity, blendMode, recycle) {
12466
12544
  canvas.resetTransform();
12467
12545
  canvas.opacity = maskOpacity;
12468
12546
  canvas.copyWorld(content, realBounds, undefined, blendMode);
12469
- recycle ? content.recycle(realBounds) : content.clearWorld(realBounds, true);
12547
+ recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
12470
12548
  }
12471
12549
 
12472
12550
  const money = "¥¥$€££¢¢";
@@ -13014,4 +13092,4 @@ Object.assign(Creator, {
13014
13092
 
13015
13093
  useCanvas();
13016
13094
 
13017
- 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, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, 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, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
13095
+ 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, 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, 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, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };