@leafer/worker 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$7;
712
- copy$e(temp, t);
711
+ copy$d(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$7;
718
- copy$e(temp, t);
717
+ copy$d(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$7;
724
- copy$e(temp, t);
723
+ copy$d(temp, t);
725
724
  P$7.toInnerRadiusPointOf(t, matrix, temp);
726
725
  return temp;
727
726
  },
@@ -797,7 +796,7 @@ const PointHelper = {
797
796
 
798
797
  const P$7 = PointHelper;
799
798
 
800
- const {getDistanceFrom: getDistanceFrom, copy: copy$e, getAtan2: getAtan2} = P$7;
799
+ const {getDistanceFrom: getDistanceFrom, copy: copy$d, getAtan2: getAtan2} = P$7;
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$d(to, t);
1206
+ copy$c(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$d(t, bounds);
1358
+ if (!addMode) copy$c(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$d} = B;
1445
+ const {add: add$1, copy: copy$c} = 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$6.enable) {
1658
- if (D$6.filterList.length && D$6.filterList.every(name => name !== this.name)) return;
1659
- if (D$6.excludeList.length && D$6.excludeList.some(name => name === this.name)) return;
1660
+ if (D$7.enable) {
1661
+ if (D$7.filterList.length && D$7.filterList.every(name => name !== this.name)) return;
1662
+ if (D$7.excludeList.length && D$7.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$6.enable) this.warn(...messages);
1667
+ if (D$7.enable) this.warn(...messages);
1665
1668
  }
1666
1669
  warn(...messages) {
1667
- if (D$6.showWarn) console.warn(this.name, ...messages);
1670
+ if (D$7.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$6 = Debug;
1698
+ const D$7 = Debug;
1696
1699
 
1697
1700
  const debug$i = 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$c, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math;
2143
+ const {copy: copy$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = 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$c(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2402
+ if (useSameWorldTransform) copy$b(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$8, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$5, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
2791
+ const {M: M$8, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = 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$5:
3011
+ case D$6:
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$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$4, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
3112
+ const {M: M$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$5, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = 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$4, x, y, width, height, ...fourCorners);
3148
+ data.push(D$5, x, y, width, height, ...fourCorners);
3140
3149
  } else {
3141
3150
  data.push(N$4, x, y, width, height);
3142
3151
  }
@@ -3279,7 +3288,7 @@ class PathCreator {
3279
3288
  paint() {}
3280
3289
  }
3281
3290
 
3282
- const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$5, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$4, P: P$3, U: U$3} = PathCommandMap;
3291
+ const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$5, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$4, P: P$3, U: U$3} = PathCommandMap;
3283
3292
 
3284
3293
  const debug$e = Debug.get("PathDrawer");
3285
3294
 
@@ -3321,7 +3330,7 @@ const PathDrawer = {
3321
3330
  i += 5;
3322
3331
  break;
3323
3332
 
3324
- case D$3:
3333
+ case D$4:
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$5, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = PathCommandMap;
3376
+ const {M: M$5, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = 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$b, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$3} = TwoPointBoundsHelper;
3380
+ const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$3} = TwoPointBoundsHelper;
3372
3381
 
3373
3382
  const debug$d = Debug.get("PathBounds");
3374
3383
 
@@ -3440,17 +3449,17 @@ const PathBounds = {
3440
3449
  i += 5;
3441
3450
  break;
3442
3451
 
3443
- case D$2:
3452
+ case D$3:
3444
3453
  case X$2:
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$2 ? 9 : 6;
3457
+ i += command === D$3 ? 9 : 6;
3449
3458
  break;
3450
3459
 
3451
3460
  case G$2:
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$b(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3462
+ i === 0 ? copy$a(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$3:
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$b(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3480
+ i === 0 ? copy$a(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$2:
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$b(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3497
+ i === 0 ? copy$a(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$a, 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$9, 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$3 = {}, {round: round$3} = 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$4.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$a(matrix$3, o);
4597
+ copy$9(matrix$3, o);
4578
4598
  scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
4579
- if (t.origin || t.around) {
4599
+ if (L$4.hasHighPosition(t)) {
4580
4600
  L$4.setTransform(t, matrix$3, resize, transition);
4581
4601
  } else {
4582
4602
  const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.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$a(matrix$3, o);
4616
+ copy$9(matrix$3, o);
4597
4617
  rotateOfOuter$2(matrix$3, origin, angle);
4598
- if (t.origin || t.around) L$4.setTransform(t, matrix$3, false, transition); else t.set({
4618
+ if (L$4.hasHighPosition(t)) L$4.setTransform(t, matrix$3, false, transition); else t.set({
4599
4619
  x: t.x + matrix$3.e - o.e,
4600
4620
  y: t.y + matrix$3.f - o.f,
4601
4621
  rotation: MathHelper.formatRotation(t.rotation + angle)
@@ -4605,24 +4625,28 @@ const LeafHelper = {
4605
4625
  L$4.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4606
4626
  },
4607
4627
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4608
- copy$a(matrix$3, t.__localMatrix);
4628
+ copy$9(matrix$3, t.__localMatrix);
4609
4629
  skewOfOuter(matrix$3, origin, skewX, skewY);
4610
4630
  L$4.setTransform(t, matrix$3, resize, transition);
4611
4631
  },
4612
4632
  transformWorld(t, transform, resize, transition) {
4613
- copy$a(matrix$3, t.worldTransform);
4633
+ copy$9(matrix$3, t.worldTransform);
4614
4634
  multiplyParent$3(matrix$3, transform);
4615
- if (t.parent) divideParent(matrix$3, t.parent.worldTransform);
4635
+ if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
4616
4636
  L$4.setTransform(t, matrix$3, resize, transition);
4617
4637
  },
4618
4638
  transform(t, transform, resize, transition) {
4619
- copy$a(matrix$3, t.localTransform);
4639
+ copy$9(matrix$3, t.localTransform);
4620
4640
  multiplyParent$3(matrix$3, transform);
4621
4641
  L$4.setTransform(t, matrix$3, resize, transition);
4622
4642
  },
4623
4643
  setTransform(t, transform, resize, transition) {
4624
4644
  const data = t.__, originPoint = data.origin && L$4.getInnerOrigin(t, data.origin);
4625
4645
  const layout = getLayout(transform, originPoint, data.around && L$4.getInnerOrigin(t, data.around));
4646
+ if (L$4.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$a(matrix$3, t.worldTransform);
4654
- divideParent(matrix$3, relative.worldTransform);
4677
+ copy$9(matrix$3, t.worldTransform);
4678
+ divideParent(matrix$3, relative.scrollWorldTransform);
4655
4679
  return temp ? matrix$3 : Object.assign({}, matrix$3);
4656
4680
  },
4657
4681
  drop(t, parent, index, resize) {
4658
4682
  t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
4659
4683
  parent.add(t, index);
4660
4684
  },
4685
+ hasHighPosition(t) {
4686
+ return t.origin || t.around || L$4.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$4 = LeafHelper;
4683
4713
  const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$4;
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$3} = LeafHelper;
4811
4840
 
4812
- const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$9} = BoundsHelper;
4841
+ const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$8} = 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$9(layoutBounds, bounds);
5080
+ copy$8(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$4, tempPoint: tempPoint$1} = 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$3, updateAllMatrix: updateAllMatrix$3} = LeafH
5685
5729
 
5686
5730
  const {updateBounds: updateBounds$2} = BranchHelper;
5687
5731
 
5688
- const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$8} = BoundsHelper;
5732
+ const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$7} = BoundsHelper;
5689
5733
 
5690
5734
  const {toBounds: toBounds$2} = 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$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5796
5840
  },
5797
- __updateRenderBounds() {
5841
+ __updateRenderBounds(_bounds) {
5798
5842
  const layout = this.__layout;
5799
- layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$8(layout.renderBounds, layout.strokeBounds);
5843
+ layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$7(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$7, move: move$5} = PointHelper;
5942
+ const {copy: copy$6, move: move$6} = 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$7(to, world);
6260
+ if (to) copy$6(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$7(to, local);
6267
+ if (to) copy$6(to, local);
6220
6268
  }
6221
6269
  }
6222
6270
  worldToInner(world, to, distance, relative) {
@@ -6235,7 +6283,7 @@ let Leaf = class Leaf {
6235
6283
  }
6236
6284
  getBoxPointByInner(inner, _relative, _distance, change) {
6237
6285
  const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
6238
- move$5(point, -x, -y);
6286
+ move$6(point, -x, -y);
6239
6287
  return point;
6240
6288
  }
6241
6289
  getInnerPoint(world, relative, distance, change) {
@@ -6245,7 +6293,7 @@ let Leaf = class Leaf {
6245
6293
  }
6246
6294
  getInnerPointByBox(box, _relative, _distance, change) {
6247
6295
  const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
6248
- move$5(point, x, y);
6296
+ move$6(point, x, y);
6249
6297
  return point;
6250
6298
  }
6251
6299
  getInnerPointByLocal(local, _relative, distance, change) {
@@ -6437,14 +6485,14 @@ let Branch = class Branch extends Leaf {
6437
6485
  }
6438
6486
  return 0;
6439
6487
  }
6440
- __updateBoxBounds() {
6441
- setListWithFn$1(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6488
+ __updateBoxBounds(_secondLayout, bounds) {
6489
+ setListWithFn$1(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6442
6490
  }
6443
- __updateStrokeBounds() {
6444
- setListWithFn$1(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6491
+ __updateStrokeBounds(bounds) {
6492
+ setListWithFn$1(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6445
6493
  }
6446
- __updateRenderBounds() {
6447
- setListWithFn$1(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6494
+ __updateRenderBounds(bounds) {
6495
+ setListWithFn$1(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
  class LeaferCanvas extends LeaferCanvasBase {
6697
6745
  get allowBackgroundColor() {
@@ -7221,8 +7269,8 @@ class Renderer {
7221
7269
  const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
7222
7270
  canvas.save();
7223
7271
  bounds.spread(Renderer.clipSpread).ceil();
7224
- canvas.clearWorld(bounds, true);
7225
- canvas.clipWorld(bounds, true);
7272
+ canvas.clearWorld(bounds);
7273
+ canvas.clipWorld(bounds);
7226
7274
  this.__render(bounds, realBounds);
7227
7275
  canvas.restore();
7228
7276
  Run.end(t);
@@ -7445,6 +7493,7 @@ class Picker {
7445
7493
  hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
7446
7494
  if (child.isBranch) {
7447
7495
  if (hit || child.__ignoreHitWorld) {
7496
+ if (child.topChildren) this.eachFind(child.topChildren, false);
7448
7497
  this.eachFind(child.children, child.__onlyHitMask);
7449
7498
  if (child.isBranchLeaf) this.hitChild(child, point);
7450
7499
  }
@@ -7792,7 +7841,7 @@ class BoxData extends GroupData {
7792
7841
  }
7793
7842
  get __clipAfterFill() {
7794
7843
  const t = this;
7795
- return t.overflow === "hide" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
7844
+ return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
7796
7845
  }
7797
7846
  }
7798
7847
 
@@ -7948,6 +7997,41 @@ const UIBounds = {
7948
7997
  }
7949
7998
  };
7950
7999
 
8000
+ const DragBoundsHelper = {
8001
+ getValidMove(content, dragBounds, dragBoundsType, move, change) {
8002
+ const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
8003
+ const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
8004
+ if (!change) move = Object.assign({}, move);
8005
+ const isBiggerWidth = content.width > dragBounds.width;
8006
+ const isBiggerHeight = content.height > dragBounds.height;
8007
+ if (isBiggerWidth && dragBoundsType !== "outer") {
8008
+ if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
8009
+ } else {
8010
+ if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
8011
+ }
8012
+ if (isBiggerHeight && dragBoundsType !== "outer") {
8013
+ if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
8014
+ } else {
8015
+ if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
8016
+ }
8017
+ move.x = MathHelper.float(move.x);
8018
+ move.y = MathHelper.float(move.y);
8019
+ return move;
8020
+ },
8021
+ axisMove(leaf, move) {
8022
+ const {draggable: draggable} = leaf;
8023
+ if (draggable === "x") move.y = 0;
8024
+ if (draggable === "y") move.x = 0;
8025
+ },
8026
+ limitMove(leaf, move) {
8027
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8028
+ if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
8029
+ D$2.axisMove(leaf, move);
8030
+ }
8031
+ };
8032
+
8033
+ const D$2 = DragBoundsHelper;
8034
+
7951
8035
  const {stintSet: stintSet$1} = DataHelper;
7952
8036
 
7953
8037
  const UIRender = {
@@ -8262,9 +8346,9 @@ __decorate([ positionType(0, true) ], UI.prototype, "offsetX", void 0);
8262
8346
 
8263
8347
  __decorate([ positionType(0, true) ], UI.prototype, "offsetY", void 0);
8264
8348
 
8265
- __decorate([ positionType(0, true) ], UI.prototype, "scrollX", void 0);
8349
+ __decorate([ scrollType(0, true) ], UI.prototype, "scrollX", void 0);
8266
8350
 
8267
- __decorate([ positionType(0, true) ], UI.prototype, "scrollY", void 0);
8351
+ __decorate([ scrollType(0, true) ], UI.prototype, "scrollY", void 0);
8268
8352
 
8269
8353
  __decorate([ autoLayoutType() ], UI.prototype, "origin", void 0);
8270
8354
 
@@ -8294,6 +8378,8 @@ __decorate([ dataType(false) ], UI.prototype, "draggable", void 0);
8294
8378
 
8295
8379
  __decorate([ dataType() ], UI.prototype, "dragBounds", void 0);
8296
8380
 
8381
+ __decorate([ dataType("auto") ], UI.prototype, "dragBoundsType", void 0);
8382
+
8297
8383
  __decorate([ dataType(false) ], UI.prototype, "editable", void 0);
8298
8384
 
8299
8385
  __decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
@@ -8716,7 +8802,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8716
8802
  zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
8717
8803
  return Plugin.need("view");
8718
8804
  }
8719
- getValidMove(moveX, moveY) {
8805
+ getValidMove(moveX, moveY, _checkLimit) {
8720
8806
  return {
8721
8807
  x: moveX,
8722
8808
  y: moveY
@@ -8805,12 +8891,10 @@ __decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
8805
8891
 
8806
8892
  Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], Rect);
8807
8893
 
8808
- const {copy: copy$6, add: add, includes: includes$1} = BoundsHelper;
8894
+ const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
8809
8895
 
8810
8896
  const rect$1 = Rect.prototype, group = Group.prototype;
8811
8897
 
8812
- const childrenRenderBounds = {};
8813
-
8814
8898
  let Box = class Box extends Group {
8815
8899
  get __tag() {
8816
8900
  return "Box";
@@ -8856,22 +8940,27 @@ let Box = class Box extends Group {
8856
8940
  __updateRenderBounds() {
8857
8941
  let isOverflow;
8858
8942
  if (this.children.length) {
8859
- const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} = this.__layout;
8860
- super.__updateRenderBounds();
8861
- copy$6(childrenRenderBounds, renderBounds);
8862
- this.__updateRectRenderBounds();
8863
- if (data.scrollY || data.scrollX) {
8864
- childrenRenderBounds.x += data.scrollX;
8865
- childrenRenderBounds.y += data.scrollY;
8943
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
8944
+ const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8945
+ super.__updateRenderBounds(childrenRenderBounds);
8946
+ if (data.overflow.includes("scroll")) {
8947
+ add(childrenRenderBounds, boxBounds);
8948
+ scroll(childrenRenderBounds, data);
8866
8949
  }
8950
+ this.__updateRectRenderBounds();
8867
8951
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8868
- if (isOverflow && data.overflow !== "hide") add(renderBounds, childrenRenderBounds);
8952
+ if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8869
8953
  } else this.__updateRectRenderBounds();
8870
8954
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8871
- this.__updateScrollBar();
8955
+ this.__checkScroll();
8872
8956
  }
8873
8957
  __updateRectRenderBounds() {}
8874
- __updateScrollBar() {}
8958
+ __updateWorldBounds() {
8959
+ if (this.hasScroller) this.__updateScroll();
8960
+ super.__updateWorldBounds();
8961
+ }
8962
+ __checkScroll() {}
8963
+ __updateScroll() {}
8875
8964
  __updateRectChange() {}
8876
8965
  __updateChange() {
8877
8966
  super.__updateChange();
@@ -8886,7 +8975,7 @@ let Box = class Box extends Group {
8886
8975
  this.__renderRect(canvas, options);
8887
8976
  if (this.children.length) this.__renderGroup(canvas, options);
8888
8977
  }
8889
- if (this.scrollBar) this.scrollBar.__render(canvas, options);
8978
+ if (this.hasScroller) this.scroller.__render(canvas, options);
8890
8979
  }
8891
8980
  __drawContent(canvas, options) {
8892
8981
  this.__renderGroup(canvas, options);
@@ -9559,7 +9648,7 @@ let App = class App extends Leafer {
9559
9648
  if (this.viewReady) this.renderer.update();
9560
9649
  }
9561
9650
  __render(canvas, options) {
9562
- if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
9651
+ if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
9563
9652
  }
9564
9653
  __onResize(event) {
9565
9654
  this.forEach(leafer => leafer.resize(event));
@@ -9727,26 +9816,11 @@ let DragEvent = class DragEvent extends PointerEvent {
9727
9816
  const move = leaf.getLocalPoint(total, null, true);
9728
9817
  PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9729
9818
  if (checkLimit) this.limitMove(leaf, move);
9819
+ DragBoundsHelper.axisMove(leaf, move);
9730
9820
  return move;
9731
9821
  }
9732
9822
  static limitMove(leaf, move) {
9733
- const {draggable: draggable, dragBounds: dragBounds} = leaf;
9734
- if (dragBounds) this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, move, true);
9735
- if (draggable === "x") move.y = 0;
9736
- if (draggable === "y") move.x = 0;
9737
- }
9738
- static getMoveInDragBounds(childBox, dragBounds, move, change) {
9739
- const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9740
- const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9741
- if (!change) move = Object.assign({}, move);
9742
- if (BoundsHelper.includes(childBox, dragBounds)) {
9743
- if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
9744
- if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
9745
- } else {
9746
- if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
9747
- if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
9748
- }
9749
- return move;
9823
+ DragBoundsHelper.limitMove(leaf, move);
9750
9824
  }
9751
9825
  getPageMove(total) {
9752
9826
  this.assignMove(total);
@@ -10031,11 +10105,12 @@ class Dragger {
10031
10105
  const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
10032
10106
  list.forEach(leaf => {
10033
10107
  if (leaf.draggable) {
10108
+ const axisDrag = isString(leaf.draggable);
10034
10109
  const move = DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
10035
10110
  x: totalX,
10036
10111
  y: totalY
10037
- }, checkLimitMove);
10038
- if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
10112
+ }, checkLimitMove || axisDrag);
10113
+ if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
10039
10114
  }
10040
10115
  });
10041
10116
  }
@@ -11794,7 +11869,7 @@ function shadow$1(ui, current, shape) {
11794
11869
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
11795
11870
  }
11796
11871
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11797
- if (end && index < end) other.clearWorld(copyBounds, true);
11872
+ if (end && index < end) other.clearWorld(copyBounds);
11798
11873
  });
11799
11874
  other.recycle(copyBounds);
11800
11875
  }
@@ -11858,7 +11933,7 @@ function innerShadow(ui, current, shape) {
11858
11933
  }
11859
11934
  other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
11860
11935
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11861
- if (end && index < end) other.clearWorld(copyBounds, true);
11936
+ if (end && index < end) other.clearWorld(copyBounds);
11862
11937
  });
11863
11938
  other.recycle(copyBounds);
11864
11939
  }
@@ -11957,7 +12032,7 @@ function copyContent(leaf, canvas, content, maskOpacity, blendMode, recycle) {
11957
12032
  canvas.resetTransform();
11958
12033
  canvas.opacity = maskOpacity;
11959
12034
  canvas.copyWorld(content, realBounds, undefined, blendMode);
11960
- recycle ? content.recycle(realBounds) : content.clearWorld(realBounds, true);
12035
+ recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
11961
12036
  }
11962
12037
 
11963
12038
  const money = "¥¥$€££¢¢";
@@ -13564,7 +13639,7 @@ class EditBox extends Group {
13564
13639
  if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
13565
13640
  }
13566
13641
  onDragEnd(e) {
13567
- if (this.mergeConfig.dragLimitAnimate && this.moving) this.transformTool.onMove(e);
13642
+ if (this.moving) this.transformTool.onMove(e);
13568
13643
  this.dragPoint = null;
13569
13644
  this.resetDoing();
13570
13645
  const {name: name, pointType: pointType} = e.current;
@@ -13597,6 +13672,10 @@ class EditBox extends Group {
13597
13672
  }
13598
13673
  }
13599
13674
  }
13675
+ onMoveEnd(e) {
13676
+ if (this.moving) this.transformTool.onMove(e);
13677
+ this.resetDoing();
13678
+ }
13600
13679
  onScale(e) {
13601
13680
  if (this.canGesture) {
13602
13681
  e.stop();
@@ -13687,7 +13766,7 @@ class EditBox extends Group {
13687
13766
  const {rect: rect, editor: editor, __eventIds: events} = this;
13688
13767
  events.push(rect.on_([ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.ENTER, () => updateMoveCursor(this) ], [ PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
13689
13768
  this.waitLeafer(() => {
13690
- events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ MoveEvent.END, this.resetDoing, this ], [ ZoomEvent.END, this.resetDoing, this ], [ RotateEvent.END, this.resetDoing, this ] ]));
13769
+ events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ MoveEvent.END, this.onMoveEnd, this ], [ ZoomEvent.END, this.resetDoing, this ], [ RotateEvent.END, this.resetDoing, this ] ]));
13691
13770
  });
13692
13771
  }
13693
13772
  __removeListenEvents() {
@@ -13860,7 +13939,7 @@ const EditorHelper = {
13860
13939
  parent.addAt(group, parent.children.indexOf(list[0]));
13861
13940
  list.sort(order);
13862
13941
  const matrx = new Matrix(element.worldTransform);
13863
- matrx.divideParent(parent.worldTransform);
13942
+ matrx.divideParent(parent.scrollWorldTransform);
13864
13943
  group.setTransform(matrx);
13865
13944
  group.editable = true;
13866
13945
  group.hitChildren = false;
@@ -14083,8 +14162,9 @@ class TransformTool {
14083
14162
  const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData, app: app} = this.editBox;
14084
14163
  let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
14085
14164
  if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
14086
- const isMoveEnd = e.type === DragEvent.END || e.type === DragEvent.END;
14087
- const checkLimitMove = !dragLimitAnimate || isMoveEnd;
14165
+ const isMoveEnd = e.type === MoveEvent.END || e.type === DragEvent.END;
14166
+ const axisDrag = isString(target.draggable);
14167
+ const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
14088
14168
  if (e instanceof MoveEvent) {
14089
14169
  move = e.getLocalMove(target);
14090
14170
  if (checkLimitMove) DragEvent.limitMove(target, move);
@@ -14098,7 +14178,9 @@ class TransformTool {
14098
14178
  }
14099
14179
  move = DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
14100
14180
  }
14101
- if (dragLimitAnimate && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
14181
+ if (move.x || move.y) {
14182
+ if (dragLimitAnimate && !axisDrag && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
14183
+ }
14102
14184
  }
14103
14185
  onScale(e) {
14104
14186
  const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
@@ -14373,6 +14455,10 @@ let Editor = class Editor extends Group {
14373
14455
  get buttons() {
14374
14456
  return this.editBox.buttons;
14375
14457
  }
14458
+ get targetLeafer() {
14459
+ const first = this.list[0];
14460
+ return first && first.leafer;
14461
+ }
14376
14462
  constructor(userConfig, data) {
14377
14463
  super(data);
14378
14464
  this.leafList = new LeafList;
@@ -14422,11 +14508,22 @@ let Editor = class Editor extends Group {
14422
14508
  updateEditTool() {
14423
14509
  this.unloadEditTool();
14424
14510
  if (this.editing) {
14425
- const name = this.element.editOuter || "EditTool";
14426
- const tool = this.editTool = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
14427
- this.editBox.load();
14428
- tool.load();
14429
- this.update();
14511
+ const target = this.element;
14512
+ let name = target.editOuter || "EditTool";
14513
+ const {beforeEditOuter: beforeEditOuter} = this.mergeConfig;
14514
+ if (beforeEditOuter) {
14515
+ const check = beforeEditOuter({
14516
+ target: target,
14517
+ name: name
14518
+ });
14519
+ if (isString(check)) name = check; else if (check === false) return;
14520
+ }
14521
+ if (EditToolCreator.list[name]) {
14522
+ const tool = this.editTool = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
14523
+ this.editBox.load();
14524
+ tool.load();
14525
+ this.update();
14526
+ }
14430
14527
  }
14431
14528
  }
14432
14529
  unloadEditTool() {
@@ -14519,17 +14616,24 @@ let Editor = class Editor extends Group {
14519
14616
  if (isString(nameOrSelect)) name = nameOrSelect; else if (!select) select = nameOrSelect;
14520
14617
  if (target && select) this.target = target;
14521
14618
  if (this.single) {
14522
- const editTarget = target || this.element;
14523
- name || (name = editTarget.editInner);
14524
- if (name && EditToolCreator.list[name]) {
14619
+ if (!target) target = this.element;
14620
+ if (!name) name = target.editInner;
14621
+ const {beforeEditInner: beforeEditInner} = this.mergeConfig;
14622
+ if (beforeEditInner) {
14623
+ const check = beforeEditInner({
14624
+ target: target,
14625
+ name: name
14626
+ });
14627
+ if (isString(check)) name = check; else if (check === false) return;
14628
+ }
14629
+ if (EditToolCreator.list[name]) {
14525
14630
  this.editTool.unload();
14526
14631
  this.innerEditing = true;
14527
14632
  this.innerEditor = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
14528
- this.innerEditor.editTarget = editTarget;
14633
+ this.innerEditor.editTarget = target;
14529
14634
  this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
14530
14635
  this.innerEditor.load();
14531
14636
  this.emitInnerEvent(InnerEditorEvent.OPEN);
14532
- console.log("hello");
14533
14637
  }
14534
14638
  }
14535
14639
  }
@@ -14578,10 +14682,13 @@ let Editor = class Editor extends Group {
14578
14682
  onRenderStart() {
14579
14683
  if (this.targetChanged) this.update();
14580
14684
  }
14685
+ onChildScroll() {
14686
+ if (this.multiple) this.updateEditBox();
14687
+ }
14581
14688
  listenTargetEvents() {
14582
14689
  if (!this.targetEventIds.length) {
14583
- const {app: app, leafer: leafer, editMask: editMask} = this;
14584
- this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this) ];
14690
+ const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
14691
+ this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), targetLeafer && targetLeafer.on_(PropertyEvent.SCROLL, this.onChildScroll, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this) ];
14585
14692
  if (editMask.visible) editMask.forceRender();
14586
14693
  }
14587
14694
  }
@@ -14730,7 +14837,7 @@ EditTool = __decorate([ registerEditTool() ], EditTool);
14730
14837
 
14731
14838
  const {left: left$1, right: right$1} = Direction9;
14732
14839
 
14733
- const {move: move$4, copy: copy$1, toNumberPoints: toNumberPoints} = PointHelper;
14840
+ const {move: move$5, copy: copy$1, toNumberPoints: toNumberPoints} = PointHelper;
14734
14841
 
14735
14842
  let LineEditTool = class LineEditTool extends EditTool {
14736
14843
  constructor() {
@@ -14804,11 +14911,11 @@ let LineEditTool = class LineEditTool extends EditTool {
14804
14911
  dragPoint(fromPoint, toPoint, isDragFrom, around, movePoint) {
14805
14912
  const {x: x, y: y} = movePoint;
14806
14913
  if (isDragFrom) {
14807
- move$4(fromPoint, x, y);
14808
- if (around) move$4(toPoint, -x, -y);
14914
+ move$5(fromPoint, x, y);
14915
+ if (around) move$5(toPoint, -x, -y);
14809
14916
  } else {
14810
- if (around) move$4(fromPoint, -x, -y);
14811
- move$4(toPoint, x, y);
14917
+ if (around) move$5(fromPoint, -x, -y);
14918
+ move$5(toPoint, x, y);
14812
14919
  }
14813
14920
  }
14814
14921
  onSkew(_e) {}
@@ -15363,7 +15470,9 @@ function addViewport(leafer, mergeConfig, custom) {
15363
15470
  addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
15364
15471
  if (leafer.isApp || custom) return;
15365
15472
  leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, e => {
15366
- leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY));
15473
+ leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY, false));
15474
+ }), leafer.on_(MoveEvent.END, e => {
15475
+ LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
15367
15476
  }), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
15368
15477
  const {zoomLayer: zoomLayer} = leafer;
15369
15478
  const changeScale = leafer.getValidScale(e.scale);
@@ -15578,32 +15687,27 @@ class Transformer {
15578
15687
 
15579
15688
  const leafer = Leafer.prototype;
15580
15689
 
15581
- const bounds = new Bounds;
15690
+ const bounds = new Bounds, move$4 = new Point;
15582
15691
 
15583
15692
  leafer.initType = function(type) {
15584
15693
  LeaferTypeCreator.run(type, this);
15585
15694
  };
15586
15695
 
15587
- leafer.getValidMove = function(moveX, moveY) {
15696
+ leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
15588
15697
  const {scroll: scroll, disabled: disabled} = this.app.config.move;
15698
+ move$4.set(moveX, moveY);
15589
15699
  if (scroll) {
15590
15700
  const type = scroll === true ? "" : scroll;
15591
- if (type.includes("x")) moveX = moveX || moveY, moveY = 0; else if (type.includes("y")) moveY = moveY || moveX,
15592
- moveX = 0; else Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
15593
- if (type.includes("limit")) {
15594
- const {x: x, y: y, width: width, height: height} = bounds.set(this.__world).addPoint(this.zoomLayer);
15595
- const right = x + width - this.width, bottom = y + height - this.height;
15596
- if (x >= 0 && right <= 0) moveX = 0; else if (moveX > 0) {
15597
- if (x + moveX > 0) moveX = -x;
15598
- } else if (moveX < 0 && right + moveX < 0) moveX = -right;
15599
- if (y >= 0 && bottom <= 0) moveY = 0; else if (moveY > 0) {
15600
- if (y + moveY > 0) moveY = -y;
15601
- } else if (moveY < 0 && bottom + moveY < 0) moveY = -bottom;
15701
+ if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0; else Math.abs(move$4.x) > Math.abs(move$4.y) ? move$4.y = 0 : move$4.x = 0;
15702
+ if (checkLimit && type.includes("limit")) {
15703
+ bounds.set(this.__world).addPoint(this.zoomLayer);
15704
+ DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "inner", move$4, true);
15705
+ if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0;
15602
15706
  }
15603
15707
  }
15604
15708
  return {
15605
- x: disabled ? 0 : moveX,
15606
- y: disabled ? 0 : moveY
15709
+ x: disabled ? 0 : move$4.x,
15710
+ y: disabled ? 0 : move$4.y
15607
15711
  };
15608
15712
  };
15609
15713
 
@@ -19249,4 +19353,4 @@ Object.assign(Filter, {
19249
19353
  }
19250
19354
  });
19251
19355
 
19252
- export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
19356
+ export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };