leafer-ui 1.9.1 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,10 @@ const BoundsHelper = {
1191
1190
  t.x += x;
1192
1191
  t.y += y;
1193
1192
  },
1193
+ scroll(t, data) {
1194
+ t.x += data.scrollX;
1195
+ t.y += data.scrollY;
1196
+ },
1194
1197
  getByMove(t, x, y) {
1195
1198
  t = Object.assign({}, t);
1196
1199
  B.move(t, x, y);
@@ -1200,7 +1203,7 @@ const BoundsHelper = {
1200
1203
  if (!to) {
1201
1204
  to = t;
1202
1205
  } else {
1203
- copy$a(to, t);
1206
+ copy$9(to, t);
1204
1207
  }
1205
1208
  if (parent) {
1206
1209
  to.offsetX = -(B.maxX(parent) - t.x);
@@ -1352,7 +1355,7 @@ const BoundsHelper = {
1352
1355
  if (bounds && (bounds.width || bounds.height)) {
1353
1356
  if (first) {
1354
1357
  first = false;
1355
- if (!addMode) copy$a(t, bounds);
1358
+ if (!addMode) copy$9(t, bounds);
1356
1359
  } else {
1357
1360
  add$1(t, bounds);
1358
1361
  }
@@ -1439,7 +1442,7 @@ const BoundsHelper = {
1439
1442
 
1440
1443
  const B = BoundsHelper;
1441
1444
 
1442
- const {add: add$1, copy: copy$a} = B;
1445
+ const {add: add$1, copy: copy$9} = B;
1443
1446
 
1444
1447
  class Bounds {
1445
1448
  get minX() {
@@ -1654,17 +1657,17 @@ class Debug {
1654
1657
  showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
1655
1658
  }
1656
1659
  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;
1660
+ if (D$5.enable) {
1661
+ if (D$5.filterList.length && D$5.filterList.every(name => name !== this.name)) return;
1662
+ if (D$5.excludeList.length && D$5.excludeList.some(name => name === this.name)) return;
1660
1663
  console.log("%c" + this.name, "color:#21ae62", ...messages);
1661
1664
  }
1662
1665
  }
1663
1666
  tip(...messages) {
1664
- if (D$4.enable) this.warn(...messages);
1667
+ if (D$5.enable) this.warn(...messages);
1665
1668
  }
1666
1669
  warn(...messages) {
1667
- if (D$4.showWarn) console.warn(this.name, ...messages);
1670
+ if (D$5.showWarn) console.warn(this.name, ...messages);
1668
1671
  }
1669
1672
  repeat(name, ...messages) {
1670
1673
  if (!this.repeatMap[name]) {
@@ -1692,7 +1695,7 @@ function getNameList(name) {
1692
1695
  return name;
1693
1696
  }
1694
1697
 
1695
- const D$4 = Debug;
1698
+ const D$5 = Debug;
1696
1699
 
1697
1700
  const debug$g = Debug.get("RunTime");
1698
1701
 
@@ -2137,7 +2140,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
2137
2140
 
2138
2141
  __decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
2139
2142
 
2140
- const {copy: copy$9, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math;
2143
+ const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2141
2144
 
2142
2145
  const minSize = {
2143
2146
  width: 1,
@@ -2302,44 +2305,44 @@ class LeaferCanvasBase extends Canvas$1 {
2302
2305
  const {pixelRatio: pixelRatio} = this;
2303
2306
  this.filter = `blur(${blur * pixelRatio}px)`;
2304
2307
  }
2305
- copyWorld(canvas, from, to, blendMode) {
2308
+ copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
2306
2309
  if (blendMode) this.blendMode = blendMode;
2307
2310
  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);
2311
+ this.setTempPixelBounds(from, ceilPixel);
2312
+ if (!to) to = tempPixelBounds; else this.setTempPixelBounds2(to, ceilPixel), to = tempPixelBounds2;
2313
+ this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, to.x, to.y, to.width, to.height);
2311
2314
  } else {
2312
2315
  this.drawImage(canvas.view, 0, 0);
2313
2316
  }
2314
2317
  if (blendMode) this.blendMode = "source-over";
2315
2318
  }
2316
- copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode) {
2317
- if (blendMode) this.blendMode = blendMode;
2319
+ copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
2318
2320
  if (fromWorld.b || fromWorld.c) {
2319
2321
  this.save();
2320
2322
  this.resetTransform();
2321
- this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld));
2323
+ this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld), blendMode, ceilPixel);
2322
2324
  this.restore();
2323
2325
  } 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);
2326
+ if (blendMode) this.blendMode = blendMode;
2327
+ this.setTempPixelBounds(fromWorld, ceilPixel);
2328
+ this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
2329
+ if (blendMode) this.blendMode = "source-over";
2326
2330
  }
2327
- if (blendMode) this.blendMode = "source-over";
2328
2331
  }
2329
- copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform) {
2332
+ copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
2330
2333
  this.resetTransform();
2331
- this.copyWorld(canvas, from, to, blendMode);
2334
+ this.copyWorld(canvas, from, to, blendMode, ceilPixel);
2332
2335
  if (!onlyResetTransform) this.useWorldTransform();
2333
2336
  }
2334
2337
  useGrayscaleAlpha(bounds) {
2335
- this.setTempBounds(bounds, true, true);
2338
+ this.setTempPixelBounds(bounds, true, true);
2336
2339
  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;
2340
+ const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
2338
2341
  for (let i = 0, len = data.length; i < len; i += 4) {
2339
2342
  pixel = data[i] * .299 + data[i + 1] * .587 + data[i + 2] * .114;
2340
2343
  if (alpha = data[i + 3]) data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
2341
2344
  }
2342
- context.putImageData(imageData, tempBounds$1.x, tempBounds$1.y);
2345
+ context.putImageData(imageData, tempPixelBounds.x, tempPixelBounds.y);
2343
2346
  }
2344
2347
  useMask(maskCanvas, fromBounds, toBounds) {
2345
2348
  this.copyWorld(maskCanvas, fromBounds, toBounds, "destination-in");
@@ -2347,42 +2350,48 @@ class LeaferCanvasBase extends Canvas$1 {
2347
2350
  useEraser(eraserCanvas, fromBounds, toBounds) {
2348
2351
  this.copyWorld(eraserCanvas, fromBounds, toBounds, "destination-out");
2349
2352
  }
2350
- fillWorld(bounds, color, blendMode) {
2353
+ fillWorld(bounds, color, blendMode, ceilPixel) {
2351
2354
  if (blendMode) this.blendMode = blendMode;
2352
2355
  this.fillStyle = color;
2353
- this.setTempBounds(bounds);
2354
- this.fillRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2356
+ this.setTempPixelBounds(bounds, ceilPixel);
2357
+ this.fillRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2355
2358
  if (blendMode) this.blendMode = "source-over";
2356
2359
  }
2357
- strokeWorld(bounds, color, blendMode) {
2360
+ strokeWorld(bounds, color, blendMode, ceilPixel) {
2358
2361
  if (blendMode) this.blendMode = blendMode;
2359
2362
  this.strokeStyle = color;
2360
- this.setTempBounds(bounds);
2361
- this.strokeRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2363
+ this.setTempPixelBounds(bounds, ceilPixel);
2364
+ this.strokeRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2362
2365
  if (blendMode) this.blendMode = "source-over";
2363
2366
  }
2364
- clipWorld(bounds, ceilPixel) {
2367
+ clipWorld(bounds, ceilPixel = true) {
2365
2368
  this.beginPath();
2366
- this.setTempBounds(bounds, ceilPixel);
2367
- this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2369
+ this.setTempPixelBounds(bounds, ceilPixel);
2370
+ this.rect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2368
2371
  this.clip();
2369
2372
  }
2370
2373
  clipUI(ruleData) {
2371
2374
  ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
2372
2375
  }
2373
- clearWorld(bounds, ceilPixel) {
2374
- this.setTempBounds(bounds, ceilPixel);
2375
- this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2376
+ clearWorld(bounds, ceilPixel = true) {
2377
+ this.setTempPixelBounds(bounds, ceilPixel);
2378
+ this.clearRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2376
2379
  }
2377
2380
  clear() {
2378
2381
  const {pixelRatio: pixelRatio} = this;
2379
2382
  this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
2380
2383
  }
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();
2384
+ setTempPixelBounds(bounds, ceil, intersect) {
2385
+ this.copyToPixelBounds(tempPixelBounds, bounds, ceil, intersect);
2386
+ }
2387
+ setTempPixelBounds2(bounds, ceil, intersect) {
2388
+ this.copyToPixelBounds(tempPixelBounds2, bounds, ceil, intersect);
2389
+ }
2390
+ copyToPixelBounds(pixelBounds, bounds, ceil, intersect) {
2391
+ pixelBounds.set(bounds);
2392
+ if (intersect) pixelBounds.intersect(this.bounds);
2393
+ pixelBounds.scale(this.pixelRatio);
2394
+ if (ceil) pixelBounds.ceil();
2386
2395
  }
2387
2396
  isSameSize(size) {
2388
2397
  return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
@@ -2390,7 +2399,7 @@ class LeaferCanvasBase extends Canvas$1 {
2390
2399
  getSameCanvas(useSameWorldTransform, useSameSmooth) {
2391
2400
  const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
2392
2401
  canvas.save();
2393
- if (useSameWorldTransform) copy$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2402
+ if (useSameWorldTransform) copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2394
2403
  if (useSameSmooth) canvas.smooth = this.smooth;
2395
2404
  canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
2396
2405
  return canvas;
@@ -2398,7 +2407,7 @@ class LeaferCanvasBase extends Canvas$1 {
2398
2407
  recycle(clearBounds) {
2399
2408
  if (!this.recycled) {
2400
2409
  this.restore();
2401
- clearBounds ? this.clearWorld(clearBounds, true) : this.clear();
2410
+ clearBounds ? this.clearWorld(clearBounds) : this.clear();
2402
2411
  this.manager ? this.manager.recycle(this) : this.destroy();
2403
2412
  }
2404
2413
  }
@@ -2779,7 +2788,7 @@ const EllipseHelper = {
2779
2788
  }
2780
2789
  };
2781
2790
 
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;
2791
+ 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
2792
 
2784
2793
  const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2785
2794
 
@@ -2999,7 +3008,7 @@ const PathConvert = {
2999
3008
  i += 5;
3000
3009
  break;
3001
3010
 
3002
- case D$3:
3011
+ case D$4:
3003
3012
  x = old[i + 1];
3004
3013
  y = old[i + 2];
3005
3014
  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 +3109,7 @@ const PathConvert = {
3100
3109
 
3101
3110
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
3102
3111
 
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;
3112
+ 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
3113
 
3105
3114
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3106
3115
 
@@ -3136,7 +3145,7 @@ const PathCommandDataHelper = {
3136
3145
  } else {
3137
3146
  const fourCorners = MathHelper.fourNumber(cornerRadius);
3138
3147
  if (fourCorners) {
3139
- data.push(D$2, x, y, width, height, ...fourCorners);
3148
+ data.push(D$3, x, y, width, height, ...fourCorners);
3140
3149
  } else {
3141
3150
  data.push(N$2, x, y, width, height);
3142
3151
  }
@@ -3279,7 +3288,7 @@ class PathCreator {
3279
3288
  paint() {}
3280
3289
  }
3281
3290
 
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;
3291
+ 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
3292
 
3284
3293
  const debug$c = Debug.get("PathDrawer");
3285
3294
 
@@ -3321,7 +3330,7 @@ const PathDrawer = {
3321
3330
  i += 5;
3322
3331
  break;
3323
3332
 
3324
- case D$1:
3333
+ case D$2:
3325
3334
  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
3335
  i += 9;
3327
3336
  break;
@@ -3364,11 +3373,11 @@ const PathDrawer = {
3364
3373
  }
3365
3374
  };
3366
3375
 
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;
3376
+ 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
3377
 
3369
3378
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3370
3379
 
3371
- const {addPointBounds: addPointBounds, copy: copy$8, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3380
+ const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3372
3381
 
3373
3382
  const debug$b = Debug.get("PathBounds");
3374
3383
 
@@ -3440,17 +3449,17 @@ const PathBounds = {
3440
3449
  i += 5;
3441
3450
  break;
3442
3451
 
3443
- case D:
3452
+ case D$1:
3444
3453
  case X:
3445
3454
  x = data[i + 1];
3446
3455
  y = data[i + 2];
3447
3456
  addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
3448
- i += command === D ? 9 : 6;
3457
+ i += command === D$1 ? 9 : 6;
3449
3458
  break;
3450
3459
 
3451
3460
  case G:
3452
3461
  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);
3462
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3454
3463
  x = setEndPoint.x;
3455
3464
  y = setEndPoint.y;
3456
3465
  i += 9;
@@ -3468,7 +3477,7 @@ const PathBounds = {
3468
3477
 
3469
3478
  case O:
3470
3479
  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);
3480
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3472
3481
  x = setEndPoint.x;
3473
3482
  y = setEndPoint.y;
3474
3483
  i += 7;
@@ -3485,7 +3494,7 @@ const PathBounds = {
3485
3494
 
3486
3495
  case U:
3487
3496
  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);
3497
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3489
3498
  x = setEndPoint.x;
3490
3499
  y = setEndPoint.y;
3491
3500
  i += 6;
@@ -4138,6 +4147,17 @@ function positionType(defaultValue, checkFiniteNumber) {
4138
4147
  }));
4139
4148
  }
4140
4149
 
4150
+ function scrollType(defaultValue, checkFiniteNumber) {
4151
+ return decorateLeafAttr(defaultValue, key => attr({
4152
+ set(value) {
4153
+ if (this.__setAttr(key, value, checkFiniteNumber)) {
4154
+ this.__layout.matrixChanged || this.__layout.matrixChange();
4155
+ this.__scrollWorld || (this.__scrollWorld = {});
4156
+ }
4157
+ }
4158
+ }));
4159
+ }
4160
+
4141
4161
  function autoLayoutType(defaultValue) {
4142
4162
  return decorateLeafAttr(defaultValue, key => attr({
4143
4163
  set(value) {
@@ -4476,7 +4496,7 @@ function registerUIEvent() {
4476
4496
  };
4477
4497
  }
4478
4498
 
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;
4499
+ 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
4500
 
4481
4501
  const matrix$1 = {}, {round: round} = Math;
4482
4502
 
@@ -4552,7 +4572,7 @@ const LeafHelper = {
4552
4572
  x: x,
4553
4573
  y: y
4554
4574
  };
4555
- isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true);
4575
+ isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
4556
4576
  L.moveLocal(t, local.x, local.y, transition);
4557
4577
  },
4558
4578
  moveLocal(t, x, y = 0, transition) {
@@ -4574,9 +4594,9 @@ const LeafHelper = {
4574
4594
  if (scaleY) transition = scaleY;
4575
4595
  scaleY = scaleX;
4576
4596
  }
4577
- copy$7(matrix$1, o);
4597
+ copy$6(matrix$1, o);
4578
4598
  scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4579
- if (t.origin || t.around) {
4599
+ if (L.hasHighPosition(t)) {
4580
4600
  L.setTransform(t, matrix$1, resize, transition);
4581
4601
  } else {
4582
4602
  const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
@@ -4593,9 +4613,9 @@ const LeafHelper = {
4593
4613
  },
4594
4614
  rotateOfLocal(t, origin, angle, transition) {
4595
4615
  const o = t.__localMatrix;
4596
- copy$7(matrix$1, o);
4616
+ copy$6(matrix$1, o);
4597
4617
  rotateOfOuter$2(matrix$1, origin, angle);
4598
- if (t.origin || t.around) L.setTransform(t, matrix$1, false, transition); else t.set({
4618
+ if (L.hasHighPosition(t)) L.setTransform(t, matrix$1, false, transition); else t.set({
4599
4619
  x: t.x + matrix$1.e - o.e,
4600
4620
  y: t.y + matrix$1.f - o.f,
4601
4621
  rotation: MathHelper.formatRotation(t.rotation + angle)
@@ -4605,24 +4625,28 @@ const LeafHelper = {
4605
4625
  L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4606
4626
  },
4607
4627
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4608
- copy$7(matrix$1, t.__localMatrix);
4628
+ copy$6(matrix$1, t.__localMatrix);
4609
4629
  skewOfOuter(matrix$1, origin, skewX, skewY);
4610
4630
  L.setTransform(t, matrix$1, resize, transition);
4611
4631
  },
4612
4632
  transformWorld(t, transform, resize, transition) {
4613
- copy$7(matrix$1, t.worldTransform);
4633
+ copy$6(matrix$1, t.worldTransform);
4614
4634
  multiplyParent$3(matrix$1, transform);
4615
- if (t.parent) divideParent(matrix$1, t.parent.worldTransform);
4635
+ if (t.parent) divideParent(matrix$1, t.parent.scrollWorldTransform);
4616
4636
  L.setTransform(t, matrix$1, resize, transition);
4617
4637
  },
4618
4638
  transform(t, transform, resize, transition) {
4619
- copy$7(matrix$1, t.localTransform);
4639
+ copy$6(matrix$1, t.localTransform);
4620
4640
  multiplyParent$3(matrix$1, transform);
4621
4641
  L.setTransform(t, matrix$1, resize, transition);
4622
4642
  },
4623
4643
  setTransform(t, transform, resize, transition) {
4624
4644
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
4625
4645
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
4646
+ if (L.hasOffset(t)) {
4647
+ layout.x -= data.offsetX;
4648
+ layout.y -= data.offsetY;
4649
+ }
4626
4650
  if (resize) {
4627
4651
  const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
4628
4652
  delete layout.scaleX, delete layout.scaleY;
@@ -4650,14 +4674,20 @@ const LeafHelper = {
4650
4674
  return innerOrigin;
4651
4675
  },
4652
4676
  getRelativeWorld(t, relative, temp) {
4653
- copy$7(matrix$1, t.worldTransform);
4654
- divideParent(matrix$1, relative.worldTransform);
4677
+ copy$6(matrix$1, t.worldTransform);
4678
+ divideParent(matrix$1, relative.scrollWorldTransform);
4655
4679
  return temp ? matrix$1 : Object.assign({}, matrix$1);
4656
4680
  },
4657
4681
  drop(t, parent, index, resize) {
4658
4682
  t.setTransform(L.getRelativeWorld(t, parent, true), resize);
4659
4683
  parent.add(t, index);
4660
4684
  },
4685
+ hasHighPosition(t) {
4686
+ return t.origin || t.around || L.hasOffset(t);
4687
+ },
4688
+ hasOffset(t) {
4689
+ return t.offsetX || t.offsetY;
4690
+ },
4661
4691
  hasParent(p, parent) {
4662
4692
  if (!parent) return false;
4663
4693
  while (p) {
@@ -4683,8 +4713,7 @@ const L = LeafHelper;
4683
4713
  const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
4684
4714
 
4685
4715
  function getTempLocal(t, world) {
4686
- t.__layout.update();
4687
- return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
4716
+ return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
4688
4717
  }
4689
4718
 
4690
4719
  const LeafBoundsHelper = {
@@ -4809,7 +4838,7 @@ const WaitHelper = {
4809
4838
 
4810
4839
  const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
4811
4840
 
4812
- const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$6} = BoundsHelper;
4841
+ const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$5} = BoundsHelper;
4813
4842
 
4814
4843
  const localContent = "_localContentBounds";
4815
4844
 
@@ -5048,7 +5077,7 @@ class LeafLayout {
5048
5077
  matrix = getRelativeWorld$1(leaf, relative, true);
5049
5078
  }
5050
5079
  if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
5051
- copy$6(layoutBounds, bounds);
5080
+ copy$5(layoutBounds, bounds);
5052
5081
  PointHelper.copy(layoutBounds, point);
5053
5082
  if (unscale) {
5054
5083
  const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
@@ -5236,6 +5265,8 @@ ChildEvent.UNMOUNTED = "unmounted";
5236
5265
 
5237
5266
  ChildEvent.DESTROY = "destroy";
5238
5267
 
5268
+ const SCROLL = "property.scroll";
5269
+
5239
5270
  class PropertyEvent extends Event {
5240
5271
  constructor(type, target, attrName, oldValue, newValue) {
5241
5272
  super(type, target);
@@ -5249,6 +5280,13 @@ PropertyEvent.CHANGE = "property.change";
5249
5280
 
5250
5281
  PropertyEvent.LEAFER_CHANGE = "property.leafer_change";
5251
5282
 
5283
+ PropertyEvent.SCROLL = SCROLL;
5284
+
5285
+ const extraPropertyEventMap = {
5286
+ scrollX: SCROLL,
5287
+ scrollY: SCROLL
5288
+ };
5289
+
5252
5290
  class ImageEvent extends Event {
5253
5291
  constructor(type, data) {
5254
5292
  super(type);
@@ -5524,7 +5562,9 @@ class Eventer {
5524
5562
  if (!id) return;
5525
5563
  const list = isArray(id) ? id : [ id ];
5526
5564
  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);
5565
+ if (item) {
5566
+ 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
+ }
5528
5568
  });
5529
5569
  list.length = 0;
5530
5570
  }
@@ -5618,8 +5658,6 @@ const LeafDataProxy = {
5618
5658
  }
5619
5659
  if (isObject(newValue) || oldValue !== newValue) {
5620
5660
  this.__realSetAttr(name, newValue);
5621
- const {CHANGE: CHANGE} = PropertyEvent;
5622
- const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
5623
5661
  if (this.isLeafer) {
5624
5662
  this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
5625
5663
  const transformEventName = leaferTransformAttrMap[name];
@@ -5627,10 +5665,10 @@ const LeafDataProxy = {
5627
5665
  this.emitEvent(new LeaferEvent(transformEventName, this));
5628
5666
  this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this));
5629
5667
  }
5630
- } else {
5631
- if (this.hasEvent(CHANGE)) this.emitEvent(event);
5632
5668
  }
5633
- this.leafer.emitEvent(event);
5669
+ this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue);
5670
+ const extraPropertyEvent = extraPropertyEventMap[name];
5671
+ if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue);
5634
5672
  return true;
5635
5673
  } else {
5636
5674
  return false;
@@ -5640,6 +5678,11 @@ const LeafDataProxy = {
5640
5678
  return true;
5641
5679
  }
5642
5680
  },
5681
+ emitPropertyEvent(type, name, oldValue, newValue) {
5682
+ const event = new PropertyEvent(type, this, name, oldValue, newValue);
5683
+ this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
5684
+ this.leafer.emitEvent(event);
5685
+ },
5643
5686
  __realSetAttr(name, newValue) {
5644
5687
  const data = this.__;
5645
5688
  data[name] = newValue;
@@ -5658,8 +5701,9 @@ const {toPoint: toPoint$3, tempPoint: tempPoint} = AroundHelper;
5658
5701
 
5659
5702
  const LeafMatrix = {
5660
5703
  __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.__);
5704
+ const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
5705
+ multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
5706
+ if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
5663
5707
  },
5664
5708
  __updateLocalMatrix() {
5665
5709
  if (this.__local) {
@@ -5685,7 +5729,7 @@ const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafH
5685
5729
 
5686
5730
  const {updateBounds: updateBounds$1} = BranchHelper;
5687
5731
 
5688
- const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5} = BoundsHelper;
5732
+ const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4} = BoundsHelper;
5689
5733
 
5690
5734
  const {toBounds: toBounds$1} = PathBounds;
5691
5735
 
@@ -5756,7 +5800,7 @@ const LeafBounds = {
5756
5800
  __updateLocalRenderBounds() {
5757
5801
  toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
5758
5802
  },
5759
- __updateBoxBounds() {
5803
+ __updateBoxBounds(_secondLayout, _bounds) {
5760
5804
  const b = this.__layout.boxBounds;
5761
5805
  const data = this.__;
5762
5806
  if (data.__pathInputed) {
@@ -5790,13 +5834,13 @@ const LeafBounds = {
5790
5834
  data.__naturalWidth = layout.boxBounds.width;
5791
5835
  data.__naturalHeight = layout.boxBounds.height;
5792
5836
  },
5793
- __updateStrokeBounds() {
5837
+ __updateStrokeBounds(_bounds) {
5794
5838
  const layout = this.__layout;
5795
5839
  copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5796
5840
  },
5797
- __updateRenderBounds() {
5841
+ __updateRenderBounds(_bounds) {
5798
5842
  const layout = this.__layout;
5799
- layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5843
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
5800
5844
  }
5801
5845
  };
5802
5846
 
@@ -5895,7 +5939,7 @@ const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: m
5895
5939
 
5896
5940
  const {toOuterOf: toOuterOf} = BoundsHelper;
5897
5941
 
5898
- const {copy: copy$4, move: move} = PointHelper;
5942
+ const {copy: copy$3, move: move} = PointHelper;
5899
5943
 
5900
5944
  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
5945
 
@@ -5943,6 +5987,10 @@ let Leaf = class Leaf {
5943
5987
  get localTransform() {
5944
5988
  return this.__layout.getTransform("local");
5945
5989
  }
5990
+ get scrollWorldTransform() {
5991
+ this.updateLayout();
5992
+ return this.__scrollWorld || this.__world;
5993
+ }
5946
5994
  get boxBounds() {
5947
5995
  return this.getBounds("box", "inner");
5948
5996
  }
@@ -5959,7 +6007,7 @@ let Leaf = class Leaf {
5959
6007
  return this.getBounds("render");
5960
6008
  }
5961
6009
  get worldOpacity() {
5962
- this.__layout.update();
6010
+ this.updateLayout();
5963
6011
  return this.__worldOpacity;
5964
6012
  }
5965
6013
  get __worldFlipped() {
@@ -6134,10 +6182,10 @@ let Leaf = class Leaf {
6134
6182
  __updateLocalBoxBounds() {}
6135
6183
  __updateLocalStrokeBounds() {}
6136
6184
  __updateLocalRenderBounds() {}
6137
- __updateBoxBounds() {}
6185
+ __updateBoxBounds(_secondLayout, _bounds) {}
6138
6186
  __updateContentBounds() {}
6139
- __updateStrokeBounds() {}
6140
- __updateRenderBounds() {}
6187
+ __updateStrokeBounds(_bounds) {}
6188
+ __updateRenderBounds(_bounds) {}
6141
6189
  __updateAutoLayout() {}
6142
6190
  __updateFlowLayout() {}
6143
6191
  __updateNaturalSize() {}
@@ -6209,14 +6257,14 @@ let Leaf = class Leaf {
6209
6257
  if (this.parent) {
6210
6258
  this.parent.worldToInner(world, to, distance, relative);
6211
6259
  } else {
6212
- if (to) copy$4(to, world);
6260
+ if (to) copy$3(to, world);
6213
6261
  }
6214
6262
  }
6215
6263
  localToWorld(local, to, distance, relative) {
6216
6264
  if (this.parent) {
6217
6265
  this.parent.innerToWorld(local, to, distance, relative);
6218
6266
  } else {
6219
- if (to) copy$4(to, local);
6267
+ if (to) copy$3(to, local);
6220
6268
  }
6221
6269
  }
6222
6270
  worldToInner(world, to, distance, relative) {
@@ -6437,14 +6485,14 @@ let Branch = class Branch extends Leaf {
6437
6485
  }
6438
6486
  return 0;
6439
6487
  }
6440
- __updateBoxBounds() {
6441
- setListWithFn(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6488
+ __updateBoxBounds(_secondLayout, bounds) {
6489
+ setListWithFn(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6442
6490
  }
6443
- __updateStrokeBounds() {
6444
- setListWithFn(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6491
+ __updateStrokeBounds(bounds) {
6492
+ setListWithFn(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6445
6493
  }
6446
- __updateRenderBounds() {
6447
- setListWithFn(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6494
+ __updateRenderBounds(bounds) {
6495
+ setListWithFn(bounds || this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6448
6496
  }
6449
6497
  __updateSortChildren() {
6450
6498
  let affectSort;
@@ -6691,7 +6739,7 @@ class LeafLevelList {
6691
6739
  }
6692
6740
  }
6693
6741
 
6694
- const version = "1.9.1";
6742
+ const version = "1.9.3";
6695
6743
 
6696
6744
  const debug$5 = Debug.get("LeaferCanvas");
6697
6745
 
@@ -7406,8 +7454,8 @@ class Renderer {
7406
7454
  const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
7407
7455
  canvas.save();
7408
7456
  bounds.spread(Renderer.clipSpread).ceil();
7409
- canvas.clearWorld(bounds, true);
7410
- canvas.clipWorld(bounds, true);
7457
+ canvas.clearWorld(bounds);
7458
+ canvas.clipWorld(bounds);
7411
7459
  this.__render(bounds, realBounds);
7412
7460
  canvas.restore();
7413
7461
  Run.end(t);
@@ -7630,6 +7678,7 @@ class Picker {
7630
7678
  hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
7631
7679
  if (child.isBranch) {
7632
7680
  if (hit || child.__ignoreHitWorld) {
7681
+ if (child.topChildren) this.eachFind(child.topChildren, false);
7633
7682
  this.eachFind(child.children, child.__onlyHitMask);
7634
7683
  if (child.isBranchLeaf) this.hitChild(child, point);
7635
7684
  }
@@ -7977,7 +8026,7 @@ class BoxData extends GroupData {
7977
8026
  }
7978
8027
  get __clipAfterFill() {
7979
8028
  const t = this;
7980
- return t.overflow === "hide" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
8029
+ return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
7981
8030
  }
7982
8031
  }
7983
8032
 
@@ -8133,6 +8182,41 @@ const UIBounds = {
8133
8182
  }
8134
8183
  };
8135
8184
 
8185
+ const DragBoundsHelper = {
8186
+ getValidMove(content, dragBounds, dragBoundsType, move, change) {
8187
+ const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
8188
+ const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
8189
+ if (!change) move = Object.assign({}, move);
8190
+ const isBiggerWidth = content.width > dragBounds.width;
8191
+ const isBiggerHeight = content.height > dragBounds.height;
8192
+ if (isBiggerWidth && dragBoundsType !== "outer") {
8193
+ if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
8194
+ } else {
8195
+ if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
8196
+ }
8197
+ if (isBiggerHeight && dragBoundsType !== "outer") {
8198
+ if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
8199
+ } else {
8200
+ if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
8201
+ }
8202
+ move.x = MathHelper.float(move.x);
8203
+ move.y = MathHelper.float(move.y);
8204
+ return move;
8205
+ },
8206
+ axisMove(leaf, move) {
8207
+ const {draggable: draggable} = leaf;
8208
+ if (draggable === "x") move.y = 0;
8209
+ if (draggable === "y") move.x = 0;
8210
+ },
8211
+ limitMove(leaf, move) {
8212
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8213
+ if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
8214
+ D.axisMove(leaf, move);
8215
+ }
8216
+ };
8217
+
8218
+ const D = DragBoundsHelper;
8219
+
8136
8220
  const {stintSet: stintSet$1} = DataHelper;
8137
8221
 
8138
8222
  const UIRender = {
@@ -8447,9 +8531,9 @@ __decorate([ positionType(0, true) ], UI.prototype, "offsetX", void 0);
8447
8531
 
8448
8532
  __decorate([ positionType(0, true) ], UI.prototype, "offsetY", void 0);
8449
8533
 
8450
- __decorate([ positionType(0, true) ], UI.prototype, "scrollX", void 0);
8534
+ __decorate([ scrollType(0, true) ], UI.prototype, "scrollX", void 0);
8451
8535
 
8452
- __decorate([ positionType(0, true) ], UI.prototype, "scrollY", void 0);
8536
+ __decorate([ scrollType(0, true) ], UI.prototype, "scrollY", void 0);
8453
8537
 
8454
8538
  __decorate([ autoLayoutType() ], UI.prototype, "origin", void 0);
8455
8539
 
@@ -8479,6 +8563,8 @@ __decorate([ dataType(false) ], UI.prototype, "draggable", void 0);
8479
8563
 
8480
8564
  __decorate([ dataType() ], UI.prototype, "dragBounds", void 0);
8481
8565
 
8566
+ __decorate([ dataType("auto") ], UI.prototype, "dragBoundsType", void 0);
8567
+
8482
8568
  __decorate([ dataType(false) ], UI.prototype, "editable", void 0);
8483
8569
 
8484
8570
  __decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
@@ -8901,7 +8987,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8901
8987
  zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
8902
8988
  return Plugin.need("view");
8903
8989
  }
8904
- getValidMove(moveX, moveY) {
8990
+ getValidMove(moveX, moveY, _checkLimit) {
8905
8991
  return {
8906
8992
  x: moveX,
8907
8993
  y: moveY
@@ -8990,12 +9076,10 @@ __decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
8990
9076
 
8991
9077
  Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], Rect);
8992
9078
 
8993
- const {copy: copy$3, add: add, includes: includes$1} = BoundsHelper;
9079
+ const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
8994
9080
 
8995
9081
  const rect$1 = Rect.prototype, group = Group.prototype;
8996
9082
 
8997
- const childrenRenderBounds = {};
8998
-
8999
9083
  let Box = class Box extends Group {
9000
9084
  get __tag() {
9001
9085
  return "Box";
@@ -9041,22 +9125,27 @@ let Box = class Box extends Group {
9041
9125
  __updateRenderBounds() {
9042
9126
  let isOverflow;
9043
9127
  if (this.children.length) {
9044
- const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} = this.__layout;
9045
- super.__updateRenderBounds();
9046
- copy$3(childrenRenderBounds, renderBounds);
9047
- this.__updateRectRenderBounds();
9048
- if (data.scrollY || data.scrollX) {
9049
- childrenRenderBounds.x += data.scrollX;
9050
- childrenRenderBounds.y += data.scrollY;
9128
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
9129
+ const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
9130
+ super.__updateRenderBounds(childrenRenderBounds);
9131
+ if (data.overflow.includes("scroll")) {
9132
+ add(childrenRenderBounds, boxBounds);
9133
+ scroll(childrenRenderBounds, data);
9051
9134
  }
9135
+ this.__updateRectRenderBounds();
9052
9136
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
9053
- if (isOverflow && data.overflow !== "hide") add(renderBounds, childrenRenderBounds);
9137
+ if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
9054
9138
  } else this.__updateRectRenderBounds();
9055
9139
  DataHelper.stintSet(this, "isOverflow", isOverflow);
9056
- this.__updateScrollBar();
9140
+ this.__checkScroll();
9057
9141
  }
9058
9142
  __updateRectRenderBounds() {}
9059
- __updateScrollBar() {}
9143
+ __updateWorldBounds() {
9144
+ if (this.hasScroller) this.__updateScroll();
9145
+ super.__updateWorldBounds();
9146
+ }
9147
+ __checkScroll() {}
9148
+ __updateScroll() {}
9060
9149
  __updateRectChange() {}
9061
9150
  __updateChange() {
9062
9151
  super.__updateChange();
@@ -9071,7 +9160,7 @@ let Box = class Box extends Group {
9071
9160
  this.__renderRect(canvas, options);
9072
9161
  if (this.children.length) this.__renderGroup(canvas, options);
9073
9162
  }
9074
- if (this.scrollBar) this.scrollBar.__render(canvas, options);
9163
+ if (this.hasScroller) this.scroller.__render(canvas, options);
9075
9164
  }
9076
9165
  __drawContent(canvas, options) {
9077
9166
  this.__renderGroup(canvas, options);
@@ -9744,7 +9833,7 @@ let App = class App extends Leafer {
9744
9833
  if (this.viewReady) this.renderer.update();
9745
9834
  }
9746
9835
  __render(canvas, options) {
9747
- if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
9836
+ if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
9748
9837
  }
9749
9838
  __onResize(event) {
9750
9839
  this.forEach(leafer => leafer.resize(event));
@@ -9912,26 +10001,11 @@ let DragEvent$1 = class DragEvent extends PointerEvent$1 {
9912
10001
  const move = leaf.getLocalPoint(total, null, true);
9913
10002
  PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9914
10003
  if (checkLimit) this.limitMove(leaf, move);
10004
+ DragBoundsHelper.axisMove(leaf, move);
9915
10005
  return move;
9916
10006
  }
9917
10007
  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;
10008
+ DragBoundsHelper.limitMove(leaf, move);
9935
10009
  }
9936
10010
  getPageMove(total) {
9937
10011
  this.assignMove(total);
@@ -10216,11 +10290,12 @@ class Dragger {
10216
10290
  const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
10217
10291
  list.forEach(leaf => {
10218
10292
  if (leaf.draggable) {
10293
+ const axisDrag = isString(leaf.draggable);
10219
10294
  const move = DragEvent$1.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
10220
10295
  x: totalX,
10221
10296
  y: totalY
10222
- }, checkLimitMove);
10223
- if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
10297
+ }, checkLimitMove || axisDrag);
10298
+ if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
10224
10299
  }
10225
10300
  });
10226
10301
  }
@@ -12307,7 +12382,7 @@ function shadow(ui, current, shape) {
12307
12382
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
12308
12383
  }
12309
12384
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12310
- if (end && index < end) other.clearWorld(copyBounds, true);
12385
+ if (end && index < end) other.clearWorld(copyBounds);
12311
12386
  });
12312
12387
  other.recycle(copyBounds);
12313
12388
  }
@@ -12371,7 +12446,7 @@ function innerShadow(ui, current, shape) {
12371
12446
  }
12372
12447
  other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
12373
12448
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12374
- if (end && index < end) other.clearWorld(copyBounds, true);
12449
+ if (end && index < end) other.clearWorld(copyBounds);
12375
12450
  });
12376
12451
  other.recycle(copyBounds);
12377
12452
  }
@@ -12470,7 +12545,7 @@ function copyContent(leaf, canvas, content, maskOpacity, blendMode, recycle) {
12470
12545
  canvas.resetTransform();
12471
12546
  canvas.opacity = maskOpacity;
12472
12547
  canvas.copyWorld(content, realBounds, undefined, blendMode);
12473
- recycle ? content.recycle(realBounds) : content.clearWorld(realBounds, true);
12548
+ recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
12474
12549
  }
12475
12550
 
12476
12551
  const money = "¥¥$€££¢¢";
@@ -13018,4 +13093,4 @@ Object.assign(Creator, {
13018
13093
 
13019
13094
  useCanvas();
13020
13095
 
13021
- 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 };
13096
+ 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 };