@leafer-ui/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$5;
677
- copy$b(temp, t);
676
+ copy$a(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$5;
683
- copy$b(temp, t);
682
+ copy$a(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$5;
689
- copy$b(temp, t);
688
+ copy$a(temp, t);
690
689
  P$5.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$5 = PointHelper;
763
- const {getDistanceFrom: getDistanceFrom, copy: copy$b, getAtan2: getAtan2} = P$5;
762
+ const {getDistanceFrom: getDistanceFrom, copy: copy$a, getAtan2: getAtan2} = P$5;
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$a(to, t);
1144
+ copy$9(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$a(t, bounds);
1296
+ if (!addMode) copy$9(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$a} = B;
1381
+ const {add: add$1, copy: copy$9} = 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$4.enable) {
1588
- if (D$4.filterList.length && D$4.filterList.every(name => name !== this.name)) return;
1589
- if (D$4.excludeList.length && D$4.excludeList.some(name => name === this.name)) return;
1590
+ if (D$5.enable) {
1591
+ if (D$5.filterList.length && D$5.filterList.every(name => name !== this.name)) return;
1592
+ if (D$5.excludeList.length && D$5.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$4.enable) this.warn(...messages);
1597
+ if (D$5.enable) this.warn(...messages);
1595
1598
  }
1596
1599
  warn(...messages) {
1597
- if (D$4.showWarn) console.warn(this.name, ...messages);
1600
+ if (D$5.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$4 = Debug;
1623
+ const D$5 = Debug;
1621
1624
  const debug$f = 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$9, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math;
1988
+ const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = 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$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2244
+ if (useSameWorldTransform) copy$8(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$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
2610
+ const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
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$c = Debug.get("PathConvert");
@@ -2813,7 +2822,7 @@ var LeaferUI = function(exports) {
2813
2822
  i += 5;
2814
2823
  break;
2815
2824
 
2816
- case D$3:
2825
+ case D$4:
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$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
2924
+ const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
2916
2925
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
2917
2926
  const {tan: tan, min: min, abs: abs$1} = 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$2, x, y, width, height, ...fourCorners);
2956
+ data.push(D$3, x, y, width, height, ...fourCorners);
2948
2957
  } else {
2949
2958
  data.push(N$2, 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$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1} = PathCommandMap;
3095
+ const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$2, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1} = PathCommandMap;
3087
3096
  const debug$b = 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$1:
3135
+ case D$2:
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$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
3177
+ const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D$1, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
3169
3178
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3170
- const {addPointBounds: addPointBounds, copy: copy$8, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3179
+ const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3171
3180
  const debug$a = 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:
3245
+ case D$1:
3237
3246
  case X:
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 ? 9 : 6;
3250
+ i += command === D$1 ? 9 : 6;
3242
3251
  break;
3243
3252
 
3244
3253
  case G:
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$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3255
+ i === 0 ? copy$7(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:
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$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3273
+ i === 0 ? copy$7(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:
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$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3290
+ i === 0 ? copy$7(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$7, 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$6, 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$1 = {}, {round: round} = 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.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$7(matrix$1, o);
4316
+ copy$6(matrix$1, o);
4298
4317
  scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4299
- if (t.origin || t.around) {
4318
+ if (L.hasHighPosition(t)) {
4300
4319
  L.setTransform(t, matrix$1, resize, transition);
4301
4320
  } else {
4302
4321
  const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.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$7(matrix$1, o);
4335
+ copy$6(matrix$1, o);
4317
4336
  rotateOfOuter$2(matrix$1, origin, angle);
4318
- if (t.origin || t.around) L.setTransform(t, matrix$1, false, transition); else t.set({
4337
+ if (L.hasHighPosition(t)) L.setTransform(t, matrix$1, false, transition); else t.set({
4319
4338
  x: t.x + matrix$1.e - o.e,
4320
4339
  y: t.y + matrix$1.f - o.f,
4321
4340
  rotation: MathHelper.formatRotation(t.rotation + angle)
@@ -4325,24 +4344,28 @@ var LeaferUI = function(exports) {
4325
4344
  L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4326
4345
  },
4327
4346
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4328
- copy$7(matrix$1, t.__localMatrix);
4347
+ copy$6(matrix$1, t.__localMatrix);
4329
4348
  skewOfOuter(matrix$1, origin, skewX, skewY);
4330
4349
  L.setTransform(t, matrix$1, resize, transition);
4331
4350
  },
4332
4351
  transformWorld(t, transform, resize, transition) {
4333
- copy$7(matrix$1, t.worldTransform);
4352
+ copy$6(matrix$1, t.worldTransform);
4334
4353
  multiplyParent$3(matrix$1, transform);
4335
- if (t.parent) divideParent(matrix$1, t.parent.worldTransform);
4354
+ if (t.parent) divideParent(matrix$1, t.parent.scrollWorldTransform);
4336
4355
  L.setTransform(t, matrix$1, resize, transition);
4337
4356
  },
4338
4357
  transform(t, transform, resize, transition) {
4339
- copy$7(matrix$1, t.localTransform);
4358
+ copy$6(matrix$1, t.localTransform);
4340
4359
  multiplyParent$3(matrix$1, transform);
4341
4360
  L.setTransform(t, matrix$1, resize, transition);
4342
4361
  },
4343
4362
  setTransform(t, transform, resize, transition) {
4344
4363
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
4345
4364
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
4365
+ if (L.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$7(matrix$1, t.worldTransform);
4374
- divideParent(matrix$1, relative.worldTransform);
4396
+ copy$6(matrix$1, t.worldTransform);
4397
+ divideParent(matrix$1, relative.scrollWorldTransform);
4375
4398
  return temp ? matrix$1 : Object.assign({}, matrix$1);
4376
4399
  },
4377
4400
  drop(t, parent, index, resize) {
4378
4401
  t.setTransform(L.getRelativeWorld(t, parent, true), resize);
4379
4402
  parent.add(t, index);
4380
4403
  },
4404
+ hasHighPosition(t) {
4405
+ return t.origin || t.around || L.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 = LeafHelper;
4401
4430
  const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
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$2} = LeafHelper;
4520
- const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$6} = BoundsHelper;
4548
+ const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$5} = 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$6(layoutBounds, bounds);
4784
+ copy$5(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$3, tempPoint: tempPoint} = 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$1, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
5315
5355
  const {updateBounds: updateBounds$1} = BranchHelper;
5316
- const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5} = BoundsHelper;
5356
+ const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4} = BoundsHelper;
5317
5357
  const {toBounds: toBounds$1} = 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$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5422
5462
  },
5423
- __updateRenderBounds() {
5463
+ __updateRenderBounds(_bounds) {
5424
5464
  const layout = this.__layout;
5425
- layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5465
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(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$4, move: move} = PointHelper;
5556
+ const {copy: copy$3, move: move} = 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$4(to, world);
5872
+ if (to) copy$3(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$4(to, local);
5879
+ if (to) copy$3(to, local);
5836
5880
  }
5837
5881
  }
5838
5882
  worldToInner(world, to, distance, relative) {
@@ -6047,14 +6091,14 @@ var LeaferUI = function(exports) {
6047
6091
  }
6048
6092
  return 0;
6049
6093
  }
6050
- __updateBoxBounds() {
6051
- setListWithFn(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6094
+ __updateBoxBounds(_secondLayout, bounds) {
6095
+ setListWithFn(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6052
6096
  }
6053
- __updateStrokeBounds() {
6054
- setListWithFn(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6097
+ __updateStrokeBounds(bounds) {
6098
+ setListWithFn(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6055
6099
  }
6056
- __updateRenderBounds() {
6057
- setListWithFn(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6100
+ __updateRenderBounds(bounds) {
6101
+ setListWithFn(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.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
7558
+ D.axisMove(leaf, move);
7559
+ }
7560
+ };
7561
+ const D = 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$3, 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$3(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";
@@ -11587,6 +11656,7 @@ var LeaferUI = function(exports) {
11587
11656
  exports.Cursor = Cursor;
11588
11657
  exports.DataHelper = DataHelper;
11589
11658
  exports.Debug = Debug;
11659
+ exports.DragBoundsHelper = DragBoundsHelper;
11590
11660
  exports.Dragger = Dragger;
11591
11661
  exports.Effect = Effect;
11592
11662
  exports.EllipseData = EllipseData;
@@ -11708,6 +11778,7 @@ var LeaferUI = function(exports) {
11708
11778
  exports.effectType = effectType;
11709
11779
  exports.emptyData = emptyData;
11710
11780
  exports.eraserType = eraserType;
11781
+ exports.extraPropertyEventMap = extraPropertyEventMap;
11711
11782
  exports.getBoundsData = getBoundsData;
11712
11783
  exports.getDescriptor = getDescriptor;
11713
11784
  exports.getMatrixData = getMatrixData;
@@ -11738,6 +11809,7 @@ var LeaferUI = function(exports) {
11738
11809
  exports.rewriteAble = rewriteAble;
11739
11810
  exports.rotationType = rotationType;
11740
11811
  exports.scaleType = scaleType;
11812
+ exports.scrollType = scrollType;
11741
11813
  exports.sortType = sortType;
11742
11814
  exports.strokeType = strokeType;
11743
11815
  exports.surfaceType = surfaceType;