leafer-ui 1.9.1 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.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,12 @@ var LeaferUI = function(exports) {
1129
1128
  t.x += x;
1130
1129
  t.y += y;
1131
1130
  },
1131
+ scroll(t, data) {
1132
+ if (data.scrollY || data.scrollX) {
1133
+ t.x += data.scrollX;
1134
+ t.y += data.scrollY;
1135
+ }
1136
+ },
1132
1137
  getByMove(t, x, y) {
1133
1138
  t = Object.assign({}, t);
1134
1139
  B.move(t, x, y);
@@ -1138,7 +1143,7 @@ var LeaferUI = function(exports) {
1138
1143
  if (!to) {
1139
1144
  to = t;
1140
1145
  } else {
1141
- copy$a(to, t);
1146
+ copy$9(to, t);
1142
1147
  }
1143
1148
  if (parent) {
1144
1149
  to.offsetX = -(B.maxX(parent) - t.x);
@@ -1290,7 +1295,7 @@ var LeaferUI = function(exports) {
1290
1295
  if (bounds && (bounds.width || bounds.height)) {
1291
1296
  if (first) {
1292
1297
  first = false;
1293
- if (!addMode) copy$a(t, bounds);
1298
+ if (!addMode) copy$9(t, bounds);
1294
1299
  } else {
1295
1300
  add$1(t, bounds);
1296
1301
  }
@@ -1375,7 +1380,7 @@ var LeaferUI = function(exports) {
1375
1380
  }
1376
1381
  };
1377
1382
  const B = BoundsHelper;
1378
- const {add: add$1, copy: copy$a} = B;
1383
+ const {add: add$1, copy: copy$9} = B;
1379
1384
  class Bounds {
1380
1385
  get minX() {
1381
1386
  return BoundsHelper.minX(this);
@@ -1584,17 +1589,17 @@ var LeaferUI = function(exports) {
1584
1589
  showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
1585
1590
  }
1586
1591
  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;
1592
+ if (D$5.enable) {
1593
+ if (D$5.filterList.length && D$5.filterList.every(name => name !== this.name)) return;
1594
+ if (D$5.excludeList.length && D$5.excludeList.some(name => name === this.name)) return;
1590
1595
  console.log("%c" + this.name, "color:#21ae62", ...messages);
1591
1596
  }
1592
1597
  }
1593
1598
  tip(...messages) {
1594
- if (D$4.enable) this.warn(...messages);
1599
+ if (D$5.enable) this.warn(...messages);
1595
1600
  }
1596
1601
  warn(...messages) {
1597
- if (D$4.showWarn) console.warn(this.name, ...messages);
1602
+ if (D$5.showWarn) console.warn(this.name, ...messages);
1598
1603
  }
1599
1604
  repeat(name, ...messages) {
1600
1605
  if (!this.repeatMap[name]) {
@@ -1617,7 +1622,7 @@ var LeaferUI = function(exports) {
1617
1622
  if (!name) name = []; else if (isString(name)) name = [ name ];
1618
1623
  return name;
1619
1624
  }
1620
- const D$4 = Debug;
1625
+ const D$5 = Debug;
1621
1626
  const debug$g = Debug.get("RunTime");
1622
1627
  const Run = {
1623
1628
  currentId: 0,
@@ -1982,7 +1987,7 @@ var LeaferUI = function(exports) {
1982
1987
  __decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
1983
1988
  __decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
1984
1989
  __decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
1985
- const {copy: copy$9, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math;
1990
+ const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
1986
1991
  const minSize = {
1987
1992
  width: 1,
1988
1993
  height: 1,
@@ -2144,44 +2149,44 @@ var LeaferUI = function(exports) {
2144
2149
  const {pixelRatio: pixelRatio} = this;
2145
2150
  this.filter = `blur(${blur * pixelRatio}px)`;
2146
2151
  }
2147
- copyWorld(canvas, from, to, blendMode) {
2152
+ copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
2148
2153
  if (blendMode) this.blendMode = blendMode;
2149
2154
  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);
2155
+ this.setTempPixelBounds(from, ceilPixel);
2156
+ if (!to) to = tempPixelBounds; else this.setTempPixelBounds2(to, ceilPixel), to = tempPixelBounds2;
2157
+ this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, to.x, to.y, to.width, to.height);
2153
2158
  } else {
2154
2159
  this.drawImage(canvas.view, 0, 0);
2155
2160
  }
2156
2161
  if (blendMode) this.blendMode = "source-over";
2157
2162
  }
2158
- copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode) {
2159
- if (blendMode) this.blendMode = blendMode;
2163
+ copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
2160
2164
  if (fromWorld.b || fromWorld.c) {
2161
2165
  this.save();
2162
2166
  this.resetTransform();
2163
- this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld));
2167
+ this.copyWorld(canvas, fromWorld, BoundsHelper.tempToOuterOf(toInnerBounds, fromWorld), blendMode, ceilPixel);
2164
2168
  this.restore();
2165
2169
  } 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);
2170
+ if (blendMode) this.blendMode = blendMode;
2171
+ this.setTempPixelBounds(fromWorld, ceilPixel);
2172
+ this.drawImage(canvas.view, tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height, toInnerBounds.x, toInnerBounds.y, toInnerBounds.width, toInnerBounds.height);
2173
+ if (blendMode) this.blendMode = "source-over";
2168
2174
  }
2169
- if (blendMode) this.blendMode = "source-over";
2170
2175
  }
2171
- copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform) {
2176
+ copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
2172
2177
  this.resetTransform();
2173
- this.copyWorld(canvas, from, to, blendMode);
2178
+ this.copyWorld(canvas, from, to, blendMode, ceilPixel);
2174
2179
  if (!onlyResetTransform) this.useWorldTransform();
2175
2180
  }
2176
2181
  useGrayscaleAlpha(bounds) {
2177
- this.setTempBounds(bounds, true, true);
2182
+ this.setTempPixelBounds(bounds, true, true);
2178
2183
  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;
2184
+ const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
2180
2185
  for (let i = 0, len = data.length; i < len; i += 4) {
2181
2186
  pixel = data[i] * .299 + data[i + 1] * .587 + data[i + 2] * .114;
2182
2187
  if (alpha = data[i + 3]) data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
2183
2188
  }
2184
- context.putImageData(imageData, tempBounds$1.x, tempBounds$1.y);
2189
+ context.putImageData(imageData, tempPixelBounds.x, tempPixelBounds.y);
2185
2190
  }
2186
2191
  useMask(maskCanvas, fromBounds, toBounds) {
2187
2192
  this.copyWorld(maskCanvas, fromBounds, toBounds, "destination-in");
@@ -2189,42 +2194,48 @@ var LeaferUI = function(exports) {
2189
2194
  useEraser(eraserCanvas, fromBounds, toBounds) {
2190
2195
  this.copyWorld(eraserCanvas, fromBounds, toBounds, "destination-out");
2191
2196
  }
2192
- fillWorld(bounds, color, blendMode) {
2197
+ fillWorld(bounds, color, blendMode, ceilPixel) {
2193
2198
  if (blendMode) this.blendMode = blendMode;
2194
2199
  this.fillStyle = color;
2195
- this.setTempBounds(bounds);
2196
- this.fillRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2200
+ this.setTempPixelBounds(bounds, ceilPixel);
2201
+ this.fillRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2197
2202
  if (blendMode) this.blendMode = "source-over";
2198
2203
  }
2199
- strokeWorld(bounds, color, blendMode) {
2204
+ strokeWorld(bounds, color, blendMode, ceilPixel) {
2200
2205
  if (blendMode) this.blendMode = blendMode;
2201
2206
  this.strokeStyle = color;
2202
- this.setTempBounds(bounds);
2203
- this.strokeRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2207
+ this.setTempPixelBounds(bounds, ceilPixel);
2208
+ this.strokeRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2204
2209
  if (blendMode) this.blendMode = "source-over";
2205
2210
  }
2206
- clipWorld(bounds, ceilPixel) {
2211
+ clipWorld(bounds, ceilPixel = true) {
2207
2212
  this.beginPath();
2208
- this.setTempBounds(bounds, ceilPixel);
2209
- this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2213
+ this.setTempPixelBounds(bounds, ceilPixel);
2214
+ this.rect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2210
2215
  this.clip();
2211
2216
  }
2212
2217
  clipUI(ruleData) {
2213
2218
  ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
2214
2219
  }
2215
- clearWorld(bounds, ceilPixel) {
2216
- this.setTempBounds(bounds, ceilPixel);
2217
- this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2220
+ clearWorld(bounds, ceilPixel = true) {
2221
+ this.setTempPixelBounds(bounds, ceilPixel);
2222
+ this.clearRect(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height);
2218
2223
  }
2219
2224
  clear() {
2220
2225
  const {pixelRatio: pixelRatio} = this;
2221
2226
  this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
2222
2227
  }
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();
2228
+ setTempPixelBounds(bounds, ceil, intersect) {
2229
+ this.copyToPixelBounds(tempPixelBounds, bounds, ceil, intersect);
2230
+ }
2231
+ setTempPixelBounds2(bounds, ceil, intersect) {
2232
+ this.copyToPixelBounds(tempPixelBounds2, bounds, ceil, intersect);
2233
+ }
2234
+ copyToPixelBounds(pixelBounds, bounds, ceil, intersect) {
2235
+ pixelBounds.set(bounds);
2236
+ if (intersect) pixelBounds.intersect(this.bounds);
2237
+ pixelBounds.scale(this.pixelRatio);
2238
+ if (ceil) pixelBounds.ceil();
2228
2239
  }
2229
2240
  isSameSize(size) {
2230
2241
  return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
@@ -2232,7 +2243,7 @@ var LeaferUI = function(exports) {
2232
2243
  getSameCanvas(useSameWorldTransform, useSameSmooth) {
2233
2244
  const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
2234
2245
  canvas.save();
2235
- if (useSameWorldTransform) copy$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2246
+ if (useSameWorldTransform) copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2236
2247
  if (useSameSmooth) canvas.smooth = this.smooth;
2237
2248
  canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
2238
2249
  return canvas;
@@ -2240,7 +2251,7 @@ var LeaferUI = function(exports) {
2240
2251
  recycle(clearBounds) {
2241
2252
  if (!this.recycled) {
2242
2253
  this.restore();
2243
- clearBounds ? this.clearWorld(clearBounds, true) : this.clear();
2254
+ clearBounds ? this.clearWorld(clearBounds) : this.clear();
2244
2255
  this.manager ? this.manager.recycle(this) : this.destroy();
2245
2256
  }
2246
2257
  }
@@ -2598,7 +2609,7 @@ var LeaferUI = function(exports) {
2598
2609
  }
2599
2610
  }
2600
2611
  };
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;
2612
+ 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
2613
  const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2603
2614
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
2604
2615
  const debug$d = Debug.get("PathConvert");
@@ -2813,7 +2824,7 @@ var LeaferUI = function(exports) {
2813
2824
  i += 5;
2814
2825
  break;
2815
2826
 
2816
- case D$3:
2827
+ case D$4:
2817
2828
  x = old[i + 1];
2818
2829
  y = old[i + 2];
2819
2830
  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 +2923,7 @@ var LeaferUI = function(exports) {
2912
2923
  }
2913
2924
  };
2914
2925
  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;
2926
+ 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
2927
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
2917
2928
  const {tan: tan, min: min, abs: abs$1} = Math;
2918
2929
  const startPoint = {};
@@ -2944,7 +2955,7 @@ var LeaferUI = function(exports) {
2944
2955
  } else {
2945
2956
  const fourCorners = MathHelper.fourNumber(cornerRadius);
2946
2957
  if (fourCorners) {
2947
- data.push(D$2, x, y, width, height, ...fourCorners);
2958
+ data.push(D$3, x, y, width, height, ...fourCorners);
2948
2959
  } else {
2949
2960
  data.push(N$2, x, y, width, height);
2950
2961
  }
@@ -3083,7 +3094,7 @@ var LeaferUI = function(exports) {
3083
3094
  }
3084
3095
  paint() {}
3085
3096
  }
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;
3097
+ 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
3098
  const debug$c = Debug.get("PathDrawer");
3088
3099
  const PathDrawer = {
3089
3100
  drawPathByData(drawer, data) {
@@ -3123,7 +3134,7 @@ var LeaferUI = function(exports) {
3123
3134
  i += 5;
3124
3135
  break;
3125
3136
 
3126
- case D$1:
3137
+ case D$2:
3127
3138
  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
3139
  i += 9;
3129
3140
  break;
@@ -3165,9 +3176,9 @@ var LeaferUI = function(exports) {
3165
3176
  }
3166
3177
  }
3167
3178
  };
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;
3179
+ 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
3180
  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;
3181
+ const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3171
3182
  const debug$b = Debug.get("PathBounds");
3172
3183
  let radius, radiusX, radiusY;
3173
3184
  const tempPointBounds = {};
@@ -3233,17 +3244,17 @@ var LeaferUI = function(exports) {
3233
3244
  i += 5;
3234
3245
  break;
3235
3246
 
3236
- case D:
3247
+ case D$1:
3237
3248
  case X:
3238
3249
  x = data[i + 1];
3239
3250
  y = data[i + 2];
3240
3251
  addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
3241
- i += command === D ? 9 : 6;
3252
+ i += command === D$1 ? 9 : 6;
3242
3253
  break;
3243
3254
 
3244
3255
  case G:
3245
3256
  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);
3257
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3247
3258
  x = setEndPoint.x;
3248
3259
  y = setEndPoint.y;
3249
3260
  i += 9;
@@ -3261,7 +3272,7 @@ var LeaferUI = function(exports) {
3261
3272
 
3262
3273
  case O:
3263
3274
  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);
3275
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3265
3276
  x = setEndPoint.x;
3266
3277
  y = setEndPoint.y;
3267
3278
  i += 7;
@@ -3278,7 +3289,7 @@ var LeaferUI = function(exports) {
3278
3289
 
3279
3290
  case U:
3280
3291
  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);
3292
+ i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3282
3293
  x = setEndPoint.x;
3283
3294
  y = setEndPoint.y;
3284
3295
  i += 6;
@@ -3896,6 +3907,16 @@ var LeaferUI = function(exports) {
3896
3907
  }
3897
3908
  }));
3898
3909
  }
3910
+ function scrollType(defaultValue, checkFiniteNumber) {
3911
+ return decorateLeafAttr(defaultValue, key => attr({
3912
+ set(value) {
3913
+ if (this.__setAttr(key, value, checkFiniteNumber)) {
3914
+ this.__layout.matrixChanged || this.__layout.matrixChange();
3915
+ this.__scrollWorld || (this.__scrollWorld = {});
3916
+ }
3917
+ }
3918
+ }));
3919
+ }
3899
3920
  function autoLayoutType(defaultValue) {
3900
3921
  return decorateLeafAttr(defaultValue, key => attr({
3901
3922
  set(value) {
@@ -4198,7 +4219,7 @@ var LeaferUI = function(exports) {
4198
4219
  EventCreator.register(target);
4199
4220
  };
4200
4221
  }
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;
4222
+ 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
4223
  const matrix$1 = {}, {round: round} = Math;
4203
4224
  const LeafHelper = {
4204
4225
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
@@ -4272,7 +4293,7 @@ var LeaferUI = function(exports) {
4272
4293
  x: x,
4273
4294
  y: y
4274
4295
  };
4275
- isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true);
4296
+ isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
4276
4297
  L.moveLocal(t, local.x, local.y, transition);
4277
4298
  },
4278
4299
  moveLocal(t, x, y = 0, transition) {
@@ -4294,9 +4315,9 @@ var LeaferUI = function(exports) {
4294
4315
  if (scaleY) transition = scaleY;
4295
4316
  scaleY = scaleX;
4296
4317
  }
4297
- copy$7(matrix$1, o);
4318
+ copy$6(matrix$1, o);
4298
4319
  scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4299
- if (t.origin || t.around) {
4320
+ if (L.hasHighPosition(t)) {
4300
4321
  L.setTransform(t, matrix$1, resize, transition);
4301
4322
  } else {
4302
4323
  const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
@@ -4313,9 +4334,9 @@ var LeaferUI = function(exports) {
4313
4334
  },
4314
4335
  rotateOfLocal(t, origin, angle, transition) {
4315
4336
  const o = t.__localMatrix;
4316
- copy$7(matrix$1, o);
4337
+ copy$6(matrix$1, o);
4317
4338
  rotateOfOuter$2(matrix$1, origin, angle);
4318
- if (t.origin || t.around) L.setTransform(t, matrix$1, false, transition); else t.set({
4339
+ if (L.hasHighPosition(t)) L.setTransform(t, matrix$1, false, transition); else t.set({
4319
4340
  x: t.x + matrix$1.e - o.e,
4320
4341
  y: t.y + matrix$1.f - o.f,
4321
4342
  rotation: MathHelper.formatRotation(t.rotation + angle)
@@ -4325,24 +4346,28 @@ var LeaferUI = function(exports) {
4325
4346
  L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4326
4347
  },
4327
4348
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4328
- copy$7(matrix$1, t.__localMatrix);
4349
+ copy$6(matrix$1, t.__localMatrix);
4329
4350
  skewOfOuter(matrix$1, origin, skewX, skewY);
4330
4351
  L.setTransform(t, matrix$1, resize, transition);
4331
4352
  },
4332
4353
  transformWorld(t, transform, resize, transition) {
4333
- copy$7(matrix$1, t.worldTransform);
4354
+ copy$6(matrix$1, t.worldTransform);
4334
4355
  multiplyParent$3(matrix$1, transform);
4335
- if (t.parent) divideParent(matrix$1, t.parent.worldTransform);
4356
+ if (t.parent) divideParent(matrix$1, t.parent.scrollWorldTransform);
4336
4357
  L.setTransform(t, matrix$1, resize, transition);
4337
4358
  },
4338
4359
  transform(t, transform, resize, transition) {
4339
- copy$7(matrix$1, t.localTransform);
4360
+ copy$6(matrix$1, t.localTransform);
4340
4361
  multiplyParent$3(matrix$1, transform);
4341
4362
  L.setTransform(t, matrix$1, resize, transition);
4342
4363
  },
4343
4364
  setTransform(t, transform, resize, transition) {
4344
4365
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
4345
4366
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
4367
+ if (L.hasOffset(t)) {
4368
+ layout.x -= data.offsetX;
4369
+ layout.y -= data.offsetY;
4370
+ }
4346
4371
  if (resize) {
4347
4372
  const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
4348
4373
  delete layout.scaleX, delete layout.scaleY;
@@ -4370,14 +4395,20 @@ var LeaferUI = function(exports) {
4370
4395
  return innerOrigin;
4371
4396
  },
4372
4397
  getRelativeWorld(t, relative, temp) {
4373
- copy$7(matrix$1, t.worldTransform);
4374
- divideParent(matrix$1, relative.worldTransform);
4398
+ copy$6(matrix$1, t.worldTransform);
4399
+ divideParent(matrix$1, relative.scrollWorldTransform);
4375
4400
  return temp ? matrix$1 : Object.assign({}, matrix$1);
4376
4401
  },
4377
4402
  drop(t, parent, index, resize) {
4378
4403
  t.setTransform(L.getRelativeWorld(t, parent, true), resize);
4379
4404
  parent.add(t, index);
4380
4405
  },
4406
+ hasHighPosition(t) {
4407
+ return t.origin || t.around || L.hasOffset(t);
4408
+ },
4409
+ hasOffset(t) {
4410
+ return t.offsetX || t.offsetY;
4411
+ },
4381
4412
  hasParent(p, parent) {
4382
4413
  if (!parent) return false;
4383
4414
  while (p) {
@@ -4400,8 +4431,7 @@ var LeaferUI = function(exports) {
4400
4431
  const L = LeafHelper;
4401
4432
  const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
4402
4433
  function getTempLocal(t, world) {
4403
- t.__layout.update();
4404
- return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
4434
+ return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
4405
4435
  }
4406
4436
  const LeafBoundsHelper = {
4407
4437
  worldBounds(target) {
@@ -4517,7 +4547,7 @@ var LeaferUI = function(exports) {
4517
4547
  }
4518
4548
  };
4519
4549
  const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
4520
- const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$6} = BoundsHelper;
4550
+ const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$5} = BoundsHelper;
4521
4551
  const localContent = "_localContentBounds";
4522
4552
  const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
4523
4553
  class LeafLayout {
@@ -4753,7 +4783,7 @@ var LeaferUI = function(exports) {
4753
4783
  matrix = getRelativeWorld$1(leaf, relative, true);
4754
4784
  }
4755
4785
  if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
4756
- copy$6(layoutBounds, bounds);
4786
+ copy$5(layoutBounds, bounds);
4757
4787
  PointHelper.copy(layoutBounds, point);
4758
4788
  if (unscale) {
4759
4789
  const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
@@ -4932,6 +4962,7 @@ var LeaferUI = function(exports) {
4932
4962
  ChildEvent.MOUNTED = "mounted";
4933
4963
  ChildEvent.UNMOUNTED = "unmounted";
4934
4964
  ChildEvent.DESTROY = "destroy";
4965
+ const SCROLL = "property.scroll";
4935
4966
  class PropertyEvent extends Event {
4936
4967
  constructor(type, target, attrName, oldValue, newValue) {
4937
4968
  super(type, target);
@@ -4942,6 +4973,11 @@ var LeaferUI = function(exports) {
4942
4973
  }
4943
4974
  PropertyEvent.CHANGE = "property.change";
4944
4975
  PropertyEvent.LEAFER_CHANGE = "property.leafer_change";
4976
+ PropertyEvent.SCROLL = SCROLL;
4977
+ const extraPropertyEventMap = {
4978
+ scrollX: SCROLL,
4979
+ scrollY: SCROLL
4980
+ };
4945
4981
  class ImageEvent extends Event {
4946
4982
  constructor(type, data) {
4947
4983
  super(type);
@@ -5163,7 +5199,9 @@ var LeaferUI = function(exports) {
5163
5199
  if (!id) return;
5164
5200
  const list = isArray(id) ? id : [ id ];
5165
5201
  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);
5202
+ if (item) {
5203
+ 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);
5204
+ }
5167
5205
  });
5168
5206
  list.length = 0;
5169
5207
  }
@@ -5252,8 +5290,6 @@ var LeaferUI = function(exports) {
5252
5290
  }
5253
5291
  if (isObject(newValue) || oldValue !== newValue) {
5254
5292
  this.__realSetAttr(name, newValue);
5255
- const {CHANGE: CHANGE} = PropertyEvent;
5256
- const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
5257
5293
  if (this.isLeafer) {
5258
5294
  this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
5259
5295
  const transformEventName = leaferTransformAttrMap[name];
@@ -5261,10 +5297,10 @@ var LeaferUI = function(exports) {
5261
5297
  this.emitEvent(new LeaferEvent(transformEventName, this));
5262
5298
  this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this));
5263
5299
  }
5264
- } else {
5265
- if (this.hasEvent(CHANGE)) this.emitEvent(event);
5266
5300
  }
5267
- this.leafer.emitEvent(event);
5301
+ this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue);
5302
+ const extraPropertyEvent = extraPropertyEventMap[name];
5303
+ if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue);
5268
5304
  return true;
5269
5305
  } else {
5270
5306
  return false;
@@ -5274,6 +5310,11 @@ var LeaferUI = function(exports) {
5274
5310
  return true;
5275
5311
  }
5276
5312
  },
5313
+ emitPropertyEvent(type, name, oldValue, newValue) {
5314
+ const event = new PropertyEvent(type, this, name, oldValue, newValue);
5315
+ this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
5316
+ this.leafer.emitEvent(event);
5317
+ },
5277
5318
  __realSetAttr(name, newValue) {
5278
5319
  const data = this.__;
5279
5320
  data[name] = newValue;
@@ -5289,8 +5330,9 @@ var LeaferUI = function(exports) {
5289
5330
  const {toPoint: toPoint$3, tempPoint: tempPoint} = AroundHelper;
5290
5331
  const LeafMatrix = {
5291
5332
  __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.__);
5333
+ const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
5334
+ multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
5335
+ if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
5294
5336
  },
5295
5337
  __updateLocalMatrix() {
5296
5338
  if (this.__local) {
@@ -5313,7 +5355,7 @@ var LeaferUI = function(exports) {
5313
5355
  };
5314
5356
  const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
5315
5357
  const {updateBounds: updateBounds$1} = BranchHelper;
5316
- const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5} = BoundsHelper;
5358
+ const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4} = BoundsHelper;
5317
5359
  const {toBounds: toBounds$1} = PathBounds;
5318
5360
  const LeafBounds = {
5319
5361
  __updateWorldBounds() {
@@ -5382,7 +5424,7 @@ var LeaferUI = function(exports) {
5382
5424
  __updateLocalRenderBounds() {
5383
5425
  toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
5384
5426
  },
5385
- __updateBoxBounds() {
5427
+ __updateBoxBounds(_secondLayout, _bounds) {
5386
5428
  const b = this.__layout.boxBounds;
5387
5429
  const data = this.__;
5388
5430
  if (data.__pathInputed) {
@@ -5416,13 +5458,13 @@ var LeaferUI = function(exports) {
5416
5458
  data.__naturalWidth = layout.boxBounds.width;
5417
5459
  data.__naturalHeight = layout.boxBounds.height;
5418
5460
  },
5419
- __updateStrokeBounds() {
5461
+ __updateStrokeBounds(_bounds) {
5420
5462
  const layout = this.__layout;
5421
5463
  copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5422
5464
  },
5423
- __updateRenderBounds() {
5465
+ __updateRenderBounds(_bounds) {
5424
5466
  const layout = this.__layout;
5425
- layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5467
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
5426
5468
  }
5427
5469
  };
5428
5470
  const LeafRender = {
@@ -5513,7 +5555,7 @@ var LeaferUI = function(exports) {
5513
5555
  const {LEAF: LEAF, create: create} = IncrementId;
5514
5556
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
5515
5557
  const {toOuterOf: toOuterOf} = BoundsHelper;
5516
- const {copy: copy$4, move: move} = PointHelper;
5558
+ const {copy: copy$3, move: move} = PointHelper;
5517
5559
  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
5560
  exports.Leaf = class Leaf {
5519
5561
  get tag() {
@@ -5559,6 +5601,10 @@ var LeaferUI = function(exports) {
5559
5601
  get localTransform() {
5560
5602
  return this.__layout.getTransform("local");
5561
5603
  }
5604
+ get scrollWorldTransform() {
5605
+ this.updateLayout();
5606
+ return this.__scrollWorld || this.__world;
5607
+ }
5562
5608
  get boxBounds() {
5563
5609
  return this.getBounds("box", "inner");
5564
5610
  }
@@ -5575,7 +5621,7 @@ var LeaferUI = function(exports) {
5575
5621
  return this.getBounds("render");
5576
5622
  }
5577
5623
  get worldOpacity() {
5578
- this.__layout.update();
5624
+ this.updateLayout();
5579
5625
  return this.__worldOpacity;
5580
5626
  }
5581
5627
  get __worldFlipped() {
@@ -5750,10 +5796,10 @@ var LeaferUI = function(exports) {
5750
5796
  __updateLocalBoxBounds() {}
5751
5797
  __updateLocalStrokeBounds() {}
5752
5798
  __updateLocalRenderBounds() {}
5753
- __updateBoxBounds() {}
5799
+ __updateBoxBounds(_secondLayout, _bounds) {}
5754
5800
  __updateContentBounds() {}
5755
- __updateStrokeBounds() {}
5756
- __updateRenderBounds() {}
5801
+ __updateStrokeBounds(_bounds) {}
5802
+ __updateRenderBounds(_bounds) {}
5757
5803
  __updateAutoLayout() {}
5758
5804
  __updateFlowLayout() {}
5759
5805
  __updateNaturalSize() {}
@@ -5825,14 +5871,14 @@ var LeaferUI = function(exports) {
5825
5871
  if (this.parent) {
5826
5872
  this.parent.worldToInner(world, to, distance, relative);
5827
5873
  } else {
5828
- if (to) copy$4(to, world);
5874
+ if (to) copy$3(to, world);
5829
5875
  }
5830
5876
  }
5831
5877
  localToWorld(local, to, distance, relative) {
5832
5878
  if (this.parent) {
5833
5879
  this.parent.innerToWorld(local, to, distance, relative);
5834
5880
  } else {
5835
- if (to) copy$4(to, local);
5881
+ if (to) copy$3(to, local);
5836
5882
  }
5837
5883
  }
5838
5884
  worldToInner(world, to, distance, relative) {
@@ -6047,14 +6093,14 @@ var LeaferUI = function(exports) {
6047
6093
  }
6048
6094
  return 0;
6049
6095
  }
6050
- __updateBoxBounds() {
6051
- setListWithFn(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6096
+ __updateBoxBounds(_secondLayout, bounds) {
6097
+ setListWithFn(bounds || this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds);
6052
6098
  }
6053
- __updateStrokeBounds() {
6054
- setListWithFn(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6099
+ __updateStrokeBounds(bounds) {
6100
+ setListWithFn(bounds || this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalStrokeBounds : localStrokeBounds);
6055
6101
  }
6056
- __updateRenderBounds() {
6057
- setListWithFn(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6102
+ __updateRenderBounds(bounds) {
6103
+ setListWithFn(bounds || this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds);
6058
6104
  }
6059
6105
  __updateSortChildren() {
6060
6106
  let affectSort;
@@ -6297,7 +6343,7 @@ var LeaferUI = function(exports) {
6297
6343
  this.levelMap = null;
6298
6344
  }
6299
6345
  }
6300
- const version = "1.9.1";
6346
+ const version = "1.9.2";
6301
6347
  const debug$5 = Debug.get("LeaferCanvas");
6302
6348
  class LeaferCanvas extends LeaferCanvasBase {
6303
6349
  set zIndex(zIndex) {
@@ -6985,8 +7031,8 @@ var LeaferUI = function(exports) {
6985
7031
  const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
6986
7032
  canvas.save();
6987
7033
  bounds.spread(Renderer.clipSpread).ceil();
6988
- canvas.clearWorld(bounds, true);
6989
- canvas.clipWorld(bounds, true);
7034
+ canvas.clearWorld(bounds);
7035
+ canvas.clipWorld(bounds);
6990
7036
  this.__render(bounds, realBounds);
6991
7037
  canvas.restore();
6992
7038
  Run.end(t);
@@ -7206,6 +7252,7 @@ var LeaferUI = function(exports) {
7206
7252
  hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
7207
7253
  if (child.isBranch) {
7208
7254
  if (hit || child.__ignoreHitWorld) {
7255
+ if (child.topChildren) this.eachFind(child.topChildren, false);
7209
7256
  this.eachFind(child.children, child.__onlyHitMask);
7210
7257
  if (child.isBranchLeaf) this.hitChild(child, point);
7211
7258
  }
@@ -7525,7 +7572,7 @@ var LeaferUI = function(exports) {
7525
7572
  }
7526
7573
  get __clipAfterFill() {
7527
7574
  const t = this;
7528
- return t.overflow === "hide" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
7575
+ return t.overflow !== "show" && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill);
7529
7576
  }
7530
7577
  }
7531
7578
  class LeaferData extends GroupData {
@@ -7666,6 +7713,39 @@ var LeaferUI = function(exports) {
7666
7713
  return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
7667
7714
  }
7668
7715
  };
7716
+ const DragBoundsHelper = {
7717
+ getValidMove(content, dragBounds, dragBoundsType, move, change) {
7718
+ const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
7719
+ const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
7720
+ if (!change) move = Object.assign({}, move);
7721
+ const isBiggerWidth = content.width > dragBounds.width;
7722
+ const isBiggerHeight = content.height > dragBounds.height;
7723
+ if (isBiggerWidth && dragBoundsType !== "outer") {
7724
+ if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
7725
+ } else {
7726
+ if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
7727
+ }
7728
+ if (isBiggerHeight && dragBoundsType !== "outer") {
7729
+ if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
7730
+ } else {
7731
+ if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
7732
+ }
7733
+ move.x = MathHelper.float(move.x);
7734
+ move.y = MathHelper.float(move.y);
7735
+ return move;
7736
+ },
7737
+ axisMove(leaf, move) {
7738
+ const {draggable: draggable} = leaf;
7739
+ if (draggable === "x") move.y = 0;
7740
+ if (draggable === "y") move.x = 0;
7741
+ },
7742
+ limitMove(leaf, move) {
7743
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7744
+ if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
7745
+ D.axisMove(leaf, move);
7746
+ }
7747
+ };
7748
+ const D = DragBoundsHelper;
7669
7749
  const {stintSet: stintSet$1} = DataHelper;
7670
7750
  const UIRender = {
7671
7751
  __updateChange() {
@@ -7949,8 +8029,8 @@ var LeaferUI = function(exports) {
7949
8029
  __decorate([ rotationType(0, true) ], exports.UI.prototype, "skewY", void 0);
7950
8030
  __decorate([ positionType(0, true) ], exports.UI.prototype, "offsetX", void 0);
7951
8031
  __decorate([ positionType(0, true) ], exports.UI.prototype, "offsetY", void 0);
7952
- __decorate([ positionType(0, true) ], exports.UI.prototype, "scrollX", void 0);
7953
- __decorate([ positionType(0, true) ], exports.UI.prototype, "scrollY", void 0);
8032
+ __decorate([ scrollType(0, true) ], exports.UI.prototype, "scrollX", void 0);
8033
+ __decorate([ scrollType(0, true) ], exports.UI.prototype, "scrollY", void 0);
7954
8034
  __decorate([ autoLayoutType() ], exports.UI.prototype, "origin", void 0);
7955
8035
  __decorate([ autoLayoutType() ], exports.UI.prototype, "around", void 0);
7956
8036
  __decorate([ dataType(false) ], exports.UI.prototype, "lazy", void 0);
@@ -7965,6 +8045,7 @@ var LeaferUI = function(exports) {
7965
8045
  __decorate([ boundsType() ], exports.UI.prototype, "heightRange", void 0);
7966
8046
  __decorate([ dataType(false) ], exports.UI.prototype, "draggable", void 0);
7967
8047
  __decorate([ dataType() ], exports.UI.prototype, "dragBounds", void 0);
8048
+ __decorate([ dataType("auto") ], exports.UI.prototype, "dragBoundsType", void 0);
7968
8049
  __decorate([ dataType(false) ], exports.UI.prototype, "editable", void 0);
7969
8050
  __decorate([ hitType(true) ], exports.UI.prototype, "hittable", void 0);
7970
8051
  __decorate([ hitType("path") ], exports.UI.prototype, "hitFill", void 0);
@@ -8348,7 +8429,7 @@ var LeaferUI = function(exports) {
8348
8429
  zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
8349
8430
  return Plugin.need("view");
8350
8431
  }
8351
- getValidMove(moveX, moveY) {
8432
+ getValidMove(moveX, moveY, _checkLimit) {
8352
8433
  return {
8353
8434
  x: moveX,
8354
8435
  y: moveY
@@ -8429,9 +8510,8 @@ var LeaferUI = function(exports) {
8429
8510
  };
8430
8511
  __decorate([ dataProcessor(RectData) ], exports.Rect.prototype, "__", void 0);
8431
8512
  exports.Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], exports.Rect);
8432
- const {copy: copy$3, add: add, includes: includes$1} = BoundsHelper;
8513
+ const {add: add, includes: includes$1, scroll: scroll} = BoundsHelper;
8433
8514
  const rect$1 = exports.Rect.prototype, group = exports.Group.prototype;
8434
- const childrenRenderBounds = {};
8435
8515
  exports.Box = class Box extends exports.Group {
8436
8516
  get __tag() {
8437
8517
  return "Box";
@@ -8477,22 +8557,24 @@ var LeaferUI = function(exports) {
8477
8557
  __updateRenderBounds() {
8478
8558
  let isOverflow;
8479
8559
  if (this.children.length) {
8480
- const data = this.__, {renderBounds: renderBounds, boxBounds: boxBounds} = this.__layout;
8481
- super.__updateRenderBounds();
8482
- copy$3(childrenRenderBounds, renderBounds);
8560
+ const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
8561
+ const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
8562
+ super.__updateRenderBounds(childrenRenderBounds);
8563
+ scroll(childrenRenderBounds, data);
8483
8564
  this.__updateRectRenderBounds();
8484
- if (data.scrollY || data.scrollX) {
8485
- childrenRenderBounds.x += data.scrollX;
8486
- childrenRenderBounds.y += data.scrollY;
8487
- }
8488
8565
  isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8489
- if (isOverflow && data.overflow !== "hide") add(renderBounds, childrenRenderBounds);
8566
+ if (isOverflow && data.overflow === "show") add(renderBounds, childrenRenderBounds);
8490
8567
  } else this.__updateRectRenderBounds();
8491
8568
  DataHelper.stintSet(this, "isOverflow", isOverflow);
8492
- this.__updateScrollBar();
8569
+ this.__checkScroll();
8493
8570
  }
8494
8571
  __updateRectRenderBounds() {}
8495
- __updateScrollBar() {}
8572
+ __updateWorldBounds() {
8573
+ if (this.hasScroller) this.__updateScroll();
8574
+ super.__updateWorldBounds();
8575
+ }
8576
+ __checkScroll() {}
8577
+ __updateScroll() {}
8496
8578
  __updateRectChange() {}
8497
8579
  __updateChange() {
8498
8580
  super.__updateChange();
@@ -8507,7 +8589,7 @@ var LeaferUI = function(exports) {
8507
8589
  this.__renderRect(canvas, options);
8508
8590
  if (this.children.length) this.__renderGroup(canvas, options);
8509
8591
  }
8510
- if (this.scrollBar) this.scrollBar.__render(canvas, options);
8592
+ if (this.hasScroller) this.scroller.__render(canvas, options);
8511
8593
  }
8512
8594
  __drawContent(canvas, options) {
8513
8595
  this.__renderGroup(canvas, options);
@@ -9071,7 +9153,7 @@ var LeaferUI = function(exports) {
9071
9153
  if (this.viewReady) this.renderer.update();
9072
9154
  }
9073
9155
  __render(canvas, options) {
9074
- if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
9156
+ if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
9075
9157
  }
9076
9158
  __onResize(event) {
9077
9159
  this.forEach(leafer => leafer.resize(event));
@@ -9210,26 +9292,11 @@ var LeaferUI = function(exports) {
9210
9292
  const move = leaf.getLocalPoint(total, null, true);
9211
9293
  PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9212
9294
  if (checkLimit) this.limitMove(leaf, move);
9295
+ DragBoundsHelper.axisMove(leaf, move);
9213
9296
  return move;
9214
9297
  }
9215
9298
  static limitMove(leaf, move) {
9216
- const {draggable: draggable, dragBounds: dragBounds} = leaf;
9217
- if (dragBounds) this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, move, true);
9218
- if (draggable === "x") move.y = 0;
9219
- if (draggable === "y") move.x = 0;
9220
- }
9221
- static getMoveInDragBounds(childBox, dragBounds, move, change) {
9222
- const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9223
- const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9224
- if (!change) move = Object.assign({}, move);
9225
- if (BoundsHelper.includes(childBox, dragBounds)) {
9226
- if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
9227
- if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
9228
- } else {
9229
- if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
9230
- if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
9231
- }
9232
- return move;
9299
+ DragBoundsHelper.limitMove(leaf, move);
9233
9300
  }
9234
9301
  getPageMove(total) {
9235
9302
  this.assignMove(total);
@@ -9464,11 +9531,12 @@ var LeaferUI = function(exports) {
9464
9531
  const checkLimitMove = !dragLimitAnimate || !!isDragEnd;
9465
9532
  list.forEach(leaf => {
9466
9533
  if (leaf.draggable) {
9534
+ const axisDrag = isString(leaf.draggable);
9467
9535
  const move = exports.DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], {
9468
9536
  x: totalX,
9469
9537
  y: totalY
9470
- }, checkLimitMove);
9471
- if (dragLimitAnimate && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
9538
+ }, checkLimitMove || axisDrag);
9539
+ if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
9472
9540
  }
9473
9541
  });
9474
9542
  }
@@ -11442,7 +11510,7 @@ var LeaferUI = function(exports) {
11442
11510
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
11443
11511
  }
11444
11512
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11445
- if (end && index < end) other.clearWorld(copyBounds, true);
11513
+ if (end && index < end) other.clearWorld(copyBounds);
11446
11514
  });
11447
11515
  other.recycle(copyBounds);
11448
11516
  }
@@ -11502,7 +11570,7 @@ var LeaferUI = function(exports) {
11502
11570
  }
11503
11571
  other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
11504
11572
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11505
- if (end && index < end) other.clearWorld(copyBounds, true);
11573
+ if (end && index < end) other.clearWorld(copyBounds);
11506
11574
  });
11507
11575
  other.recycle(copyBounds);
11508
11576
  }
@@ -11591,7 +11659,7 @@ var LeaferUI = function(exports) {
11591
11659
  canvas.resetTransform();
11592
11660
  canvas.opacity = maskOpacity;
11593
11661
  canvas.copyWorld(content, realBounds, undefined, blendMode);
11594
- recycle ? content.recycle(realBounds) : content.clearWorld(realBounds, true);
11662
+ recycle ? content.recycle(realBounds) : content.clearWorld(realBounds);
11595
11663
  }
11596
11664
  const money = "¥¥$€££¢¢";
11597
11665
  const letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
@@ -12096,6 +12164,7 @@ var LeaferUI = function(exports) {
12096
12164
  exports.Cursor = Cursor;
12097
12165
  exports.DataHelper = DataHelper;
12098
12166
  exports.Debug = Debug;
12167
+ exports.DragBoundsHelper = DragBoundsHelper;
12099
12168
  exports.Dragger = Dragger;
12100
12169
  exports.Effect = Effect;
12101
12170
  exports.EllipseData = EllipseData;
@@ -12218,6 +12287,7 @@ var LeaferUI = function(exports) {
12218
12287
  exports.effectType = effectType;
12219
12288
  exports.emptyData = emptyData;
12220
12289
  exports.eraserType = eraserType;
12290
+ exports.extraPropertyEventMap = extraPropertyEventMap;
12221
12291
  exports.getBoundsData = getBoundsData;
12222
12292
  exports.getDescriptor = getDescriptor;
12223
12293
  exports.getMatrixData = getMatrixData;
@@ -12248,6 +12318,7 @@ var LeaferUI = function(exports) {
12248
12318
  exports.rewriteAble = rewriteAble;
12249
12319
  exports.rotationType = rotationType;
12250
12320
  exports.scaleType = scaleType;
12321
+ exports.scrollType = scrollType;
12251
12322
  exports.sortType = sortType;
12252
12323
  exports.strokeType = strokeType;
12253
12324
  exports.surfaceType = surfaceType;