@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.
package/dist/worker.js CHANGED
@@ -445,9 +445,8 @@ var LeaferUI = function(exports) {
445
445
  t.e = child.e * a + child.f * c + e;
446
446
  t.f = child.e * b + child.f * d + f;
447
447
  },
448
- multiplyParent(t, parent, to, abcdChanged, childScaleData, scrollData) {
449
- let {e: e, f: f} = t;
450
- if (scrollData) e += scrollData.scrollX, f += scrollData.scrollY;
448
+ multiplyParent(t, parent, to, abcdChanged, childScaleData) {
449
+ const {e: e, f: f} = t;
451
450
  to || (to = t);
452
451
  if (isUndefined(abcdChanged)) abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
453
452
  if (abcdChanged) {
@@ -674,19 +673,19 @@ var LeaferUI = function(exports) {
674
673
  },
675
674
  tempToInnerOf(t, matrix) {
676
675
  const {tempPoint: temp} = P$7;
677
- copy$e(temp, t);
676
+ copy$d(temp, t);
678
677
  toInnerPoint$2(matrix, temp, temp);
679
678
  return temp;
680
679
  },
681
680
  tempToOuterOf(t, matrix) {
682
681
  const {tempPoint: temp} = P$7;
683
- copy$e(temp, t);
682
+ copy$d(temp, t);
684
683
  toOuterPoint$3(matrix, temp, temp);
685
684
  return temp;
686
685
  },
687
686
  tempToInnerRadiusPointOf(t, matrix) {
688
687
  const {tempRadiusPoint: temp} = P$7;
689
- copy$e(temp, t);
688
+ copy$d(temp, t);
690
689
  P$7.toInnerRadiusPointOf(t, matrix, temp);
691
690
  return temp;
692
691
  },
@@ -760,7 +759,7 @@ var LeaferUI = function(exports) {
760
759
  }
761
760
  };
762
761
  const P$7 = PointHelper;
763
- const {getDistanceFrom: getDistanceFrom, copy: copy$e, getAtan2: getAtan2} = P$7;
762
+ const {getDistanceFrom: getDistanceFrom, copy: copy$d, getAtan2: getAtan2} = P$7;
764
763
  class Point {
765
764
  constructor(x, y) {
766
765
  this.set(x, y);
@@ -1129,6 +1128,10 @@ var LeaferUI = function(exports) {
1129
1128
  t.x += x;
1130
1129
  t.y += y;
1131
1130
  },
1131
+ scroll(t, data) {
1132
+ t.x += data.scrollX;
1133
+ t.y += data.scrollY;
1134
+ },
1132
1135
  getByMove(t, x, y) {
1133
1136
  t = Object.assign({}, t);
1134
1137
  B.move(t, x, y);
@@ -1138,7 +1141,7 @@ var LeaferUI = function(exports) {
1138
1141
  if (!to) {
1139
1142
  to = t;
1140
1143
  } else {
1141
- copy$d(to, t);
1144
+ copy$c(to, t);
1142
1145
  }
1143
1146
  if (parent) {
1144
1147
  to.offsetX = -(B.maxX(parent) - t.x);
@@ -1290,7 +1293,7 @@ var LeaferUI = function(exports) {
1290
1293
  if (bounds && (bounds.width || bounds.height)) {
1291
1294
  if (first) {
1292
1295
  first = false;
1293
- if (!addMode) copy$d(t, bounds);
1296
+ if (!addMode) copy$c(t, bounds);
1294
1297
  } else {
1295
1298
  add$1(t, bounds);
1296
1299
  }
@@ -1375,7 +1378,7 @@ var LeaferUI = function(exports) {
1375
1378
  }
1376
1379
  };
1377
1380
  const B = BoundsHelper;
1378
- const {add: add$1, copy: copy$d} = B;
1381
+ const {add: add$1, copy: copy$c} = B;
1379
1382
  class Bounds {
1380
1383
  get minX() {
1381
1384
  return BoundsHelper.minX(this);
@@ -1584,17 +1587,17 @@ var LeaferUI = function(exports) {
1584
1587
  showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
1585
1588
  }
1586
1589
  log(...messages) {
1587
- if (D$6.enable) {
1588
- if (D$6.filterList.length && D$6.filterList.every(name => name !== this.name)) return;
1589
- if (D$6.excludeList.length && D$6.excludeList.some(name => name === this.name)) return;
1590
+ if (D$7.enable) {
1591
+ if (D$7.filterList.length && D$7.filterList.every(name => name !== this.name)) return;
1592
+ if (D$7.excludeList.length && D$7.excludeList.some(name => name === this.name)) return;
1590
1593
  console.log("%c" + this.name, "color:#21ae62", ...messages);
1591
1594
  }
1592
1595
  }
1593
1596
  tip(...messages) {
1594
- if (D$6.enable) this.warn(...messages);
1597
+ if (D$7.enable) this.warn(...messages);
1595
1598
  }
1596
1599
  warn(...messages) {
1597
- if (D$6.showWarn) console.warn(this.name, ...messages);
1600
+ if (D$7.showWarn) console.warn(this.name, ...messages);
1598
1601
  }
1599
1602
  repeat(name, ...messages) {
1600
1603
  if (!this.repeatMap[name]) {
@@ -1617,7 +1620,7 @@ var LeaferUI = function(exports) {
1617
1620
  if (!name) name = []; else if (isString(name)) name = [ name ];
1618
1621
  return name;
1619
1622
  }
1620
- const D$6 = Debug;
1623
+ const D$7 = Debug;
1621
1624
  const debug$i = Debug.get("RunTime");
1622
1625
  const Run = {
1623
1626
  currentId: 0,
@@ -1982,7 +1985,7 @@ var LeaferUI = function(exports) {
1982
1985
  __decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
1983
1986
  __decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
1984
1987
  __decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
1985
- const {copy: copy$c, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math;
1988
+ const {copy: copy$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
1986
1989
  const minSize = {
1987
1990
  width: 1,
1988
1991
  height: 1,
@@ -2144,44 +2147,44 @@ var LeaferUI = function(exports) {
2144
2147
  const {pixelRatio: pixelRatio} = this;
2145
2148
  this.filter = `blur(${blur * pixelRatio}px)`;
2146
2149
  }
2147
- copyWorld(canvas, from, to, blendMode) {
2150
+ copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
2148
2151
  if (blendMode) this.blendMode = blendMode;
2149
2152
  if (from) {
2150
- const {pixelRatio: pixelRatio} = this;
2151
- if (!to) to = from;
2152
- 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);
2153
+ this.setTempPixelBounds(from, ceilPixel);
2154
+ if (!to) to = tempPixelBounds; else this.setTempPixelBounds2(to, ceilPixel), to = tempPixelBounds2;
2155
+ this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, to.x, to.y, to.width, to.height);
2153
2156
  } else {
2154
2157
  this.drawImage(canvas.view, 0, 0);
2155
2158
  }
2156
2159
  if (blendMode) this.blendMode = "source-over";
2157
2160
  }
2158
- copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode) {
2159
- if (blendMode) this.blendMode = blendMode;
2161
+ copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
2160
2162
  if (fromWorld.b || fromWorld.c) {
2161
2163
  this.save();
2162
2164
  this.resetTransform();
2163
- this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld));
2165
+ this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld), blendMode, ceilPixel);
2164
2166
  this.restore();
2165
2167
  } else {
2166
- const {pixelRatio: pixelRatio} = this;
2167
- this.drawImage(canvas.view, fromWorld.x * pixelRatio, fromWorld.y * pixelRatio, fromWorld.width * pixelRatio, fromWorld.height * pixelRatio, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
2168
+ if (blendMode) this.blendMode = blendMode;
2169
+ this.setTempPixelBounds(fromWorld, ceilPixel);
2170
+ this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
2171
+ if (blendMode) this.blendMode = "source-over";
2168
2172
  }
2169
- if (blendMode) this.blendMode = "source-over";
2170
2173
  }
2171
- copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform) {
2174
+ copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
2172
2175
  this.resetTransform();
2173
- this.copyWorld(canvas, from, to, blendMode);
2176
+ this.copyWorld(canvas, from, to, blendMode, ceilPixel);
2174
2177
  if (!onlyResetTransform) this.useWorldTransform();
2175
2178
  }
2176
2179
  useGrayscaleAlpha(bounds) {
2177
- this.setTempBounds(bounds, true, true);
2180
+ this.setTempPixelBounds(bounds, true, true);
2178
2181
  let alpha, pixel;
2179
- const {context: context} = this, imageData = context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height), {data: data} = imageData;
2182
+ const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
2180
2183
  for (let i = 0, len = data.length; i < len; i += 4) {
2181
2184
  pixel = data[i] * .299 + data[i + 1] * .587 + data[i + 2] * .114;
2182
2185
  if (alpha = data[i + 3]) data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
2183
2186
  }
2184
- context.putImageData(imageData, tempBounds$1.x, tempBounds$1.y);
2187
+ context.putImageData(imageData, tempPixelBounds.x, tempPixelBounds.y);
2185
2188
  }
2186
2189
  useMask(maskCanvas, fromBounds, toBounds) {
2187
2190
  this.copyWorld(maskCanvas, fromBounds, toBounds, "destination-in");
@@ -2189,42 +2192,48 @@ var LeaferUI = function(exports) {
2189
2192
  useEraser(eraserCanvas, fromBounds, toBounds) {
2190
2193
  this.copyWorld(eraserCanvas, fromBounds, toBounds, "destination-out");
2191
2194
  }
2192
- fillWorld(bounds, color, blendMode) {
2195
+ fillWorld(bounds, color, blendMode, ceilPixel) {
2193
2196
  if (blendMode) this.blendMode = blendMode;
2194
2197
  this.fillStyle = color;
2195
- this.setTempBounds(bounds);
2196
- this.fillRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2198
+ this.setTempPixelBounds(bounds, ceilPixel);
2199
+ this.fillRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2197
2200
  if (blendMode) this.blendMode = "source-over";
2198
2201
  }
2199
- strokeWorld(bounds, color, blendMode) {
2202
+ strokeWorld(bounds, color, blendMode, ceilPixel) {
2200
2203
  if (blendMode) this.blendMode = blendMode;
2201
2204
  this.strokeStyle = color;
2202
- this.setTempBounds(bounds);
2203
- this.strokeRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2205
+ this.setTempPixelBounds(bounds, ceilPixel);
2206
+ this.strokeRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2204
2207
  if (blendMode) this.blendMode = "source-over";
2205
2208
  }
2206
- clipWorld(bounds, ceilPixel) {
2209
+ clipWorld(bounds, ceilPixel = true) {
2207
2210
  this.beginPath();
2208
- this.setTempBounds(bounds, ceilPixel);
2209
- this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2211
+ this.setTempPixelBounds(bounds, ceilPixel);
2212
+ this.rect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2210
2213
  this.clip();
2211
2214
  }
2212
2215
  clipUI(ruleData) {
2213
2216
  ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
2214
2217
  }
2215
- clearWorld(bounds, ceilPixel) {
2216
- this.setTempBounds(bounds, ceilPixel);
2217
- this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2218
+ clearWorld(bounds, ceilPixel = true) {
2219
+ this.setTempPixelBounds(bounds, ceilPixel);
2220
+ this.clearRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2218
2221
  }
2219
2222
  clear() {
2220
2223
  const {pixelRatio: pixelRatio} = this;
2221
2224
  this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
2222
2225
  }
2223
- setTempBounds(bounds, ceil, intersect) {
2224
- tempBounds$1.set(bounds);
2225
- if (intersect) tempBounds$1.intersect(this.bounds);
2226
- tempBounds$1.scale(this.pixelRatio);
2227
- if (ceil) tempBounds$1.ceil();
2226
+ setTempPixelBounds(bounds, ceil, intersect) {
2227
+ this.copyToPixelBounds(tempPixelBounds, bounds, ceil, intersect);
2228
+ }
2229
+ setTempPixelBounds2(bounds, ceil, intersect) {
2230
+ this.copyToPixelBounds(tempPixelBounds2, bounds, ceil, intersect);
2231
+ }
2232
+ copyToPixelBounds(pixelBounds, bounds, ceil, intersect) {
2233
+ pixelBounds.set(bounds);
2234
+ if (intersect) pixelBounds.intersect(this.bounds);
2235
+ pixelBounds.scale(this.pixelRatio);
2236
+ if (ceil) pixelBounds.ceil();
2228
2237
  }
2229
2238
  isSameSize(size) {
2230
2239
  return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
@@ -2232,7 +2241,7 @@ var LeaferUI = function(exports) {
2232
2241
  getSameCanvas(useSameWorldTransform, useSameSmooth) {
2233
2242
  const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
2234
2243
  canvas.save();
2235
- if (useSameWorldTransform) copy$c(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2244
+ if (useSameWorldTransform) copy$b(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2236
2245
  if (useSameSmooth) canvas.smooth = this.smooth;
2237
2246
  canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
2238
2247
  return canvas;
@@ -2240,7 +2249,7 @@ var LeaferUI = function(exports) {
2240
2249
  recycle(clearBounds) {
2241
2250
  if (!this.recycled) {
2242
2251
  this.restore();
2243
- clearBounds ? this.clearWorld(clearBounds, true) : this.clear();
2252
+ clearBounds ? this.clearWorld(clearBounds) : this.clear();
2244
2253
  this.manager ? this.manager.recycle(this) : this.destroy();
2245
2254
  }
2246
2255
  }
@@ -2598,7 +2607,7 @@ var LeaferUI = function(exports) {
2598
2607
  }
2599
2608
  }
2600
2609
  };
2601
- 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;
2610
+ 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;
2602
2611
  const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2603
2612
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
2604
2613
  const debug$f = Debug.get("PathConvert");
@@ -2813,7 +2822,7 @@ var LeaferUI = function(exports) {
2813
2822
  i += 5;
2814
2823
  break;
2815
2824
 
2816
- case D$5:
2825
+ case D$6:
2817
2826
  x = old[i + 1];
2818
2827
  y = old[i + 2];
2819
2828
  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);
@@ -2912,7 +2921,7 @@ var LeaferUI = function(exports) {
2912
2921
  }
2913
2922
  };
2914
2923
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
2915
- 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;
2924
+ 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;
2916
2925
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
2917
2926
  const {tan: tan, min: min, abs: abs$4} = Math;
2918
2927
  const startPoint = {};
@@ -2944,7 +2953,7 @@ var LeaferUI = function(exports) {
2944
2953
  } else {
2945
2954
  const fourCorners = MathHelper.fourNumber(cornerRadius);
2946
2955
  if (fourCorners) {
2947
- data.push(D$4, x, y, width, height, ...fourCorners);
2956
+ data.push(D$5, x, y, width, height, ...fourCorners);
2948
2957
  } else {
2949
2958
  data.push(N$4, x, y, width, height);
2950
2959
  }
@@ -3083,7 +3092,7 @@ var LeaferUI = function(exports) {
3083
3092
  }
3084
3093
  paint() {}
3085
3094
  }
3086
- 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;
3095
+ 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;
3087
3096
  const debug$e = Debug.get("PathDrawer");
3088
3097
  const PathDrawer = {
3089
3098
  drawPathByData(drawer, data) {
@@ -3123,7 +3132,7 @@ var LeaferUI = function(exports) {
3123
3132
  i += 5;
3124
3133
  break;
3125
3134
 
3126
- case D$3:
3135
+ case D$4:
3127
3136
  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] ]);
3128
3137
  i += 9;
3129
3138
  break;
@@ -3165,9 +3174,9 @@ var LeaferUI = function(exports) {
3165
3174
  }
3166
3175
  }
3167
3176
  };
3168
- 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;
3177
+ 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;
3169
3178
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3170
- const {addPointBounds: addPointBounds, copy: copy$b, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$3} = TwoPointBoundsHelper;
3179
+ const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$3} = TwoPointBoundsHelper;
3171
3180
  const debug$d = Debug.get("PathBounds");
3172
3181
  let radius, radiusX, radiusY;
3173
3182
  const tempPointBounds = {};
@@ -3233,17 +3242,17 @@ var LeaferUI = function(exports) {
3233
3242
  i += 5;
3234
3243
  break;
3235
3244
 
3236
- case D$2:
3245
+ case D$3:
3237
3246
  case X$2:
3238
3247
  x = data[i + 1];
3239
3248
  y = data[i + 2];
3240
3249
  addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
3241
- i += command === D$2 ? 9 : 6;
3250
+ i += command === D$3 ? 9 : 6;
3242
3251
  break;
3243
3252
 
3244
3253
  case G$2:
3245
3254
  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);
3246
- i === 0 ? copy$b(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3255
+ i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3247
3256
  x = setEndPoint.x;
3248
3257
  y = setEndPoint.y;
3249
3258
  i += 9;
@@ -3261,7 +3270,7 @@ var LeaferUI = function(exports) {
3261
3270
 
3262
3271
  case O$3:
3263
3272
  arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
3264
- i === 0 ? copy$b(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3273
+ i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3265
3274
  x = setEndPoint.x;
3266
3275
  y = setEndPoint.y;
3267
3276
  i += 7;
@@ -3278,7 +3287,7 @@ var LeaferUI = function(exports) {
3278
3287
 
3279
3288
  case U$2:
3280
3289
  arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
3281
- i === 0 ? copy$b(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3290
+ i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3282
3291
  x = setEndPoint.x;
3283
3292
  y = setEndPoint.y;
3284
3293
  i += 6;
@@ -3896,6 +3905,16 @@ var LeaferUI = function(exports) {
3896
3905
  }
3897
3906
  }));
3898
3907
  }
3908
+ function scrollType(defaultValue, checkFiniteNumber) {
3909
+ return decorateLeafAttr(defaultValue, key => attr({
3910
+ set(value) {
3911
+ if (this.__setAttr(key, value, checkFiniteNumber)) {
3912
+ this.__layout.matrixChanged || this.__layout.matrixChange();
3913
+ this.__scrollWorld || (this.__scrollWorld = {});
3914
+ }
3915
+ }
3916
+ }));
3917
+ }
3899
3918
  function autoLayoutType(defaultValue) {
3900
3919
  return decorateLeafAttr(defaultValue, key => attr({
3901
3920
  set(value) {
@@ -4198,7 +4217,7 @@ var LeaferUI = function(exports) {
4198
4217
  EventCreator.register(target);
4199
4218
  };
4200
4219
  }
4201
- 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;
4220
+ 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;
4202
4221
  const matrix$3 = {}, {round: round$3} = Math;
4203
4222
  const LeafHelper = {
4204
4223
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
@@ -4272,7 +4291,7 @@ var LeaferUI = function(exports) {
4272
4291
  x: x,
4273
4292
  y: y
4274
4293
  };
4275
- isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true);
4294
+ isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
4276
4295
  L$4.moveLocal(t, local.x, local.y, transition);
4277
4296
  },
4278
4297
  moveLocal(t, x, y = 0, transition) {
@@ -4294,9 +4313,9 @@ var LeaferUI = function(exports) {
4294
4313
  if (scaleY) transition = scaleY;
4295
4314
  scaleY = scaleX;
4296
4315
  }
4297
- copy$a(matrix$3, o);
4316
+ copy$9(matrix$3, o);
4298
4317
  scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
4299
- if (t.origin || t.around) {
4318
+ if (L$4.hasHighPosition(t)) {
4300
4319
  L$4.setTransform(t, matrix$3, resize, transition);
4301
4320
  } else {
4302
4321
  const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.f - o.f;
@@ -4313,9 +4332,9 @@ var LeaferUI = function(exports) {
4313
4332
  },
4314
4333
  rotateOfLocal(t, origin, angle, transition) {
4315
4334
  const o = t.__localMatrix;
4316
- copy$a(matrix$3, o);
4335
+ copy$9(matrix$3, o);
4317
4336
  rotateOfOuter$2(matrix$3, origin, angle);
4318
- if (t.origin || t.around) L$4.setTransform(t, matrix$3, false, transition); else t.set({
4337
+ if (L$4.hasHighPosition(t)) L$4.setTransform(t, matrix$3, false, transition); else t.set({
4319
4338
  x: t.x + matrix$3.e - o.e,
4320
4339
  y: t.y + matrix$3.f - o.f,
4321
4340
  rotation: MathHelper.formatRotation(t.rotation + angle)
@@ -4325,24 +4344,28 @@ var LeaferUI = function(exports) {
4325
4344
  L$4.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4326
4345
  },
4327
4346
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4328
- copy$a(matrix$3, t.__localMatrix);
4347
+ copy$9(matrix$3, t.__localMatrix);
4329
4348
  skewOfOuter(matrix$3, origin, skewX, skewY);
4330
4349
  L$4.setTransform(t, matrix$3, resize, transition);
4331
4350
  },
4332
4351
  transformWorld(t, transform, resize, transition) {
4333
- copy$a(matrix$3, t.worldTransform);
4352
+ copy$9(matrix$3, t.worldTransform);
4334
4353
  multiplyParent$3(matrix$3, transform);
4335
- if (t.parent) divideParent(matrix$3, t.parent.worldTransform);
4354
+ if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
4336
4355
  L$4.setTransform(t, matrix$3, resize, transition);
4337
4356
  },
4338
4357
  transform(t, transform, resize, transition) {
4339
- copy$a(matrix$3, t.localTransform);
4358
+ copy$9(matrix$3, t.localTransform);
4340
4359
  multiplyParent$3(matrix$3, transform);
4341
4360
  L$4.setTransform(t, matrix$3, resize, transition);
4342
4361
  },
4343
4362
  setTransform(t, transform, resize, transition) {
4344
4363
  const data = t.__, originPoint = data.origin && L$4.getInnerOrigin(t, data.origin);
4345
4364
  const layout = getLayout(transform, originPoint, data.around && L$4.getInnerOrigin(t, data.around));
4365
+ if (L$4.hasOffset(t)) {
4366
+ layout.x -= data.offsetX;
4367
+ layout.y -= data.offsetY;
4368
+ }
4346
4369
  if (resize) {
4347
4370
  const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
4348
4371
  delete layout.scaleX, delete layout.scaleY;
@@ -4370,14 +4393,20 @@ var LeaferUI = function(exports) {
4370
4393
  return innerOrigin;
4371
4394
  },
4372
4395
  getRelativeWorld(t, relative, temp) {
4373
- copy$a(matrix$3, t.worldTransform);
4374
- divideParent(matrix$3, relative.worldTransform);
4396
+ copy$9(matrix$3, t.worldTransform);
4397
+ divideParent(matrix$3, relative.scrollWorldTransform);
4375
4398
  return temp ? matrix$3 : Object.assign({}, matrix$3);
4376
4399
  },
4377
4400
  drop(t, parent, index, resize) {
4378
4401
  t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
4379
4402
  parent.add(t, index);
4380
4403
  },
4404
+ hasHighPosition(t) {
4405
+ return t.origin || t.around || L$4.hasOffset(t);
4406
+ },
4407
+ hasOffset(t) {
4408
+ return t.offsetX || t.offsetY;
4409
+ },
4381
4410
  hasParent(p, parent) {
4382
4411
  if (!parent) return false;
4383
4412
  while (p) {
@@ -4400,8 +4429,7 @@ var LeaferUI = function(exports) {
4400
4429
  const L$4 = LeafHelper;
4401
4430
  const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$4;
4402
4431
  function getTempLocal(t, world) {
4403
- t.__layout.update();
4404
- return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
4432
+ return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
4405
4433
  }
4406
4434
  const LeafBoundsHelper = {
4407
4435
  worldBounds(target) {
@@ -4517,7 +4545,7 @@ var LeaferUI = function(exports) {
4517
4545
  }
4518
4546
  };
4519
4547
  const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3} = LeafHelper;
4520
- const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$9} = BoundsHelper;
4548
+ const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$8} = BoundsHelper;
4521
4549
  const localContent = "_localContentBounds";
4522
4550
  const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
4523
4551
  class LeafLayout {
@@ -4753,7 +4781,7 @@ var LeaferUI = function(exports) {
4753
4781
  matrix = getRelativeWorld$1(leaf, relative, true);
4754
4782
  }
4755
4783
  if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
4756
- copy$9(layoutBounds, bounds);
4784
+ copy$8(layoutBounds, bounds);
4757
4785
  PointHelper.copy(layoutBounds, point);
4758
4786
  if (unscale) {
4759
4787
  const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
@@ -4932,6 +4960,7 @@ var LeaferUI = function(exports) {
4932
4960
  ChildEvent.MOUNTED = "mounted";
4933
4961
  ChildEvent.UNMOUNTED = "unmounted";
4934
4962
  ChildEvent.DESTROY = "destroy";
4963
+ const SCROLL = "property.scroll";
4935
4964
  class PropertyEvent extends Event {
4936
4965
  constructor(type, target, attrName, oldValue, newValue) {
4937
4966
  super(type, target);
@@ -4942,6 +4971,11 @@ var LeaferUI = function(exports) {
4942
4971
  }
4943
4972
  PropertyEvent.CHANGE = "property.change";
4944
4973
  PropertyEvent.LEAFER_CHANGE = "property.leafer_change";
4974
+ PropertyEvent.SCROLL = SCROLL;
4975
+ const extraPropertyEventMap = {
4976
+ scrollX: SCROLL,
4977
+ scrollY: SCROLL
4978
+ };
4945
4979
  class ImageEvent extends Event {
4946
4980
  constructor(type, data) {
4947
4981
  super(type);
@@ -5163,7 +5197,9 @@ var LeaferUI = function(exports) {
5163
5197
  if (!id) return;
5164
5198
  const list = isArray(id) ? id : [ id ];
5165
5199
  list.forEach(item => {
5166
- 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);
5200
+ if (item) {
5201
+ 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);
5202
+ }
5167
5203
  });
5168
5204
  list.length = 0;
5169
5205
  }
@@ -5252,8 +5288,6 @@ var LeaferUI = function(exports) {
5252
5288
  }
5253
5289
  if (isObject(newValue) || oldValue !== newValue) {
5254
5290
  this.__realSetAttr(name, newValue);
5255
- const {CHANGE: CHANGE} = PropertyEvent;
5256
- const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
5257
5291
  if (this.isLeafer) {
5258
5292
  this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
5259
5293
  const transformEventName = leaferTransformAttrMap[name];
@@ -5261,10 +5295,10 @@ var LeaferUI = function(exports) {
5261
5295
  this.emitEvent(new LeaferEvent(transformEventName, this));
5262
5296
  this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this));
5263
5297
  }
5264
- } else {
5265
- if (this.hasEvent(CHANGE)) this.emitEvent(event);
5266
5298
  }
5267
- this.leafer.emitEvent(event);
5299
+ this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue);
5300
+ const extraPropertyEvent = extraPropertyEventMap[name];
5301
+ if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue);
5268
5302
  return true;
5269
5303
  } else {
5270
5304
  return false;
@@ -5274,6 +5308,11 @@ var LeaferUI = function(exports) {
5274
5308
  return true;
5275
5309
  }
5276
5310
  },
5311
+ emitPropertyEvent(type, name, oldValue, newValue) {
5312
+ const event = new PropertyEvent(type, this, name, oldValue, newValue);
5313
+ this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
5314
+ this.leafer.emitEvent(event);
5315
+ },
5277
5316
  __realSetAttr(name, newValue) {
5278
5317
  const data = this.__;
5279
5318
  data[name] = newValue;
@@ -5289,8 +5328,9 @@ var LeaferUI = function(exports) {
5289
5328
  const {toPoint: toPoint$4, tempPoint: tempPoint$1} = AroundHelper;
5290
5329
  const LeafMatrix = {
5291
5330
  __updateWorldMatrix() {
5292
- const {parent: parent, __layout: __layout} = this;
5293
- multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__, parent && (parent.scrollY || parent.scrollX) && parent.__);
5331
+ const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
5332
+ multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
5333
+ if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
5294
5334
  },
5295
5335
  __updateLocalMatrix() {
5296
5336
  if (this.__local) {
@@ -5313,7 +5353,7 @@ var LeaferUI = function(exports) {
5313
5353
  };
5314
5354
  const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
5315
5355
  const {updateBounds: updateBounds$2} = BranchHelper;
5316
- const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$8} = BoundsHelper;
5356
+ const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$7} = BoundsHelper;
5317
5357
  const {toBounds: toBounds$2} = PathBounds;
5318
5358
  const LeafBounds = {
5319
5359
  __updateWorldBounds() {
@@ -5382,7 +5422,7 @@ var LeaferUI = function(exports) {
5382
5422
  __updateLocalRenderBounds() {
5383
5423
  toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
5384
5424
  },
5385
- __updateBoxBounds() {
5425
+ __updateBoxBounds(_secondLayout, _bounds) {
5386
5426
  const b = this.__layout.boxBounds;
5387
5427
  const data = this.__;
5388
5428
  if (data.__pathInputed) {
@@ -5416,13 +5456,13 @@ var LeaferUI = function(exports) {
5416
5456
  data.__naturalWidth = layout.boxBounds.width;
5417
5457
  data.__naturalHeight = layout.boxBounds.height;
5418
5458
  },
5419
- __updateStrokeBounds() {
5459
+ __updateStrokeBounds(_bounds) {
5420
5460
  const layout = this.__layout;
5421
5461
  copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5422
5462
  },
5423
- __updateRenderBounds() {
5463
+ __updateRenderBounds(_bounds) {
5424
5464
  const layout = this.__layout;
5425
- layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$8(layout.renderBounds, layout.strokeBounds);
5465
+ layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$7(layout.renderBounds, layout.strokeBounds);
5426
5466
  }
5427
5467
  };
5428
5468
  const LeafRender = {
@@ -5513,7 +5553,7 @@ var LeaferUI = function(exports) {
5513
5553
  const {LEAF: LEAF, create: create} = IncrementId;
5514
5554
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
5515
5555
  const {toOuterOf: toOuterOf} = BoundsHelper;
5516
- const {copy: copy$7, move: move$5} = PointHelper;
5556
+ const {copy: copy$6, move: move$6} = PointHelper;
5517
5557
  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;
5518
5558
  exports.Leaf = class Leaf {
5519
5559
  get tag() {
@@ -5559,6 +5599,10 @@ var LeaferUI = function(exports) {
5559
5599
  get localTransform() {
5560
5600
  return this.__layout.getTransform("local");
5561
5601
  }
5602
+ get scrollWorldTransform() {
5603
+ this.updateLayout();
5604
+ return this.__scrollWorld || this.__world;
5605
+ }
5562
5606
  get boxBounds() {
5563
5607
  return this.getBounds("box", "inner");
5564
5608
  }
@@ -5575,7 +5619,7 @@ var LeaferUI = function(exports) {
5575
5619
  return this.getBounds("render");
5576
5620
  }
5577
5621
  get worldOpacity() {
5578
- this.__layout.update();
5622
+ this.updateLayout();
5579
5623
  return this.__worldOpacity;
5580
5624
  }
5581
5625
  get __worldFlipped() {
@@ -5750,10 +5794,10 @@ var LeaferUI = function(exports) {
5750
5794
  __updateLocalBoxBounds() {}
5751
5795
  __updateLocalStrokeBounds() {}
5752
5796
  __updateLocalRenderBounds() {}
5753
- __updateBoxBounds() {}
5797
+ __updateBoxBounds(_secondLayout, _bounds) {}
5754
5798
  __updateContentBounds() {}
5755
- __updateStrokeBounds() {}
5756
- __updateRenderBounds() {}
5799
+ __updateStrokeBounds(_bounds) {}
5800
+ __updateRenderBounds(_bounds) {}
5757
5801
  __updateAutoLayout() {}
5758
5802
  __updateFlowLayout() {}
5759
5803
  __updateNaturalSize() {}
@@ -5825,14 +5869,14 @@ var LeaferUI = function(exports) {
5825
5869
  if (this.parent) {
5826
5870
  this.parent.worldToInner(world, to, distance, relative);
5827
5871
  } else {
5828
- if (to) copy$7(to, world);
5872
+ if (to) copy$6(to, world);
5829
5873
  }
5830
5874
  }
5831
5875
  localToWorld(local, to, distance, relative) {
5832
5876
  if (this.parent) {
5833
5877
  this.parent.innerToWorld(local, to, distance, relative);
5834
5878
  } else {
5835
- if (to) copy$7(to, local);
5879
+ if (to) copy$6(to, local);
5836
5880
  }
5837
5881
  }
5838
5882
  worldToInner(world, to, distance, relative) {
@@ -5851,7 +5895,7 @@ var LeaferUI = function(exports) {
5851
5895
  }
5852
5896
  getBoxPointByInner(inner, _relative, _distance, change) {
5853
5897
  const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
5854
- move$5(point, -x, -y);
5898
+ move$6(point, -x, -y);
5855
5899
  return point;
5856
5900
  }
5857
5901
  getInnerPoint(world, relative, distance, change) {
@@ -5861,7 +5905,7 @@ var LeaferUI = function(exports) {
5861
5905
  }
5862
5906
  getInnerPointByBox(box, _relative, _distance, change) {
5863
5907
  const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
5864
- move$5(point, x, y);
5908
+ move$6(point, x, y);
5865
5909
  return point;
5866
5910
  }
5867
5911
  getInnerPointByLocal(local, _relative, distance, change) {
@@ -6047,14 +6091,14 @@ var LeaferUI = function(exports) {
6047
6091
  }
6048
6092
  return 0;
6049
6093
  }
6050
- __updateBoxBounds() {
6051
- setListWithFn$1(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6094
+ __updateBoxBounds(_secondLayout, bounds) {
6095
+ setListWithFn$1(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6052
6096
  }
6053
- __updateStrokeBounds() {
6054
- setListWithFn$1(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6097
+ __updateStrokeBounds(bounds) {
6098
+ setListWithFn$1(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6055
6099
  }
6056
- __updateRenderBounds() {
6057
- setListWithFn$1(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6100
+ __updateRenderBounds(bounds) {
6101
+ setListWithFn$1(bounds || this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6058
6102
  }
6059
6103
  __updateSortChildren() {
6060
6104
  let affectSort;
@@ -6297,7 +6341,7 @@ var LeaferUI = function(exports) {
6297
6341
  this.levelMap = null;
6298
6342
  }
6299
6343
  }
6300
- const version = "1.9.1";
6344
+ const version = "1.9.3";
6301
6345
  class LeaferCanvas extends LeaferCanvasBase {
6302
6346
  get allowBackgroundColor() {
6303
6347
  return true;
@@ -6800,8 +6844,8 @@ var LeaferUI = function(exports) {
6800
6844
  const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
6801
6845
  canvas.save();
6802
6846
  bounds.spread(Renderer.clipSpread).ceil();
6803
- canvas.clearWorld(bounds, true);
6804
- canvas.clipWorld(bounds, true);
6847
+ canvas.clearWorld(bounds);
6848
+ canvas.clipWorld(bounds);
6805
6849
  this.__render(bounds, realBounds);
6806
6850
  canvas.restore();
6807
6851
  Run.end(t);
@@ -7021,6 +7065,7 @@ var LeaferUI = function(exports) {
7021
7065
  hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
7022
7066
  if (child.isBranch) {
7023
7067
  if (hit || child.__ignoreHitWorld) {
7068
+ if (child.topChildren) this.eachFind(child.topChildren, false);
7024
7069
  this.eachFind(child.children, child.__onlyHitMask);
7025
7070
  if (child.isBranchLeaf) this.hitChild(child, point);
7026
7071
  }
@@ -7340,7 +7385,7 @@ var LeaferUI = function(exports) {
7340
7385
  }
7341
7386
  get __clipAfterFill() {
7342
7387
  const t = this;
7343
- return t.overflow === "hide" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
7388
+ return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
7344
7389
  }
7345
7390
  }
7346
7391
  class LeaferData extends GroupData {
@@ -7481,6 +7526,39 @@ var LeaferUI = function(exports) {
7481
7526
  return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
7482
7527
  }
7483
7528
  };
7529
+ const DragBoundsHelper = {
7530
+ getValidMove(content, dragBounds, dragBoundsType, move, change) {
7531
+ const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
7532
+ const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
7533
+ if (!change) move = Object.assign({}, move);
7534
+ const isBiggerWidth = content.width > dragBounds.width;
7535
+ const isBiggerHeight = content.height > dragBounds.height;
7536
+ if (isBiggerWidth && dragBoundsType !== "outer") {
7537
+ if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
7538
+ } else {
7539
+ if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
7540
+ }
7541
+ if (isBiggerHeight && dragBoundsType !== "outer") {
7542
+ if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
7543
+ } else {
7544
+ if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
7545
+ }
7546
+ move.x = MathHelper.float(move.x);
7547
+ move.y = MathHelper.float(move.y);
7548
+ return move;
7549
+ },
7550
+ axisMove(leaf, move) {
7551
+ const {draggable: draggable} = leaf;
7552
+ if (draggable === "x") move.y = 0;
7553
+ if (draggable === "y") move.x = 0;
7554
+ },
7555
+ limitMove(leaf, move) {
7556
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7557
+ if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
7558
+ D$2.axisMove(leaf, move);
7559
+ }
7560
+ };
7561
+ const D$2 = DragBoundsHelper;
7484
7562
  const {stintSet: stintSet$1} = DataHelper;
7485
7563
  const UIRender = {
7486
7564
  __updateChange() {
@@ -7764,8 +7842,8 @@ var LeaferUI = function(exports) {
7764
7842
  __decorate([ rotationType(0, true) ], exports.UI.prototype, "skewY", void 0);
7765
7843
  __decorate([ positionType(0, true) ], exports.UI.prototype, "offsetX", void 0);
7766
7844
  __decorate([ positionType(0, true) ], exports.UI.prototype, "offsetY", void 0);
7767
- __decorate([ positionType(0, true) ], exports.UI.prototype, "scrollX", void 0);
7768
- __decorate([ positionType(0, true) ], exports.UI.prototype, "scrollY", void 0);
7845
+ __decorate([ scrollType(0, true) ], exports.UI.prototype, "scrollX", void 0);
7846
+ __decorate([ scrollType(0, true) ], exports.UI.prototype, "scrollY", void 0);
7769
7847
  __decorate([ autoLayoutType() ], exports.UI.prototype, "origin", void 0);
7770
7848
  __decorate([ autoLayoutType() ], exports.UI.prototype, "around", void 0);
7771
7849
  __decorate([ dataType(false) ], exports.UI.prototype, "lazy", void 0);
@@ -7780,6 +7858,7 @@ var LeaferUI = function(exports) {
7780
7858
  __decorate([ boundsType() ], exports.UI.prototype, "heightRange", void 0);
7781
7859
  __decorate([ dataType(false) ], exports.UI.prototype, "draggable", void 0);
7782
7860
  __decorate([ dataType() ], exports.UI.prototype, "dragBounds", void 0);
7861
+ __decorate([ dataType("auto") ], exports.UI.prototype, "dragBoundsType", void 0);
7783
7862
  __decorate([ dataType(false) ], exports.UI.prototype, "editable", void 0);
7784
7863
  __decorate([ hitType(true) ], exports.UI.prototype, "hittable", void 0);
7785
7864
  __decorate([ hitType("path") ], exports.UI.prototype, "hitFill", void 0);
@@ -8163,7 +8242,7 @@ var LeaferUI = function(exports) {
8163
8242
  zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
8164
8243
  return Plugin.need("view");
8165
8244
  }
8166
- getValidMove(moveX, moveY) {
8245
+ getValidMove(moveX, moveY, _checkLimit) {
8167
8246
  return {
8168
8247
  x: moveX,
8169
8248
  y: moveY
@@ -8244,9 +8323,8 @@ var LeaferUI = function(exports) {
8244
8323
  };
8245
8324
  __decorate([ dataProcessor(RectData) ], exports.Rect.prototype, "__", void 0);
8246
8325
  exports.Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], exports.Rect);
8247
- const {copy: copy$6, add: add, includes: includes$1} = BoundsHelper;
8326
+ const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
8248
8327
  const rect$1 = exports.Rect.prototype, group = exports.Group.prototype;
8249
- const childrenRenderBounds = {};
8250
8328
  exports.Box = class Box extends exports.Group {
8251
8329
  get __tag() {
8252
8330
  return "Box";
@@ -8292,22 +8370,27 @@ var LeaferUI = function(exports) {
8292
8370
  __updateRenderBounds() {
8293
8371
  let isOverflow;
8294
8372
  if (this.children.length) {
8295
- const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} = this.__layout;
8296
- super.__updateRenderBounds();
8297
- copy$6(childrenRenderBounds, renderBounds);
8298
- this.__updateRectRenderBounds();
8299
- if (data.scrollY || data.scrollX) {
8300
- childrenRenderBounds.x += data.scrollX;
8301
- childrenRenderBounds.y += data.scrollY;
8373
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
8374
+ const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8375
+ super.__updateRenderBounds(childrenRenderBounds);
8376
+ if (data.overflow.includes("scroll")) {
8377
+ add(childrenRenderBounds, boxBounds);
8378
+ scroll(childrenRenderBounds, data);
8302
8379
  }
8380
+ this.__updateRectRenderBounds();
8303
8381
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8304
- if (isOverflow && data.overflow !== "hide") add(renderBounds, childrenRenderBounds);
8382
+ if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8305
8383
  } else this.__updateRectRenderBounds();
8306
8384
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8307
- this.__updateScrollBar();
8385
+ this.__checkScroll();
8308
8386
  }
8309
8387
  __updateRectRenderBounds() {}
8310
- __updateScrollBar() {}
8388
+ __updateWorldBounds() {
8389
+ if (this.hasScroller) this.__updateScroll();
8390
+ super.__updateWorldBounds();
8391
+ }
8392
+ __checkScroll() {}
8393
+ __updateScroll() {}
8311
8394
  __updateRectChange() {}
8312
8395
  __updateChange() {
8313
8396
  super.__updateChange();
@@ -8322,7 +8405,7 @@ var LeaferUI = function(exports) {
8322
8405
  this.__renderRect(canvas, options);
8323
8406
  if (this.children.length) this.__renderGroup(canvas, options);
8324
8407
  }
8325
- if (this.scrollBar) this.scrollBar.__render(canvas, options);
8408
+ if (this.hasScroller) this.scroller.__render(canvas, options);
8326
8409
  }
8327
8410
  __drawContent(canvas, options) {
8328
8411
  this.__renderGroup(canvas, options);
@@ -8886,7 +8969,7 @@ var LeaferUI = function(exports) {
8886
8969
  if (this.viewReady) this.renderer.update();
8887
8970
  }
8888
8971
  __render(canvas, options) {
8889
- if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
8972
+ if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
8890
8973
  }
8891
8974
  __onResize(event) {
8892
8975
  this.forEach(leafer => leafer.resize(event));
@@ -9025,26 +9108,11 @@ var LeaferUI = function(exports) {
9025
9108
  const move = leaf.getLocalPoint(total, null, true);
9026
9109
  PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9027
9110
  if (checkLimit) this.limitMove(leaf, move);
9111
+ DragBoundsHelper.axisMove(leaf, move);
9028
9112
  return move;
9029
9113
  }
9030
9114
  static limitMove(leaf, move) {
9031
- const {draggable: draggable, dragBounds: dragBounds} = leaf;
9032
- if (dragBounds) this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, move, true);
9033
- if (draggable === "x") move.y = 0;
9034
- if (draggable === "y") move.x = 0;
9035
- }
9036
- static getMoveInDragBounds(childBox, dragBounds, move, change) {
9037
- const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9038
- const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9039
- if (!change) move = Object.assign({}, move);
9040
- if (BoundsHelper.includes(childBox, dragBounds)) {
9041
- if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
9042
- if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
9043
- } else {
9044
- if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
9045
- if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
9046
- }
9047
- return move;
9115
+ DragBoundsHelper.limitMove(leaf, move);
9048
9116
  }
9049
9117
  getPageMove(total) {
9050
9118
  this.assignMove(total);
@@ -9279,11 +9347,12 @@ var LeaferUI = function(exports) {
9279
9347
  const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
9280
9348
  list.forEach(leaf => {
9281
9349
  if (leaf.draggable) {
9350
+ const axisDrag = isString(leaf.draggable);
9282
9351
  const move = exports.DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
9283
9352
  x: totalX,
9284
9353
  y: totalY
9285
- }, checkLimitMove);
9286
- if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
9354
+ }, checkLimitMove || axisDrag);
9355
+ if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
9287
9356
  }
9288
9357
  });
9289
9358
  }
@@ -10933,7 +11002,7 @@ var LeaferUI = function(exports) {
10933
11002
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
10934
11003
  }
10935
11004
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10936
- if (end && index < end) other.clearWorld(copyBounds, true);
11005
+ if (end && index < end) other.clearWorld(copyBounds);
10937
11006
  });
10938
11007
  other.recycle(copyBounds);
10939
11008
  }
@@ -10993,7 +11062,7 @@ var LeaferUI = function(exports) {
10993
11062
  }
10994
11063
  other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
10995
11064
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10996
- if (end && index < end) other.clearWorld(copyBounds, true);
11065
+ if (end && index < end) other.clearWorld(copyBounds);
10997
11066
  });
10998
11067
  other.recycle(copyBounds);
10999
11068
  }
@@ -11082,7 +11151,7 @@ var LeaferUI = function(exports) {
11082
11151
  canvas.resetTransform();
11083
11152
  canvas.opacity = maskOpacity;
11084
11153
  canvas.copyWorld(content, realBounds, undefined, blendMode);
11085
- recycle ? content.recycle(realBounds) : content.clearWorld(realBounds, true);
11154
+ recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
11086
11155
  }
11087
11156
  const money = "¥¥$€££¢¢";
11088
11157
  const letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
@@ -12595,7 +12664,7 @@ var LeaferUI = function(exports) {
12595
12664
  if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
12596
12665
  }
12597
12666
  onDragEnd(e) {
12598
- if (this.mergeConfig.dragLimitAnimate && this.moving) this.transformTool.onMove(e);
12667
+ if (this.moving) this.transformTool.onMove(e);
12599
12668
  this.dragPoint = null;
12600
12669
  this.resetDoing();
12601
12670
  const {name: name, pointType: pointType} = e.current;
@@ -12628,6 +12697,10 @@ var LeaferUI = function(exports) {
12628
12697
  }
12629
12698
  }
12630
12699
  }
12700
+ onMoveEnd(e) {
12701
+ if (this.moving) this.transformTool.onMove(e);
12702
+ this.resetDoing();
12703
+ }
12631
12704
  onScale(e) {
12632
12705
  if (this.canGesture) {
12633
12706
  e.stop();
@@ -12718,7 +12791,7 @@ var LeaferUI = function(exports) {
12718
12791
  const {rect: rect, editor: editor, __eventIds: events} = this;
12719
12792
  events.push(rect.on_([ [ exports.DragEvent.START, this.onDragStart, this ], [ exports.DragEvent.DRAG, this.onDrag, this ], [ exports.DragEvent.END, this.onDragEnd, this ], [ exports.PointerEvent.ENTER, () => updateMoveCursor(this) ], [ exports.PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ exports.PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
12720
12793
  this.waitLeafer(() => {
12721
- events.push(editor.app.on_([ [ [ exports.KeyEvent.HOLD, exports.KeyEvent.UP ], this.onKey, this ], [ exports.KeyEvent.DOWN, this.onArrow, this ], [ exports.MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ exports.ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ exports.RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ exports.MoveEvent.END, this.resetDoing, this ], [ exports.ZoomEvent.END, this.resetDoing, this ], [ exports.RotateEvent.END, this.resetDoing, this ] ]));
12794
+ events.push(editor.app.on_([ [ [ exports.KeyEvent.HOLD, exports.KeyEvent.UP ], this.onKey, this ], [ exports.KeyEvent.DOWN, this.onArrow, this ], [ exports.MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ exports.ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ exports.RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ exports.MoveEvent.END, this.onMoveEnd, this ], [ exports.ZoomEvent.END, this.resetDoing, this ], [ exports.RotateEvent.END, this.resetDoing, this ] ]));
12722
12795
  });
12723
12796
  }
12724
12797
  __removeListenEvents() {
@@ -12877,7 +12950,7 @@ var LeaferUI = function(exports) {
12877
12950
  parent.addAt(group, parent.children.indexOf(list[0]));
12878
12951
  list.sort(order);
12879
12952
  const matrx = new Matrix(element.worldTransform);
12880
- matrx.divideParent(parent.worldTransform);
12953
+ matrx.divideParent(parent.scrollWorldTransform);
12881
12954
  group.setTransform(matrx);
12882
12955
  group.editable = true;
12883
12956
  group.hitChildren = false;
@@ -13065,8 +13138,9 @@ var LeaferUI = function(exports) {
13065
13138
  const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData, app: app} = this.editBox;
13066
13139
  let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
13067
13140
  if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
13068
- const isMoveEnd = e.type === exports.DragEvent.END || e.type === exports.DragEvent.END;
13069
- const checkLimitMove = !dragLimitAnimate || isMoveEnd;
13141
+ const isMoveEnd = e.type === exports.MoveEvent.END || e.type === exports.DragEvent.END;
13142
+ const axisDrag = isString(target.draggable);
13143
+ const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
13070
13144
  if (e instanceof exports.MoveEvent) {
13071
13145
  move = e.getLocalMove(target);
13072
13146
  if (checkLimitMove) exports.DragEvent.limitMove(target, move);
@@ -13080,7 +13154,9 @@ var LeaferUI = function(exports) {
13080
13154
  }
13081
13155
  move = exports.DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
13082
13156
  }
13083
- if (dragLimitAnimate && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
13157
+ if (move.x || move.y) {
13158
+ if (dragLimitAnimate && !axisDrag && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
13159
+ }
13084
13160
  }
13085
13161
  onScale(e) {
13086
13162
  const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
@@ -13354,6 +13430,10 @@ var LeaferUI = function(exports) {
13354
13430
  get buttons() {
13355
13431
  return this.editBox.buttons;
13356
13432
  }
13433
+ get targetLeafer() {
13434
+ const first = this.list[0];
13435
+ return first && first.leafer;
13436
+ }
13357
13437
  constructor(userConfig, data) {
13358
13438
  super(data);
13359
13439
  this.leafList = new LeafList;
@@ -13403,11 +13483,22 @@ var LeaferUI = function(exports) {
13403
13483
  updateEditTool() {
13404
13484
  this.unloadEditTool();
13405
13485
  if (this.editing) {
13406
- const name = this.element.editOuter || "EditTool";
13407
- const tool = this.editTool = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
13408
- this.editBox.load();
13409
- tool.load();
13410
- this.update();
13486
+ const target = this.element;
13487
+ let name = target.editOuter || "EditTool";
13488
+ const {beforeEditOuter: beforeEditOuter} = this.mergeConfig;
13489
+ if (beforeEditOuter) {
13490
+ const check = beforeEditOuter({
13491
+ target: target,
13492
+ name: name
13493
+ });
13494
+ if (isString(check)) name = check; else if (check === false) return;
13495
+ }
13496
+ if (EditToolCreator.list[name]) {
13497
+ const tool = this.editTool = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
13498
+ this.editBox.load();
13499
+ tool.load();
13500
+ this.update();
13501
+ }
13411
13502
  }
13412
13503
  }
13413
13504
  unloadEditTool() {
@@ -13500,17 +13591,24 @@ var LeaferUI = function(exports) {
13500
13591
  if (isString(nameOrSelect)) name = nameOrSelect; else if (!select) select = nameOrSelect;
13501
13592
  if (target && select) this.target = target;
13502
13593
  if (this.single) {
13503
- const editTarget = target || this.element;
13504
- name || (name = editTarget.editInner);
13505
- if (name && EditToolCreator.list[name]) {
13594
+ if (!target) target = this.element;
13595
+ if (!name) name = target.editInner;
13596
+ const {beforeEditInner: beforeEditInner} = this.mergeConfig;
13597
+ if (beforeEditInner) {
13598
+ const check = beforeEditInner({
13599
+ target: target,
13600
+ name: name
13601
+ });
13602
+ if (isString(check)) name = check; else if (check === false) return;
13603
+ }
13604
+ if (EditToolCreator.list[name]) {
13506
13605
  this.editTool.unload();
13507
13606
  this.innerEditing = true;
13508
13607
  this.innerEditor = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
13509
- this.innerEditor.editTarget = editTarget;
13608
+ this.innerEditor.editTarget = target;
13510
13609
  this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
13511
13610
  this.innerEditor.load();
13512
13611
  this.emitInnerEvent(InnerEditorEvent.OPEN);
13513
- console.log("hello");
13514
13612
  }
13515
13613
  }
13516
13614
  }
@@ -13559,10 +13657,13 @@ var LeaferUI = function(exports) {
13559
13657
  onRenderStart() {
13560
13658
  if (this.targetChanged) this.update();
13561
13659
  }
13660
+ onChildScroll() {
13661
+ if (this.multiple) this.updateEditBox();
13662
+ }
13562
13663
  listenTargetEvents() {
13563
13664
  if (!this.targetEventIds.length) {
13564
- const {app: app, leafer: leafer, editMask: editMask} = this;
13565
- this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this) ];
13665
+ const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
13666
+ 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) ];
13566
13667
  if (editMask.visible) editMask.forceRender();
13567
13668
  }
13568
13669
  }
@@ -13702,7 +13803,7 @@ var LeaferUI = function(exports) {
13702
13803
  };
13703
13804
  exports.EditTool = __decorate([ registerEditTool() ], exports.EditTool);
13704
13805
  const {left: left$1, right: right$1} = exports.Direction9;
13705
- const {move: move$4, copy: copy$1, toNumberPoints: toNumberPoints} = PointHelper;
13806
+ const {move: move$5, copy: copy$1, toNumberPoints: toNumberPoints} = PointHelper;
13706
13807
  exports.LineEditTool = class LineEditTool extends exports.EditTool {
13707
13808
  constructor() {
13708
13809
  super(...arguments);
@@ -13775,11 +13876,11 @@ var LeaferUI = function(exports) {
13775
13876
  dragPoint(fromPoint, toPoint, isDragFrom, around, movePoint) {
13776
13877
  const {x: x, y: y} = movePoint;
13777
13878
  if (isDragFrom) {
13778
- move$4(fromPoint, x, y);
13779
- if (around) move$4(toPoint, -x, -y);
13879
+ move$5(fromPoint, x, y);
13880
+ if (around) move$5(toPoint, -x, -y);
13780
13881
  } else {
13781
- if (around) move$4(fromPoint, -x, -y);
13782
- move$4(toPoint, x, y);
13882
+ if (around) move$5(fromPoint, -x, -y);
13883
+ move$5(toPoint, x, y);
13783
13884
  }
13784
13885
  }
13785
13886
  onSkew(_e) {}
@@ -14291,7 +14392,9 @@ var LeaferUI = function(exports) {
14291
14392
  addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
14292
14393
  if (leafer.isApp || custom) return;
14293
14394
  leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, e => {
14294
- leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY));
14395
+ leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY, false));
14396
+ }), leafer.on_(exports.MoveEvent.END, e => {
14397
+ LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
14295
14398
  }), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, e => {
14296
14399
  const {zoomLayer: zoomLayer} = leafer;
14297
14400
  const changeScale = leafer.getValidScale(e.scale);
@@ -14490,30 +14593,25 @@ var LeaferUI = function(exports) {
14490
14593
  }
14491
14594
  }
14492
14595
  const leafer = exports.Leafer.prototype;
14493
- const bounds = new Bounds;
14596
+ const bounds = new Bounds, move$4 = new Point;
14494
14597
  leafer.initType = function(type) {
14495
14598
  LeaferTypeCreator.run(type, this);
14496
14599
  };
14497
- leafer.getValidMove = function(moveX, moveY) {
14600
+ leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
14498
14601
  const {scroll: scroll, disabled: disabled} = this.app.config.move;
14602
+ move$4.set(moveX, moveY);
14499
14603
  if (scroll) {
14500
14604
  const type = scroll === true ? "" : scroll;
14501
- if (type.includes("x")) moveX = moveX || moveY, moveY = 0; else if (type.includes("y")) moveY = moveY || moveX,
14502
- moveX = 0; else Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
14503
- if (type.includes("limit")) {
14504
- const {x: x, y: y, width: width, height: height} = bounds.set(this.__world).addPoint(this.zoomLayer);
14505
- const right = x + width - this.width, bottom = y + height - this.height;
14506
- if (x >= 0 && right <= 0) moveX = 0; else if (moveX > 0) {
14507
- if (x + moveX > 0) moveX = -x;
14508
- } else if (moveX < 0 && right + moveX < 0) moveX = -right;
14509
- if (y >= 0 && bottom <= 0) moveY = 0; else if (moveY > 0) {
14510
- if (y + moveY > 0) moveY = -y;
14511
- } else if (moveY < 0 && bottom + moveY < 0) moveY = -bottom;
14605
+ 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;
14606
+ if (checkLimit && type.includes("limit")) {
14607
+ bounds.set(this.__world).addPoint(this.zoomLayer);
14608
+ DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "inner", move$4, true);
14609
+ if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0;
14512
14610
  }
14513
14611
  }
14514
14612
  return {
14515
- x: disabled ? 0 : moveX,
14516
- y: disabled ? 0 : moveY
14613
+ x: disabled ? 0 : move$4.x,
14614
+ y: disabled ? 0 : move$4.y
14517
14615
  };
14518
14616
  };
14519
14617
  leafer.getValidScale = function(changeScale) {
@@ -17845,6 +17943,7 @@ var LeaferUI = function(exports) {
17845
17943
  exports.Cursor = Cursor;
17846
17944
  exports.DataHelper = DataHelper;
17847
17945
  exports.Debug = Debug;
17946
+ exports.DragBoundsHelper = DragBoundsHelper;
17848
17947
  exports.Dragger = Dragger;
17849
17948
  exports.EditBox = EditBox;
17850
17949
  exports.EditDataHelper = EditDataHelper;
@@ -18000,6 +18099,7 @@ var LeaferUI = function(exports) {
18000
18099
  exports.effectType = effectType;
18001
18100
  exports.emptyData = emptyData;
18002
18101
  exports.eraserType = eraserType;
18102
+ exports.extraPropertyEventMap = extraPropertyEventMap;
18003
18103
  exports.getBoundsData = getBoundsData;
18004
18104
  exports.getDescriptor = getDescriptor;
18005
18105
  exports.getMatrixData = getMatrixData;
@@ -18038,6 +18138,7 @@ var LeaferUI = function(exports) {
18038
18138
  exports.scaleResizePath = scaleResizePath;
18039
18139
  exports.scaleResizePoints = scaleResizePoints;
18040
18140
  exports.scaleType = scaleType;
18141
+ exports.scrollType = scrollType;
18041
18142
  exports.sortType = sortType;
18042
18143
  exports.stateStyleType = stateStyleType;
18043
18144
  exports.stateType = stateType;