@leafer/worker 1.12.0 → 1.12.1

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
@@ -4652,9 +4652,52 @@ var LeaferUI = function(exports) {
4652
4652
  if (exclude && exclude === branch) continue;
4653
4653
  updateBounds$4(branch);
4654
4654
  }
4655
+ },
4656
+ move(branch, x, y) {
4657
+ let w;
4658
+ const {children: children} = branch;
4659
+ for (let i = 0, len = children.length; i < len; i++) {
4660
+ branch = children[i];
4661
+ w = branch.__world;
4662
+ w.e += x;
4663
+ w.f += y;
4664
+ w.x += x;
4665
+ w.y += y;
4666
+ if (branch.isBranch) move$9(branch, x, y);
4667
+ }
4668
+ },
4669
+ scale(branch, x, y, scaleX, scaleY, a, b) {
4670
+ let w;
4671
+ const {children: children} = branch;
4672
+ const changeScaleX = scaleX - 1;
4673
+ const changeScaleY = scaleY - 1;
4674
+ for (let i = 0, len = children.length; i < len; i++) {
4675
+ branch = children[i];
4676
+ w = branch.__world;
4677
+ w.a *= scaleX;
4678
+ w.d *= scaleY;
4679
+ if (w.b || w.c) {
4680
+ w.b *= scaleX;
4681
+ w.c *= scaleY;
4682
+ }
4683
+ if (w.e === w.x && w.f === w.y) {
4684
+ w.x = w.e += (w.e - a) * changeScaleX + x;
4685
+ w.y = w.f += (w.f - b) * changeScaleY + y;
4686
+ } else {
4687
+ w.e += (w.e - a) * changeScaleX + x;
4688
+ w.f += (w.f - b) * changeScaleY + y;
4689
+ w.x += (w.x - a) * changeScaleX + x;
4690
+ w.y += (w.y - b) * changeScaleY + y;
4691
+ }
4692
+ w.width *= scaleX;
4693
+ w.height *= scaleY;
4694
+ w.scaleX *= scaleX;
4695
+ w.scaleY *= scaleY;
4696
+ if (branch.isBranch) scale$2(branch, x, y, scaleX, scaleY, a, b);
4697
+ }
4655
4698
  }
4656
4699
  };
4657
- const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack} = BranchHelper;
4700
+ const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$2} = BranchHelper;
4658
4701
  const WaitHelper = {
4659
4702
  run(wait) {
4660
4703
  if (wait && wait.length) {
@@ -6118,10 +6161,10 @@ var LeaferUI = function(exports) {
6118
6161
  hit(_world, _hitRadius) {
6119
6162
  return true;
6120
6163
  }
6121
- __hitWorld(_point) {
6164
+ __hitWorld(_point, _forceHitFill) {
6122
6165
  return true;
6123
6166
  }
6124
- __hit(_local) {
6167
+ __hit(_local, _forceHitFill) {
6125
6168
  return true;
6126
6169
  }
6127
6170
  __hitFill(_inner) {
@@ -6470,7 +6513,7 @@ var LeaferUI = function(exports) {
6470
6513
  this.levelMap = null;
6471
6514
  }
6472
6515
  }
6473
- const version = "1.12.0";
6516
+ const version = "1.12.1";
6474
6517
  class LeaferCanvas extends LeaferCanvasBase {
6475
6518
  get allowBackgroundColor() {
6476
6519
  return true;
@@ -7223,7 +7266,7 @@ var LeaferUI = function(exports) {
7223
7266
  hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
7224
7267
  if (child.isBranch) {
7225
7268
  if (hit || child.__ignoreHitWorld) {
7226
- if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point)) continue;
7269
+ if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point, true)) continue;
7227
7270
  if (child.topChildren) this.eachFind(child.topChildren, false);
7228
7271
  this.eachFind(child.children, child.__onlyHitMask);
7229
7272
  if (child.isBranchLeaf) this.hitChild(child, point);
@@ -10189,7 +10232,7 @@ var LeaferUI = function(exports) {
10189
10232
  target: this
10190
10233
  }) : this.__hitWorld(worldRadiusPoint);
10191
10234
  };
10192
- leaf$1.__hitWorld = function(point) {
10235
+ leaf$1.__hitWorld = function(point, forceHitFill) {
10193
10236
  const data = this.__;
10194
10237
  if (!data.hitSelf) return false;
10195
10238
  const world = this.__world, layout = this.__layout;
@@ -10207,7 +10250,7 @@ var LeaferUI = function(exports) {
10207
10250
  this.__updateHitCanvas();
10208
10251
  if (!layout.boundsChanged) layout.hitCanvasChanged = false;
10209
10252
  }
10210
- return this.__hit(inner);
10253
+ return this.__hit(inner, forceHitFill);
10211
10254
  };
10212
10255
  leaf$1.__hitFill = function(inner) {
10213
10256
  const h = this.__hitCanvas;
@@ -10266,12 +10309,12 @@ var LeaferUI = function(exports) {
10266
10309
  this.__drawHitPath(h);
10267
10310
  h.setStrokeOptions(data);
10268
10311
  };
10269
- ui$5.__hit = function(inner) {
10312
+ ui$5.__hit = function(inner, forceHitFill) {
10270
10313
  if (this.__box && this.__box.__hit(inner)) return true;
10271
10314
  const data = this.__;
10272
10315
  if (data.__isHitPixel && this.__hitPixel(inner)) return true;
10273
10316
  const {hitFill: hitFill} = data;
10274
- const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all";
10317
+ const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
10275
10318
  if (needHitFillPath && this.__hitFill(inner)) return true;
10276
10319
  const {hitStroke: hitStroke, __maxStrokeWidth: strokeWidth} = data;
10277
10320
  const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";