@famibee/skynovel 1.20.1 → 1.22.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/web.js CHANGED
@@ -46030,7 +46030,7 @@ function setup(env) {
46030
46030
 
46031
46031
  /**
46032
46032
  * Selects a color for a debug namespace
46033
- * @param {String} namespace The namespace string for the for the debug instance to be colored
46033
+ * @param {String} namespace The namespace string for the debug instance to be colored
46034
46034
  * @return {Number|String} An ANSI color code for the given namespace
46035
46035
  * @api private
46036
46036
  */
@@ -47336,7 +47336,7 @@ name: framework-utils
47336
47336
  license: MIT
47337
47337
  author: Daybrush
47338
47338
  repository: git+https://github.com/daybrush/framework-utils.git
47339
- version: 0.3.4
47339
+ version: 1.1.0
47340
47340
  */
47341
47341
  function prefixNames(prefix) {
47342
47342
  var classNames = [];
@@ -47352,7 +47352,7 @@ function prefixNames(prefix) {
47352
47352
  }).join(" ");
47353
47353
  }
47354
47354
  function prefixCSS(prefix, css) {
47355
- return css.replace(/([^}{]*){/mg, function (_, selector) {
47355
+ return css.replace(/([^}{]*){/gm, function (_, selector) {
47356
47356
  return selector.replace(/\.([^{,\s\d.]+)/g, "." + prefix + "$1") + "{";
47357
47357
  });
47358
47358
  }
@@ -47389,7 +47389,7 @@ function withMethods(methods, duplicate) {
47389
47389
  methods.forEach(function (name) {
47390
47390
  var methodName = duplicate[name] || name;
47391
47391
 
47392
- if (prototype[methodName]) {
47392
+ if (methodName in prototype) {
47393
47393
  return;
47394
47394
  }
47395
47395
 
@@ -47449,7 +47449,7 @@ name: gesto
47449
47449
  license: MIT
47450
47450
  author: Daybrush
47451
47451
  repository: git+https://github.com/daybrush/gesture.git
47452
- version: 1.4.0
47452
+ version: 1.5.0
47453
47453
  */
47454
47454
 
47455
47455
 
@@ -47852,10 +47852,16 @@ function (_super) {
47852
47852
  var result = _this.moveClients(clients, e, false);
47853
47853
 
47854
47854
  if (_this.pinchFlag || result.deltaX || result.deltaY) {
47855
- _this.emit("drag", __assign({}, result, {
47855
+ var dragResult = _this.emit("drag", __assign({}, result, {
47856
47856
  isScroll: !!isScroll,
47857
47857
  inputEvent: e
47858
47858
  }));
47859
+
47860
+ if (dragResult === false) {
47861
+ _this.stop();
47862
+
47863
+ return;
47864
+ }
47859
47865
  }
47860
47866
 
47861
47867
  if (_this.pinchFlag) {
@@ -47951,12 +47957,23 @@ function (_super) {
47951
47957
  return _this;
47952
47958
  }
47953
47959
  /**
47954
- * The total moved distance
47960
+ * Stop Gesto's drag events.
47955
47961
  */
47956
47962
 
47957
47963
 
47958
47964
  var __proto = Gesto.prototype;
47959
47965
 
47966
+ __proto.stop = function () {
47967
+ this.isDrag = false;
47968
+ this.flag = false;
47969
+ this.clientStores = [];
47970
+ this.datas = {};
47971
+ };
47972
+ /**
47973
+ * The total moved distance
47974
+ */
47975
+
47976
+
47960
47977
  __proto.getMovement = function (clients) {
47961
47978
  return this.getCurrentStore().getMovement(clients) + this.clientStores.slice(1).reduce(function (prev, cur) {
47962
47979
  return prev + cur.movement;
@@ -48413,7 +48430,7 @@ name: moveable
48413
48430
  license: MIT
48414
48431
  author: Daybrush
48415
48432
  repository: git+https://github.com/daybrush/moveable.git
48416
- version: 0.26.0
48433
+ version: 0.27.2
48417
48434
  */
48418
48435
 
48419
48436
 
@@ -52027,7 +52044,7 @@ name: react-compat-css-styled
52027
52044
  license: MIT
52028
52045
  author: Daybrush
52029
52046
  repository: git+https://github.com/daybrush/css-styled.git
52030
- version: 1.0.6
52047
+ version: 1.0.8
52031
52048
  */
52032
52049
 
52033
52050
 
@@ -52039,7 +52056,7 @@ name: react-css-styled
52039
52056
  license: MIT
52040
52057
  author: Daybrush
52041
52058
  repository: https://github.com/daybrush/css-styled/tree/master/packages/react-css-styled
52042
- version: 1.0.2
52059
+ version: 1.0.3
52043
52060
  */
52044
52061
 
52045
52062
  /*! *****************************************************************************
@@ -52224,8 +52241,8 @@ __webpack_require__.r(__webpack_exports__);
52224
52241
  /* harmony import */ var _daybrush_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @daybrush/utils */ "./node_modules/@daybrush/utils/dist/utils.esm.js");
52225
52242
  /* harmony import */ var _scena_matrix__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @scena/matrix */ "./node_modules/@scena/matrix/dist/matrix.esm.js");
52226
52243
  /* harmony import */ var css_to_mat__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! css-to-mat */ "./node_modules/css-to-mat/dist/css-to-mat.esm.js");
52227
- /* harmony import */ var overlap_area__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! overlap-area */ "./node_modules/overlap-area/dist/overlap-area.esm.js");
52228
52244
  /* harmony import */ var _egjs_children_differ__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @egjs/children-differ */ "./node_modules/@egjs/children-differ/dist/children-differ.esm.js");
52245
+ /* harmony import */ var overlap_area__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! overlap-area */ "./node_modules/overlap-area/dist/overlap-area.esm.js");
52229
52246
  /* harmony import */ var _scena_dragscroll__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @scena/dragscroll */ "./node_modules/@scena/dragscroll/dist/dragscroll.esm.js");
52230
52247
  /* harmony import */ var react_simple_compat__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react-simple-compat */ "./node_modules/react-simple-compat/dist/compat.esm.js");
52231
52248
  /* harmony import */ var gesto__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! gesto */ "./node_modules/gesto/dist/gesto.esm.js");
@@ -52236,7 +52253,7 @@ name: react-compat-moveable
52236
52253
  license: MIT
52237
52254
  author: Daybrush
52238
52255
  repository: https://github.com/daybrush/moveable/blob/master/packages/react-compat-moveable
52239
- version: 0.14.0
52256
+ version: 0.15.2
52240
52257
  */
52241
52258
 
52242
52259
 
@@ -52256,7 +52273,7 @@ name: react-moveable
52256
52273
  license: MIT
52257
52274
  author: Daybrush
52258
52275
  repository: https://github.com/daybrush/moveable/blob/master/packages/react-moveable
52259
- version: 0.29.0
52276
+ version: 0.30.3
52260
52277
  */
52261
52278
 
52262
52279
  /*! *****************************************************************************
@@ -52369,7 +52386,10 @@ function getCursorCSS(degree) {
52369
52386
  var agent = (0,_egjs_agent__WEBPACK_IMPORTED_MODULE_0__["default"])();
52370
52387
  var IS_WEBKIT = agent.browser.webkit;
52371
52388
  var IS_WEBKIT605 = IS_WEBKIT && function () {
52372
- var res = /applewebkit\/([^\s]+)/g.exec(navigator.userAgent.toLowerCase());
52389
+ var navi = typeof window === "undefined" ? {
52390
+ userAgent: ""
52391
+ } : window.navigator;
52392
+ var res = /applewebkit\/([^\s]+)/g.exec(navi.userAgent.toLowerCase());
52373
52393
  return res ? parseFloat(res[1]) < 605 : false;
52374
52394
  }();
52375
52395
  var PREFIX = "moveable-";
@@ -52565,10 +52585,11 @@ function convert3DMatrixes(matrixes) {
52565
52585
  }
52566
52586
  });
52567
52587
  }
52568
- function getMatrixStackInfo(target, container) {
52588
+ function getMatrixStackInfo(target, container, checkContainer) {
52569
52589
  var el = target;
52570
52590
  var matrixes = [];
52571
- var isEnd = target === container;
52591
+ var requestEnd = !checkContainer && target === container;
52592
+ var isEnd = requestEnd;
52572
52593
  var is3d = false;
52573
52594
  var n = 3;
52574
52595
  var transformOrigin;
@@ -52584,6 +52605,7 @@ function getMatrixStackInfo(target, container) {
52584
52605
  // }
52585
52606
 
52586
52607
  while (el && !isEnd) {
52608
+ isEnd = requestEnd;
52587
52609
  var style = getComputedStyle(el);
52588
52610
  var position = style.position;
52589
52611
  var isFixed = position === "fixed";
@@ -52595,6 +52617,10 @@ function getMatrixStackInfo(target, container) {
52595
52617
  is3d = true;
52596
52618
  n = 4;
52597
52619
  convert3DMatrixes(matrixes);
52620
+
52621
+ if (targetMatrix) {
52622
+ targetMatrix = (0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.convertDimension)(targetMatrix, 3, 4);
52623
+ }
52598
52624
  }
52599
52625
 
52600
52626
  if (is3d && length === 9) {
@@ -52637,7 +52663,7 @@ function getMatrixStackInfo(target, container) {
52637
52663
  if (IS_WEBKIT && hasOffset && !isSVG && isStatic && (position === "relative" || position === "static")) {
52638
52664
  offsetLeft -= offsetParent.offsetLeft;
52639
52665
  offsetTop -= offsetParent.offsetTop;
52640
- isEnd = isEnd || isOffsetEnd;
52666
+ requestEnd = requestEnd || isOffsetEnd;
52641
52667
  }
52642
52668
 
52643
52669
  var parentClientLeft = 0;
@@ -52692,7 +52718,11 @@ function getMatrixStackInfo(target, container) {
52692
52718
  break;
52693
52719
  } else {
52694
52720
  el = offsetParent;
52695
- isEnd = isOffsetEnd;
52721
+ requestEnd = isOffsetEnd;
52722
+ }
52723
+
52724
+ if (!checkContainer || el === document.body) {
52725
+ isEnd = requestEnd;
52696
52726
  }
52697
52727
  }
52698
52728
 
@@ -52816,7 +52846,7 @@ function calculateMatrixStack(target, container, rootContainer, isAbsolute3d) {
52816
52846
  offsetContainer = _a.offsetContainer; // prevMatrix
52817
52847
 
52818
52848
 
52819
- var _b = getMatrixStackInfo(offsetContainer, rootContainer),
52849
+ var _b = getMatrixStackInfo(offsetContainer, rootContainer, true),
52820
52850
  rootMatrixes = _b.matrixes,
52821
52851
  isRoot3d = _b.is3d; // prevRootMatrix
52822
52852
  // if (rootContainer === document.body) {
@@ -53486,18 +53516,6 @@ function maxOffset() {
53486
53516
  });
53487
53517
  return args[0];
53488
53518
  }
53489
- function minOffset() {
53490
- var args = [];
53491
-
53492
- for (var _i = 0; _i < arguments.length; _i++) {
53493
- args[_i] = arguments[_i];
53494
- }
53495
-
53496
- args.sort(function (a, b) {
53497
- return Math.abs(a) - Math.abs(b);
53498
- });
53499
- return args[0];
53500
- }
53501
53519
  function calculateInversePosition(matrix, pos, n) {
53502
53520
  return (0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.calculate)((0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.invert)(matrix, n), (0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.convertPositionMatrix)(pos, n), n);
53503
53521
  }
@@ -54594,100 +54612,207 @@ function getAbsolutePosition(moveable, direction) {
54594
54612
  return getPosByDirection(getAbsolutePosesByState(moveable.state), direction);
54595
54613
  }
54596
54614
 
54597
- function calculateContainerPos(rootMatrix, containerRect, n) {
54598
- var clientPos = calculatePosition(rootMatrix, [containerRect.clientLeft, containerRect.clientTop], n);
54599
- return [containerRect.left + clientPos[0], containerRect.top + clientPos[1]];
54615
+ var VERTICAL_NAMES = ["left", "right", "center"];
54616
+ var HORIZONTAL_NAMES = ["top", "bottom", "middle"];
54617
+ var VERTICAL_NAMES_MAP = {
54618
+ start: "left",
54619
+ end: "right",
54620
+ center: "center"
54621
+ };
54622
+ var HORIZONTAL_NAMES_MAP = {
54623
+ start: "top",
54624
+ end: "bottom",
54625
+ center: "middle"
54626
+ };
54627
+ function hasGuidelines(moveable, ableName) {
54628
+ var _a = moveable.props,
54629
+ snappable = _a.snappable,
54630
+ bounds = _a.bounds,
54631
+ innerBounds = _a.innerBounds,
54632
+ verticalGuidelines = _a.verticalGuidelines,
54633
+ horizontalGuidelines = _a.horizontalGuidelines,
54634
+ snapGridWidth = _a.snapGridWidth,
54635
+ snapGridHeight = _a.snapGridHeight,
54636
+ _b = moveable.state,
54637
+ guidelines = _b.guidelines,
54638
+ enableSnap = _b.enableSnap;
54639
+
54640
+ if (!snappable || !enableSnap || ableName && snappable !== true && snappable.indexOf(ableName) < 0) {
54641
+ return false;
54642
+ }
54643
+
54644
+ if (snapGridWidth || snapGridHeight || bounds || innerBounds || guidelines && guidelines.length || verticalGuidelines && verticalGuidelines.length || horizontalGuidelines && horizontalGuidelines.length) {
54645
+ return true;
54646
+ }
54647
+
54648
+ return false;
54649
+ }
54650
+ function getSnapDirections(snapDirections) {
54651
+ if (snapDirections === false) {
54652
+ return {};
54653
+ } else if (snapDirections === true || !snapDirections) {
54654
+ return {
54655
+ left: true,
54656
+ right: true,
54657
+ top: true,
54658
+ bottom: true
54659
+ };
54660
+ }
54661
+
54662
+ return snapDirections;
54600
54663
  }
54601
- function getGapGuidelines(guidelines, type, snapThreshold, index, _a, _b) {
54602
- var start = _a[0],
54603
- end = _a[1];
54604
- var otherStart = _b[0],
54605
- otherEnd = _b[1];
54606
- var totalGuidelines = [];
54607
- var otherIndex = index ? 0 : 1;
54608
- var otherType = type === "vertical" ? "horizontal" : "vertical";
54609
- var elementGuidelines = groupBy(guidelines.filter(function (_a) {
54610
- var guidelineType = _a.type;
54611
- return guidelineType === type;
54612
- }), function (_a) {
54613
- var element = _a.element;
54614
- return element;
54615
- }).map(function (group) {
54616
- return group[0];
54617
- }).filter(function (_a) {
54618
- var pos = _a.pos,
54619
- sizes = _a.sizes;
54620
- return pos[otherIndex] <= otherEnd && otherStart <= pos[otherIndex] + sizes[otherIndex];
54664
+ function mapSnapDirectionPoses(snapDirections, snapPoses) {
54665
+ var nextSnapDirections = getSnapDirections(snapDirections);
54666
+ var nextSnapPoses = {};
54667
+
54668
+ for (var name in nextSnapDirections) {
54669
+ if (name in snapPoses && nextSnapDirections[name]) {
54670
+ nextSnapPoses[name] = snapPoses[name];
54671
+ }
54672
+ }
54673
+
54674
+ return nextSnapPoses;
54675
+ }
54676
+ function splitSnapDirectionPoses(snapDirections, snapPoses) {
54677
+ var nextSnapPoses = mapSnapDirectionPoses(snapDirections, snapPoses);
54678
+ var horizontalNames = HORIZONTAL_NAMES.filter(function (name) {
54679
+ return name in nextSnapPoses;
54621
54680
  });
54622
- elementGuidelines.forEach(function (guideline1) {
54623
- var elementStart = guideline1.pos[index];
54624
- var elementEnd = elementStart + guideline1.sizes[index];
54625
- elementGuidelines.forEach(function (guideline2) {
54626
- var guideline2Pos = guideline2.pos,
54627
- guideline2Sizes = guideline2.sizes,
54628
- guideline2Element = guideline2.element,
54629
- guidline2ClassName = guideline2.className;
54630
- var targetStart = guideline2Pos[index];
54631
- var targetEnd = targetStart + guideline2Sizes[index];
54632
- var pos = 0;
54633
- var gap = 0;
54634
- var canSnap = true;
54681
+ var verticalNames = VERTICAL_NAMES.filter(function (name) {
54682
+ return name in nextSnapPoses;
54683
+ });
54684
+ return {
54685
+ horizontal: horizontalNames.map(function (name) {
54686
+ return nextSnapPoses[name];
54687
+ }),
54688
+ vertical: verticalNames.map(function (name) {
54689
+ return nextSnapPoses[name];
54690
+ })
54691
+ };
54692
+ }
54693
+ function getGapGuidelines(moveable, targetRect, snapThreshold) {
54694
+ var elementRects = moveable.state.elementRects;
54695
+ var gapGuidelines = [];
54696
+ [["vertical", VERTICAL_NAMES_MAP, HORIZONTAL_NAMES_MAP], ["horizontal", HORIZONTAL_NAMES_MAP, VERTICAL_NAMES_MAP]].forEach(function (_a) {
54697
+ var type = _a[0],
54698
+ mainNames = _a[1],
54699
+ sideNames = _a[2];
54700
+ var targetStart = targetRect[mainNames.start];
54701
+ var targetEnd = targetRect[mainNames.end];
54702
+ var targetCenter = targetRect[mainNames.center];
54703
+ var targetStart2 = targetRect[sideNames.start];
54704
+ var targetEnd2 = targetRect[sideNames.end]; // element : moveable
54705
+
54706
+ function getDist(elementRect) {
54707
+ var rect = elementRect.rect;
54708
+
54709
+ if (rect[mainNames.end] < targetStart + snapThreshold) {
54710
+ return targetStart - rect[mainNames.end];
54711
+ } else if (targetEnd - snapThreshold < rect[mainNames.start]) {
54712
+ return rect[mainNames.start] - targetEnd;
54713
+ } else {
54714
+ return -1;
54715
+ }
54716
+ }
54635
54717
 
54636
- if (elementEnd <= targetStart) {
54637
- // gap -
54638
- gap = elementEnd - targetStart;
54639
- pos = targetEnd - gap;
54718
+ var nextElementRects = elementRects.filter(function (elementRect) {
54719
+ var rect = elementRect.rect;
54720
+
54721
+ if (rect[sideNames.start] > targetEnd2 || rect[sideNames.end] < targetStart2) {
54722
+ return false;
54723
+ }
54724
+
54725
+ return getDist(elementRect) > 0;
54726
+ }).sort(function (a, b) {
54727
+ return getDist(a) - getDist(b);
54728
+ });
54729
+ var groups = [];
54730
+ nextElementRects.forEach(function (snapRect1) {
54731
+ nextElementRects.forEach(function (snapRect2) {
54732
+ if (snapRect1 === snapRect2) {
54733
+ return;
54734
+ }
54735
+
54736
+ var rect1 = snapRect1.rect;
54737
+ var rect2 = snapRect2.rect;
54738
+ var rect1Start = rect1[sideNames.start];
54739
+ var rect1End = rect1[sideNames.end];
54740
+ var rect2Start = rect2[sideNames.start];
54741
+ var rect2End = rect2[sideNames.end];
54742
+
54743
+ if (rect1Start > rect2End || rect2Start > rect1End) {
54744
+ return;
54745
+ }
54746
+
54747
+ groups.push([snapRect1, snapRect2]);
54748
+ });
54749
+ });
54750
+ groups.forEach(function (_a) {
54751
+ var snapRect1 = _a[0],
54752
+ snapRect2 = _a[1];
54753
+ var rect1 = snapRect1.rect;
54754
+ var rect2 = snapRect2.rect;
54755
+ var rect1Start = rect1[mainNames.start];
54756
+ var rect1End = rect1[mainNames.end];
54757
+ var rect2Start = rect2[mainNames.start];
54758
+ var rect2End = rect2[mainNames.end];
54759
+ var gap = 0;
54760
+ var pos = 0;
54761
+ var isStart = false;
54762
+ var isCenter = false;
54763
+ var isEnd = false;
54640
54764
 
54641
- if (start < pos - snapThreshold) {
54642
- canSnap = false;
54643
- } // element target moveable
54765
+ if (rect1End <= targetStart && targetEnd <= rect2Start) {
54766
+ // (l)element1(r) : (l)target(r) : (l)element2(r)
54767
+ isCenter = true;
54768
+ gap = (rect2Start - rect1End - (targetEnd - targetStart)) / 2;
54769
+ pos = rect1End + gap + (targetEnd - targetStart) / 2;
54644
54770
 
54645
- } else if (targetEnd <= elementStart) {
54646
- // gap +
54647
- gap = elementStart - targetEnd;
54648
- pos = targetStart - gap;
54771
+ if (Math.abs(pos - targetCenter) > snapThreshold) {
54772
+ return;
54773
+ }
54774
+ } else if (rect1End < rect2Start && rect2End < targetStart + snapThreshold) {
54775
+ // (l)element1(r) : (l)element2(r) : (l)target
54776
+ isStart = true;
54777
+ gap = rect2Start - rect1End;
54778
+ pos = rect2End + gap;
54649
54779
 
54650
- if (end > pos + snapThreshold) {
54651
- canSnap = false;
54652
- } // moveable target element
54780
+ if (Math.abs(pos - targetStart) > snapThreshold) {
54781
+ return;
54782
+ }
54783
+ } else if (rect1End < rect2Start && targetEnd - snapThreshold < rect1Start) {
54784
+ // target(r) : (l)element1(r) : (l)element2(r)
54785
+ isEnd = true;
54786
+ gap = rect2Start - rect1End;
54787
+ pos = rect1Start - gap;
54653
54788
 
54789
+ if (Math.abs(pos - targetEnd) > snapThreshold) {
54790
+ return;
54791
+ }
54654
54792
  } else {
54655
54793
  return;
54656
54794
  }
54657
54795
 
54658
- if (canSnap) {
54659
- totalGuidelines.push({
54660
- pos: otherType === "vertical" ? [pos, guideline2Pos[1]] : [guideline2Pos[0], pos],
54661
- element: guideline2Element,
54662
- sizes: guideline2Sizes,
54663
- size: 0,
54664
- type: otherType,
54665
- gap: gap,
54666
- className: guidline2ClassName,
54667
- gapGuidelines: elementGuidelines
54668
- });
54796
+ if (!gap) {
54797
+ return;
54669
54798
  }
54670
54799
 
54671
- if (elementEnd <= start && end <= targetStart) {
54672
- // elementEnd moveable target
54673
- var centerPos = (targetStart + elementEnd - (end - start)) / 2;
54674
-
54675
- if ((0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(start - (centerPos - snapThreshold), 0.1) >= 0) {
54676
- totalGuidelines.push({
54677
- pos: otherType === "vertical" ? [centerPos, guideline2Pos[1]] : [guideline2Pos[0], centerPos],
54678
- className: guidline2ClassName,
54679
- element: guideline2Element,
54680
- sizes: guideline2Sizes,
54681
- size: 0,
54682
- type: otherType,
54683
- gap: elementEnd - start,
54684
- gapGuidelines: elementGuidelines
54685
- });
54686
- }
54687
- }
54800
+ gapGuidelines.push({
54801
+ type: type,
54802
+ pos: type === "vertical" ? [pos, 0] : [0, pos],
54803
+ element: snapRect2.element,
54804
+ size: 0,
54805
+ className: snapRect2.className,
54806
+ isStart: isStart,
54807
+ isCenter: isCenter,
54808
+ isEnd: isEnd,
54809
+ gap: gap,
54810
+ hide: true,
54811
+ gapRects: [snapRect1, snapRect2]
54812
+ });
54688
54813
  });
54689
54814
  });
54690
- return totalGuidelines;
54815
+ return gapGuidelines;
54691
54816
  }
54692
54817
  function getDefaultGuidelines(horizontalGuidelines, verticalGuidelines, width, height, clientLeft, clientTop, snapOffset) {
54693
54818
  if (clientLeft === void 0) {
@@ -54730,15 +54855,16 @@ function getDefaultGuidelines(horizontalGuidelines, verticalGuidelines, width, h
54730
54855
  });
54731
54856
  return guidelines;
54732
54857
  }
54733
- function calculateElementGuidelines(moveable, values) {
54734
- var guidelines = [];
54735
-
54858
+ function calculateContainerPos(rootMatrix, containerRect, n) {
54859
+ var clientPos = calculatePosition(rootMatrix, [containerRect.clientLeft, containerRect.clientTop], n);
54860
+ return [containerRect.left + clientPos[0], containerRect.top + clientPos[1]];
54861
+ }
54862
+ function getSnapElementRects(moveable, values) {
54736
54863
  if (!values.length) {
54737
- return guidelines;
54864
+ return [];
54738
54865
  }
54739
54866
 
54740
54867
  var state = moveable.state;
54741
- var snapCenter = moveable.props.snapCenter;
54742
54868
  var containerClientRect = state.containerClientRect,
54743
54869
  _a = state.targetClientRect,
54744
54870
  clientTop = _a.top,
@@ -54763,14 +54889,8 @@ function calculateElementGuidelines(moveable, values) {
54763
54889
  distLeft = _d[0],
54764
54890
  distTop = _d[1];
54765
54891
 
54766
- values.forEach(function (value) {
54767
- var element = value.element,
54768
- topValue = value.top,
54769
- leftValue = value.left,
54770
- rightValue = value.right,
54771
- bottomValue = value.bottom,
54772
- className = value.className;
54773
- var rect = element.getBoundingClientRect();
54892
+ return values.map(function (value) {
54893
+ var rect = value.element.getBoundingClientRect();
54774
54894
  var left = rect.left - containerLeft;
54775
54895
  var top = rect.top - containerTop;
54776
54896
  var bottom = top + rect.height;
@@ -54784,101 +54904,32 @@ function calculateElementGuidelines(moveable, values) {
54784
54904
  elementRight = _b[0],
54785
54905
  elementBottom = _b[1];
54786
54906
 
54787
- var width = elementRight - elementLeft;
54788
- var height = elementBottom - elementTop;
54789
- var sizes = [width, height]; //top
54790
-
54791
- if (topValue !== false) {
54792
- guidelines.push({
54793
- type: "vertical",
54794
- element: element,
54795
- pos: [(0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(elementLeft + distLeft, 0.1), elementTop],
54796
- size: height,
54797
- sizes: sizes,
54798
- className: className
54799
- });
54800
- } // bottom
54801
-
54802
-
54803
- if (bottomValue !== false) {
54804
- guidelines.push({
54805
- type: "vertical",
54806
- element: element,
54807
- pos: [(0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(elementRight + distLeft, 0.1), elementTop],
54808
- size: height,
54809
- sizes: sizes,
54810
- className: className
54811
- });
54812
- } // left
54813
-
54814
-
54815
- if (leftValue !== false) {
54816
- guidelines.push({
54817
- type: "horizontal",
54818
- element: element,
54819
- pos: [elementLeft, (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(elementTop + distTop, 0.1)],
54820
- size: width,
54821
- sizes: sizes,
54822
- className: className
54823
- });
54824
- } // right
54825
-
54826
-
54827
- if (rightValue !== false) {
54828
- guidelines.push({
54829
- type: "horizontal",
54830
- element: element,
54831
- pos: [elementLeft, (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(elementBottom + distTop, 0.1)],
54832
- size: width,
54833
- sizes: sizes,
54834
- className: className
54835
- });
54836
- }
54837
-
54838
- if (snapCenter) {
54839
- guidelines.push({
54840
- type: "vertical",
54841
- element: element,
54842
- pos: [(0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)((elementLeft + elementRight) / 2 + distLeft, 0.1), elementTop],
54843
- size: height,
54844
- sizes: sizes,
54845
- center: true,
54846
- className: className
54847
- });
54848
- guidelines.push({
54849
- type: "horizontal",
54850
- element: element,
54851
- pos: [elementLeft, (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)((elementTop + elementBottom) / 2 + distTop, 0.1)],
54852
- size: width,
54853
- sizes: sizes,
54854
- center: true,
54855
- className: className
54856
- });
54857
- }
54907
+ return __assign(__assign({}, value), {
54908
+ rect: {
54909
+ left: elementLeft + distLeft,
54910
+ right: elementRight + distLeft,
54911
+ top: elementTop + distTop,
54912
+ bottom: elementBottom + distTop,
54913
+ center: (elementLeft + elementRight) / 2 + distLeft,
54914
+ middle: (elementTop + elementBottom) / 2 + distTop
54915
+ }
54916
+ });
54858
54917
  });
54859
- return guidelines;
54860
54918
  }
54861
- function getElementGuidelines(moveable, isRefresh, prevGuidelines) {
54862
- if (prevGuidelines === void 0) {
54863
- prevGuidelines = [];
54864
- }
54865
-
54866
- var guidelines = [];
54919
+ function getElementGuidelines(moveable) {
54867
54920
  var state = moveable.state;
54868
-
54869
- if (isRefresh && state.guidelines && state.guidelines.length) {
54870
- return guidelines;
54871
- }
54872
-
54873
54921
  var _a = moveable.props.elementGuidelines,
54874
54922
  elementGuidelines = _a === void 0 ? [] : _a;
54875
54923
 
54876
54924
  if (!elementGuidelines.length) {
54877
- return guidelines;
54925
+ state.elementRects = [];
54926
+ return [];
54878
54927
  }
54879
54928
 
54880
- var prevValues = state.elementGuidelineValues || [];
54881
- var nextValues = elementGuidelines.map(function (el) {
54929
+ var prevValues = (state.elementRects || []).filter(function (snapRect) {
54930
+ return !snapRect.refresh;
54931
+ });
54932
+ var nextElementGuidelines = elementGuidelines.map(function (el) {
54882
54933
  if ((0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.isObject)(el) && "element" in el) {
54883
54934
  return el;
54884
54935
  }
@@ -54889,32 +54940,90 @@ function getElementGuidelines(moveable, isRefresh, prevGuidelines) {
54889
54940
  }).filter(function (value) {
54890
54941
  return value.element;
54891
54942
  });
54892
- state.elementGuidelineValues = nextValues;
54893
54943
 
54894
54944
  var _b = (0,_egjs_children_differ__WEBPACK_IMPORTED_MODULE_6__.diff)(prevValues.map(function (v) {
54895
54945
  return v.element;
54896
- }), nextValues.map(function (v) {
54946
+ }), nextElementGuidelines.map(function (v) {
54897
54947
  return v.element;
54898
54948
  })),
54899
- added = _b.added,
54900
- removed = _b.removed;
54901
-
54902
- var removedElements = removed.map(function (index) {
54903
- return prevValues[index].element;
54949
+ maintained = _b.maintained,
54950
+ added = _b.added;
54951
+
54952
+ var nextValues = [];
54953
+ maintained.forEach(function (_a) {
54954
+ var prevIndex = _a[0],
54955
+ nextIndex = _a[1];
54956
+ nextValues[nextIndex] = prevValues[prevIndex];
54904
54957
  });
54905
- var addedGuidelines = calculateElementGuidelines(moveable, added.map(function (index) {
54906
- return nextValues[index];
54907
- }).filter(function (value) {
54908
- return value.refresh && isRefresh || !value.refresh && !isRefresh;
54909
- }));
54910
- return __spreadArrays(prevGuidelines.filter(function (guideline) {
54911
- return removedElements.indexOf(guideline.element) === -1;
54912
- }), addedGuidelines);
54958
+ getSnapElementRects(moveable, added.map(function (index) {
54959
+ return nextElementGuidelines[index];
54960
+ })).map(function (rect, i) {
54961
+ nextValues[added[i]] = rect;
54962
+ });
54963
+ state.elementRects = nextValues;
54964
+ var elementSnapDirections = getSnapDirections(moveable.props.elementSnapDirections);
54965
+ var nextGuidelines = [];
54966
+ nextValues.forEach(function (snapRect) {
54967
+ var element = snapRect.element,
54968
+ _a = snapRect.top,
54969
+ topValue = _a === void 0 ? elementSnapDirections.top : _a,
54970
+ _b = snapRect.left,
54971
+ leftValue = _b === void 0 ? elementSnapDirections.left : _b,
54972
+ _c = snapRect.right,
54973
+ rightValue = _c === void 0 ? elementSnapDirections.right : _c,
54974
+ _d = snapRect.bottom,
54975
+ bottomValue = _d === void 0 ? elementSnapDirections.bottom : _d,
54976
+ _e = snapRect.center,
54977
+ centerValue = _e === void 0 ? elementSnapDirections.center : _e,
54978
+ _f = snapRect.middle,
54979
+ middleValue = _f === void 0 ? elementSnapDirections.middle : _f,
54980
+ className = snapRect.className,
54981
+ rect = snapRect.rect;
54982
+
54983
+ var _g = splitSnapDirectionPoses({
54984
+ top: topValue,
54985
+ right: rightValue,
54986
+ left: leftValue,
54987
+ bottom: bottomValue,
54988
+ center: centerValue,
54989
+ middle: middleValue
54990
+ }, rect),
54991
+ horizontal = _g.horizontal,
54992
+ vertical = _g.vertical;
54993
+
54994
+ var rectTop = rect.top;
54995
+ var rectLeft = rect.left;
54996
+ var width = rect.right - rectLeft;
54997
+ var height = rect.bottom - rectTop;
54998
+ var sizes = [width, height];
54999
+ vertical.forEach(function (pos) {
55000
+ nextGuidelines.push({
55001
+ type: "vertical",
55002
+ element: element,
55003
+ pos: [(0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(pos, 0.1), rectTop],
55004
+ size: height,
55005
+ sizes: sizes,
55006
+ className: className,
55007
+ elementRect: snapRect
55008
+ });
55009
+ });
55010
+ horizontal.forEach(function (pos) {
55011
+ nextGuidelines.push({
55012
+ type: "horizontal",
55013
+ element: element,
55014
+ pos: [rectLeft, (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(pos, 0.1)],
55015
+ size: width,
55016
+ sizes: sizes,
55017
+ className: className,
55018
+ elementRect: snapRect
55019
+ });
55020
+ });
55021
+ });
55022
+ return nextGuidelines;
54913
55023
  }
54914
55024
  function getTotalGuidelines(moveable) {
54915
55025
  var _a = moveable.state,
54916
55026
  snapOffset = _a.snapOffset,
54917
- staticGuidelines = _a.staticGuidelines,
54918
55027
  _b = _a.containerClientRect,
54919
55028
  overflow = _b.overflow,
54920
55029
  containerHeight = _b.scrollHeight,
@@ -54924,39 +55033,39 @@ function getTotalGuidelines(moveable) {
54924
55033
  clientLeft = _b.clientLeft,
54925
55034
  clientTop = _b.clientTop;
54926
55035
  var _c = moveable.props,
54927
- _d = _c.snapHorizontal,
54928
- snapHorizontal = _d === void 0 ? true : _d,
54929
- _e = _c.snapVertical,
54930
- snapVertical = _e === void 0 ? true : _e,
54931
- _f = _c.snapGap,
54932
- snapGap = _f === void 0 ? true : _f,
55036
+ _d = _c.snapGap,
55037
+ snapGap = _d === void 0 ? true : _d,
54933
55038
  verticalGuidelines = _c.verticalGuidelines,
54934
55039
  horizontalGuidelines = _c.horizontalGuidelines,
54935
- _g = _c.snapThreshold,
54936
- snapThreshold = _g === void 0 ? 5 : _g,
54937
- _h = _c.snapGridWidth,
54938
- snapGridWidth = _h === void 0 ? 0 : _h,
54939
- _j = _c.snapGridHeight,
54940
- snapGridHeight = _j === void 0 ? 0 : _j;
55040
+ _e = _c.snapThreshold,
55041
+ snapThreshold = _e === void 0 ? 5 : _e,
55042
+ _f = _c.snapGridWidth,
55043
+ snapGridWidth = _f === void 0 ? 0 : _f,
55044
+ _g = _c.snapGridHeight,
55045
+ snapGridHeight = _g === void 0 ? 0 : _g;
55046
+ var elementGuidelines = getElementGuidelines(moveable);
54941
55047
 
54942
- var totalGuidelines = __spreadArrays(staticGuidelines, getElementGuidelines(moveable, true));
55048
+ var totalGuidelines = __spreadArrays(elementGuidelines);
54943
55049
 
54944
55050
  if (snapGap) {
54945
- var _k = getRect(getAbsolutePosesByState(moveable.state)),
54946
- top = _k.top,
54947
- left = _k.left,
54948
- bottom = _k.bottom,
54949
- right = _k.right;
54950
-
54951
- var elementGuidelines = staticGuidelines.filter(function (_a) {
54952
- var element = _a.element;
54953
- return element;
54954
- });
54955
- totalGuidelines.push.apply(totalGuidelines, __spreadArrays(getGapGuidelines(elementGuidelines, "horizontal", snapThreshold, 0, [left, right], [top, bottom]), getGapGuidelines(elementGuidelines, "vertical", snapThreshold, 1, [top, bottom], [left, right])));
55051
+ var _h = getRect(getAbsolutePosesByState(moveable.state)),
55052
+ top = _h.top,
55053
+ left = _h.left,
55054
+ bottom = _h.bottom,
55055
+ right = _h.right;
55056
+
55057
+ totalGuidelines.push.apply(totalGuidelines, getGapGuidelines(moveable, {
55058
+ top: top,
55059
+ left: left,
55060
+ bottom: bottom,
55061
+ right: right,
55062
+ center: (left + right) / 2,
55063
+ middle: (top + bottom) / 2
55064
+ }, snapThreshold));
54956
55065
  }
54957
55066
 
54958
55067
  totalGuidelines.push.apply(totalGuidelines, getGridGuidelines(snapGridWidth, snapGridHeight, overflow ? containerWidth : containerClientWidth, overflow ? containerHeight : containerClientHeight, clientLeft, clientTop));
54959
- totalGuidelines.push.apply(totalGuidelines, getDefaultGuidelines(snapHorizontal && horizontalGuidelines || false, snapVertical && verticalGuidelines || false, overflow ? containerWidth : containerClientWidth, overflow ? containerHeight : containerClientHeight, clientLeft, clientTop, snapOffset));
55068
+ totalGuidelines.push.apply(totalGuidelines, getDefaultGuidelines(horizontalGuidelines || false, verticalGuidelines || false, overflow ? containerWidth : containerClientWidth, overflow ? containerHeight : containerClientHeight, clientLeft, clientTop, snapOffset));
54960
55069
  return totalGuidelines;
54961
55070
  }
54962
55071
  function getGridGuidelines(snapGridWidth, snapGridHeight, containerWidth, containerHeight, clientLeft, clientTop) {
@@ -54994,21 +55103,16 @@ function getGridGuidelines(snapGridWidth, snapGridHeight, containerWidth, contai
54994
55103
 
54995
55104
  return guidelines;
54996
55105
  }
54997
- function checkMoveableSnapPoses(moveable, posesX, posesY, snapCenter, customSnapThreshold) {
55106
+
55107
+ function checkMoveableSnapPoses(moveable, posesX, posesY, customSnapThreshold) {
54998
55108
  var props = moveable.props;
54999
- var _a = props.snapElement,
55000
- snapElement = _a === void 0 ? true : _a;
55001
55109
  var snapThreshold = selectValue(customSnapThreshold, props.snapThreshold, 5);
55002
- return checkSnapPoses(moveable.state.guidelines, posesX, posesY, {
55003
- snapThreshold: snapThreshold,
55004
- snapCenter: snapCenter,
55005
- snapElement: snapElement
55006
- });
55110
+ return checkSnapPoses(moveable.state.guidelines, posesX, posesY, snapThreshold);
55007
55111
  }
55008
- function checkSnapPoses(guidelines, posesX, posesY, options) {
55112
+ function checkSnapPoses(guidelines, posesX, posesY, snapThreshold) {
55009
55113
  return {
55010
- vertical: checkSnap(guidelines, "vertical", posesX, options),
55011
- horizontal: checkSnap(guidelines, "horizontal", posesY, options)
55114
+ vertical: checkSnap(guidelines, "vertical", posesX, snapThreshold),
55115
+ horizontal: checkSnap(guidelines, "horizontal", posesY, snapThreshold)
55012
55116
  };
55013
55117
  }
55014
55118
  function checkSnapKeepRatio(moveable, startPos, endPos) {
@@ -55114,28 +55218,9 @@ function checkSnapKeepRatio(moveable, startPos, endPos) {
55114
55218
  horizontal: horizontalInfo
55115
55219
  };
55116
55220
  }
55117
- function checkSnaps(moveable, rect, isCenter, customSnapThreshold) {
55118
- var snapCenter = moveable.props.snapCenter;
55119
- var isSnapCenter = snapCenter && isCenter;
55120
- var verticalNames = ["left", "right"];
55121
- var horizontalNames = ["top", "bottom"];
55122
-
55123
- if (isSnapCenter) {
55124
- verticalNames.push("center");
55125
- horizontalNames.push("middle");
55126
- }
55127
-
55128
- verticalNames = verticalNames.filter(function (name) {
55129
- return name in rect;
55130
- });
55131
- horizontalNames = horizontalNames.filter(function (name) {
55132
- return name in rect;
55133
- });
55134
- return checkMoveableSnapPoses(moveable, verticalNames.map(function (name) {
55135
- return rect[name];
55136
- }), horizontalNames.map(function (name) {
55137
- return rect[name];
55138
- }), isSnapCenter, customSnapThreshold);
55221
+ function checkSnaps(moveable, rect, customSnapThreshold) {
55222
+ var poses = splitSnapDirectionPoses(moveable.props.snapDirections, rect);
55223
+ return checkMoveableSnapPoses(moveable, poses.vertical, poses.horizontal, customSnapThreshold);
55139
55224
  }
55140
55225
  function getNearestSnapGuidelineInfo(snapInfo) {
55141
55226
  var isSnap = snapInfo.isSnap;
@@ -55164,13 +55249,7 @@ function getNearestSnapGuidelineInfo(snapInfo) {
55164
55249
  };
55165
55250
  }
55166
55251
 
55167
- function checkSnap(guidelines, targetType, targetPoses, _a) {
55168
- var _b = _a === void 0 ? {} : _a,
55169
- _c = _b.snapThreshold,
55170
- snapThreshold = _c === void 0 ? 5 : _c,
55171
- snapElement = _b.snapElement,
55172
- snapCenter = _b.snapCenter;
55173
-
55252
+ function checkSnap(guidelines, targetType, targetPoses, snapThreshold) {
55174
55253
  if (!guidelines || !guidelines.length) {
55175
55254
  return {
55176
55255
  isSnap: false,
@@ -55193,11 +55272,9 @@ function checkSnap(guidelines, targetType, targetPoses, _a) {
55193
55272
  }).filter(function (_a) {
55194
55273
  var guideline = _a.guideline,
55195
55274
  dist = _a.dist;
55196
- var type = guideline.type,
55197
- center = guideline.center,
55198
- element = guideline.element;
55275
+ var type = guideline.type;
55199
55276
 
55200
- if (!snapElement && element || !snapCenter && center || type !== targetType || dist > snapThreshold) {
55277
+ if (type !== targetType || dist > snapThreshold) {
55201
55278
  return false;
55202
55279
  }
55203
55280
 
@@ -55255,7 +55332,7 @@ function getSnapInfosByDirection(moveable, poses, snapDirection) {
55255
55332
  return pos[0];
55256
55333
  }), nextPoses.map(function (pos) {
55257
55334
  return pos[1];
55258
- }), true, 1);
55335
+ }), 1);
55259
55336
  }
55260
55337
  function checkSnapBoundPriority(a, b) {
55261
55338
  var aDist = Math.abs(a.offset);
@@ -55306,6 +55383,38 @@ function getNearOffsetInfo(offsets, index) {
55306
55383
  });
55307
55384
  })[0];
55308
55385
  }
55386
+ function getCheckSnapDirections(direction, keepRatio) {
55387
+ var directions = [];
55388
+ var fixedDirection = [-direction[0], -direction[1]];
55389
+
55390
+ if (direction[0] && direction[1]) {
55391
+ directions.push([fixedDirection, [direction[0], -direction[1]]], [fixedDirection, [-direction[0], direction[1]]]);
55392
+
55393
+ if (keepRatio) {
55394
+ // pass two direction condition
55395
+ directions.push([fixedDirection, direction]);
55396
+ }
55397
+ } else if (direction[0]) {
55398
+ // vertcal
55399
+ if (keepRatio) {
55400
+ directions.push([fixedDirection, [fixedDirection[0], -1]], [fixedDirection, [fixedDirection[0], 1]], [fixedDirection, [direction[0], -1]], [fixedDirection, direction], [fixedDirection, [direction[0], 1]]);
55401
+ } else {
55402
+ directions.push([[fixedDirection[0], -1], [direction[0], -1]], [[fixedDirection[0], 0], [direction[0], 0]], [[fixedDirection[0], 1], [direction[0], 1]]);
55403
+ }
55404
+ } else if (direction[1]) {
55405
+ // horizontal
55406
+ if (keepRatio) {
55407
+ directions.push([fixedDirection, [-1, fixedDirection[1]]], [fixedDirection, [1, fixedDirection[1]]], [fixedDirection, [-1, direction[1]]], [fixedDirection, [1, direction[1]]], [fixedDirection, direction]);
55408
+ } else {
55409
+ directions.push([[-1, fixedDirection[1]], [-1, direction[1]]], [[0, fixedDirection[1]], [0, direction[1]]], [[1, fixedDirection[1]], [1, direction[1]]]);
55410
+ }
55411
+ } else {
55412
+ // [0, 0] to all direction
55413
+ directions.push([fixedDirection, [1, 0]], [fixedDirection, [-1, 0]], [fixedDirection, [0, -1]], [fixedDirection, [0, 1]], [[1, 0], [1, -1]], [[1, 0], [1, 1]], [[0, 1], [1, 1]], [[0, 1], [-1, 1]], [[-1, 0], [-1, -1]], [[-1, 0], [-1, 1]], [[0, -1], [1, -1]], [[0, -1], [-1, -1]]);
55414
+ }
55415
+
55416
+ return directions;
55417
+ }
55309
55418
 
55310
55419
  function isStartLine(dot, line) {
55311
55420
  // l o => true
@@ -56083,55 +56192,6 @@ function checkRotateBounds(moveable, prevPoses, nextPoses, origin, rotation) {
56083
56192
  return result;
56084
56193
  }
56085
56194
 
56086
- var DIRECTION_NAMES = {
56087
- horizontal: ["left", "top", "width", "Y", "X"],
56088
- vertical: ["top", "left", "height", "X", "Y"]
56089
- };
56090
- function groupByElementGuidelines(guidelines, clientPos, size, index) {
56091
- var groupInfos = [];
56092
- var group = groupBy(guidelines.filter(function (_a) {
56093
- var element = _a.element,
56094
- gap = _a.gap;
56095
- return element && !gap;
56096
- }), function (_a) {
56097
- var element = _a.element,
56098
- pos = _a.pos;
56099
- var elementPos = pos[index];
56100
- var sign = Math.min(0, elementPos - clientPos) < 0 ? -1 : 1;
56101
- var groupKey = sign + "_" + pos[index ? 0 : 1];
56102
- var groupInfo = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.find)(groupInfos, function (_a) {
56103
- var groupElement = _a[0],
56104
- groupPos = _a[1];
56105
- return element === groupElement && elementPos === groupPos;
56106
- });
56107
-
56108
- if (groupInfo) {
56109
- return groupInfo[2];
56110
- }
56111
-
56112
- groupInfos.push([element, elementPos, groupKey]);
56113
- return groupKey;
56114
- });
56115
- group.forEach(function (elementGuidelines) {
56116
- elementGuidelines.sort(function (a, b) {
56117
- var result = getElementGuidelineDist(a.pos[index], a.size, clientPos, size).size - getElementGuidelineDist(b.pos[index], a.size, clientPos, size).size;
56118
- return result || a.pos[index ? 0 : 1] - b.pos[index ? 0 : 1];
56119
- });
56120
- });
56121
- return group;
56122
- }
56123
- function getElementGuidelineDist(elementPos, elementSize, targetPos, targetSize) {
56124
- // relativePos < 0 => element(l) --- (r)target
56125
- // relativePos > 0 => target(l) --- (r)element
56126
- var relativePos = elementPos - targetPos;
56127
- var startPos = relativePos < 0 ? relativePos + elementSize : targetSize;
56128
- var endPos = relativePos < 0 ? 0 : relativePos;
56129
- var size = endPos - startPos;
56130
- return {
56131
- size: size,
56132
- pos: startPos
56133
- };
56134
- }
56135
56195
  function renderGuideline(info, React) {
56136
56196
  var _a;
56137
56197
 
@@ -56142,12 +56202,12 @@ function renderGuideline(info, React) {
56142
56202
  zoom = info.zoom,
56143
56203
  key = info.key;
56144
56204
  var isHorizontal = direction === "horizontal";
56145
- var scaleDirection = isHorizontal ? "Y" : "X"; // const scaleDirection2 = isHorizontal ? "Y" : "X";
56205
+ var scaleType = isHorizontal ? "Y" : "X"; // const scaleType2 = isHorizontal ? "Y" : "X";
56146
56206
 
56147
56207
  return React.createElement("div", {
56148
56208
  key: key,
56149
56209
  className: classNames.join(" "),
56150
- style: (_a = {}, _a[isHorizontal ? "width" : "height"] = "" + size, _a.transform = "translate(" + pos[0] + ", " + pos[1] + ") translate" + scaleDirection + "(-50%) scale" + scaleDirection + "(" + zoom + ")", _a)
56210
+ style: (_a = {}, _a[isHorizontal ? "width" : "height"] = "" + size, _a.transform = "translate(" + pos[0] + ", " + pos[1] + ") translate" + scaleType + "(-50%) scale" + scaleType + "(" + zoom + ")", _a)
56151
56211
  });
56152
56212
  }
56153
56213
  function renderInnerGuideline(info, React) {
@@ -56161,55 +56221,6 @@ function renderInnerGuideline(info, React) {
56161
56221
  })
56162
56222
  }), React);
56163
56223
  }
56164
- function renderElementGroups(moveable, direction, groups, minPos, clientPos, clientSize, targetPos, snapThreshold, snapDigit, index, snapDistFormat, React) {
56165
- var _a = moveable.props,
56166
- zoom = _a.zoom,
56167
- _b = _a.isDisplaySnapDigit,
56168
- isDisplaySnapDigit = _b === void 0 ? true : _b;
56169
- var _c = DIRECTION_NAMES[direction],
56170
- posName1 = _c[0],
56171
- posName2 = _c[1],
56172
- sizeName = _c[2],
56173
- scaleDirection = _c[4];
56174
- return flat(groups.map(function (elementGuidelines, i) {
56175
- var isFirstRenderSize = true;
56176
- return elementGuidelines.map(function (_a, j) {
56177
- var _b;
56178
-
56179
- var pos = _a.pos,
56180
- size = _a.size;
56181
-
56182
- var _c = getElementGuidelineDist(pos[index], size, clientPos, clientSize),
56183
- linePos = _c.pos,
56184
- lineSize = _c.size;
56185
-
56186
- if (lineSize < snapThreshold) {
56187
- return null;
56188
- }
56189
-
56190
- var isRenderSize = isFirstRenderSize;
56191
- isFirstRenderSize = false;
56192
- var snapSize = isDisplaySnapDigit && isRenderSize ? parseFloat(lineSize.toFixed(snapDigit)) : 0;
56193
- return React.createElement("div", {
56194
- key: direction + "LinkGuideline" + i + "-" + j,
56195
- className: prefix("guideline-group", direction),
56196
- style: (_b = {}, _b[posName1] = minPos + linePos + "px", _b[posName2] = -targetPos + pos[index ? 0 : 1] + "px", _b[sizeName] = lineSize + "px", _b)
56197
- }, renderInnerGuideline({
56198
- direction: direction,
56199
- classNames: [prefix("dashed")],
56200
- size: "100%",
56201
- posValue: [0, 0],
56202
- sizeValue: lineSize,
56203
- zoom: zoom
56204
- }, React), React.createElement("div", {
56205
- className: prefix("size-value"),
56206
- style: {
56207
- transform: "translate" + scaleDirection + "(-50%) scale(" + zoom + ")"
56208
- }
56209
- }, snapSize > 0 ? snapDistFormat(snapSize) : ""));
56210
- });
56211
- }));
56212
- }
56213
56224
  function renderSnapPoses(moveable, direction, snapPoses, minPos, targetPos, size, index, React) {
56214
56225
  var zoom = moveable.props.zoom;
56215
56226
  return snapPoses.map(function (_a, i) {
@@ -56228,209 +56239,311 @@ function renderSnapPoses(moveable, direction, snapPoses, minPos, targetPos, size
56228
56239
  }, React);
56229
56240
  });
56230
56241
  }
56231
- function filterElementInnerGuidelines(moveable, guidelines, index, targetPos, clientPos, targetSizes) {
56232
- var isDisplayInnerSnapDigit = moveable.props.isDisplayInnerSnapDigit;
56233
- var otherIndex = index ? 0 : 1;
56234
- var targetContentPos = targetPos[index];
56235
- var targetContentSize = targetSizes[index];
56236
- var gapGuidelines = [];
56237
- var nextGuidelines = guidelines.filter(function (guideline) {
56238
- var element = guideline.element,
56239
- pos = guideline.pos,
56240
- size = guideline.size;
56241
-
56242
- if (isDisplayInnerSnapDigit && element && pos[index] < targetContentPos && targetContentPos + targetContentSize < pos[index] + size) {
56243
- var contentPos = pos[index] - targetContentPos;
56244
- var inlinePos = pos[otherIndex] - targetPos[otherIndex];
56245
- gapGuidelines.push(__assign(__assign({}, guideline), {
56246
- inner: true,
56247
- gap: contentPos,
56248
- renderPos: index ? [inlinePos, contentPos] : [contentPos, inlinePos]
56249
- }));
56250
- gapGuidelines.push(__assign(__assign({}, guideline), {
56251
- inner: true,
56252
- gap: pos[index] + size - targetContentPos - targetContentSize,
56253
- renderPos: index ? [inlinePos, targetContentSize] : [targetContentSize, inlinePos]
56254
- }));
56255
- return false;
56256
- }
56257
-
56258
- return true;
56259
- });
56260
- nextGuidelines = nextGuidelines.filter(function (guideline1) {
56261
- var element1 = guideline1.element,
56262
- pos1 = guideline1.pos,
56263
- size1 = guideline1.size;
56264
- var contentPos1 = pos1[index];
56242
+ function renderGuidelines(moveable, type, guidelines, targetPos, targetRect, React) {
56243
+ var _a = moveable.props,
56244
+ zoom = _a.zoom,
56245
+ isDisplayInnerSnapDigit = _a.isDisplayInnerSnapDigit;
56246
+ var mainNames = type === "horizontal" ? VERTICAL_NAMES_MAP : HORIZONTAL_NAMES_MAP;
56247
+ var targetStart = targetRect[mainNames.start];
56248
+ var targetEnd = targetRect[mainNames.end];
56249
+ return guidelines.filter(function (_a) {
56250
+ var hide = _a.hide,
56251
+ elementRect = _a.elementRect;
56265
56252
 
56266
- if (!element1) {
56267
- return true;
56253
+ if (hide) {
56254
+ return false;
56268
56255
  }
56269
56256
 
56270
- return nextGuidelines.every(function (guideline2) {
56271
- var element2 = guideline2.element,
56272
- pos2 = guideline2.pos,
56273
- size2 = guideline2.size;
56274
- var contentPos2 = pos2[index];
56257
+ if (isDisplayInnerSnapDigit && elementRect) {
56258
+ // inner
56259
+ var rect = elementRect.rect;
56275
56260
 
56276
- if (!element2 || guideline1 === guideline2) {
56277
- return true;
56261
+ if (rect[mainNames.start] <= targetStart && targetEnd <= rect[mainNames.end]) {
56262
+ return false;
56278
56263
  }
56264
+ }
56279
56265
 
56280
- return contentPos1 + size1 <= contentPos2 || contentPos2 + size2 <= contentPos1 || contentPos1 < contentPos2 && contentPos2 + size2 < contentPos1 + size1;
56281
- });
56282
- });
56283
- var groups = groupByElementGuidelines(nextGuidelines, clientPos[index], targetContentSize, index);
56284
- gapGuidelines = gapGuidelines.filter(function (guideline) {
56285
- var gap = guideline.gap;
56286
- var inlinePos = guideline.pos[otherIndex];
56287
- return groups.every(function (group) {
56288
- return group.every(function (groupGuideline) {
56289
- var groupPos = groupGuideline.pos;
56290
- var renderPos = -targetContentPos + groupPos[index];
56291
-
56292
- if (groupPos[otherIndex] !== inlinePos) {
56293
- return true;
56294
- }
56295
-
56296
- if (gap < 0 && renderPos < 0) {
56297
- return false;
56298
- }
56299
-
56300
- if (gap > 0 && renderPos > targetSizes[index]) {
56301
- return false;
56302
- }
56303
-
56304
- return true;
56305
- });
56306
- });
56307
- });
56308
- return {
56309
- guidelines: nextGuidelines,
56310
- groups: groups,
56311
- gapGuidelines: gapGuidelines
56312
- };
56313
- }
56314
- function renderGuidelines(moveable, direction, guidelines, targetPos, React) {
56315
- var zoom = moveable.props.zoom;
56316
- return guidelines.filter(function (_a) {
56317
- var hide = _a.hide;
56318
- return !hide;
56266
+ return true;
56319
56267
  }).map(function (guideline, i) {
56320
56268
  var pos = guideline.pos,
56321
56269
  size = guideline.size,
56322
56270
  element = guideline.element;
56323
56271
  var renderPos = [-targetPos[0] + pos[0], -targetPos[1] + pos[1]];
56324
56272
  return renderInnerGuideline({
56325
- key: direction + "Guideline" + i,
56273
+ key: type + "-default-guideline-" + i,
56326
56274
  classNames: element ? [prefix("bold")] : [],
56327
- direction: direction,
56275
+ direction: type,
56328
56276
  posValue: renderPos,
56329
56277
  sizeValue: size,
56330
56278
  zoom: zoom
56331
56279
  }, React);
56332
56280
  });
56333
56281
  }
56334
- function renderGapGuidelines(moveable, direction, gapGuidelines, snapDistFormat, React) {
56335
- var _a = moveable.props,
56336
- _b = _a.snapDigit,
56337
- snapDigit = _b === void 0 ? 0 : _b,
56338
- _c = _a.isDisplaySnapDigit,
56339
- isDisplaySnapDigit = _c === void 0 ? true : _c,
56340
- zoom = _a.zoom;
56341
- var scaleDirection = direction === "horizontal" ? "X" : "Y";
56342
- var sizeName = direction === "horizontal" ? "width" : "height";
56343
- return gapGuidelines.map(function (_a, i) {
56344
- var _b;
56282
+ function renderDigitLine(moveable, type, lineType, index, gap, renderPos, className, React) {
56283
+ var _a;
56345
56284
 
56346
- var renderPos = _a.renderPos,
56347
- gap = _a.gap,
56348
- className = _a.className,
56349
- inner = _a.inner;
56350
- var absGap = Math.abs(gap);
56351
- var snapSize = isDisplaySnapDigit ? parseFloat(absGap.toFixed(snapDigit)) : 0;
56352
- return React.createElement("div", {
56353
- key: direction + "GapGuideline" + i,
56354
- className: prefix("guideline-group", direction),
56355
- style: (_b = {
56356
- left: renderPos[0] + "px",
56357
- top: renderPos[1] + "px"
56358
- }, _b[sizeName] = absGap + "px", _b)
56359
- }, renderInnerGuideline({
56360
- direction: direction,
56361
- classNames: [prefix(inner ? "dashed" : "gap"), className],
56362
- size: "100%",
56363
- posValue: [0, 0],
56364
- sizeValue: absGap,
56365
- zoom: zoom
56366
- }, React), React.createElement("div", {
56367
- className: prefix("size-value", "gap"),
56368
- style: {
56369
- transform: "translate" + scaleDirection + "(-50%) scale(" + zoom + ")"
56285
+ var _b = moveable.props,
56286
+ _c = _b.snapDigit,
56287
+ snapDigit = _c === void 0 ? 0 : _c,
56288
+ _d = _b.isDisplaySnapDigit,
56289
+ isDisplaySnapDigit = _d === void 0 ? true : _d,
56290
+ _e = _b.snapDistFormat,
56291
+ snapDistFormat = _e === void 0 ? function (v) {
56292
+ return v;
56293
+ } : _e,
56294
+ zoom = _b.zoom;
56295
+ var scaleType = type === "horizontal" ? "X" : "Y";
56296
+ var sizeName = type === "vertical" ? "height" : "width";
56297
+ var absGap = Math.abs(gap);
56298
+ var snapSize = isDisplaySnapDigit ? parseFloat(absGap.toFixed(snapDigit)) : 0;
56299
+ return React.createElement("div", {
56300
+ key: type + "-" + lineType + "-guideline-" + index,
56301
+ className: prefix("guideline-group", type),
56302
+ style: (_a = {
56303
+ left: renderPos[0] + "px",
56304
+ top: renderPos[1] + "px"
56305
+ }, _a[sizeName] = absGap + "px", _a)
56306
+ }, renderInnerGuideline({
56307
+ direction: type,
56308
+ classNames: [prefix(lineType), className],
56309
+ size: "100%",
56310
+ posValue: [0, 0],
56311
+ sizeValue: absGap,
56312
+ zoom: zoom
56313
+ }, React), React.createElement("div", {
56314
+ className: prefix("size-value", "gap"),
56315
+ style: {
56316
+ transform: "translate" + scaleType + "(-50%) scale(" + zoom + ")"
56317
+ }
56318
+ }, snapSize > 0 ? snapDistFormat(snapSize) : ""));
56319
+ }
56320
+ function groupByElementGuidelines(type, guidelines, targetRect, isDisplayInnerSnapDigit) {
56321
+ var index = type === "vertical" ? 0 : 1;
56322
+ var otherIndex = type === "vertical" ? 1 : 0;
56323
+ var names = index ? VERTICAL_NAMES_MAP : HORIZONTAL_NAMES_MAP;
56324
+ var targetStart = targetRect[names.start];
56325
+ var targetEnd = targetRect[names.end];
56326
+ return groupBy(guidelines, function (guideline) {
56327
+ return guideline.pos[index];
56328
+ }).map(function (nextGuidelines) {
56329
+ var start = [];
56330
+ var end = [];
56331
+ var inner = [];
56332
+ nextGuidelines.forEach(function (guideline) {
56333
+ var _a, _b;
56334
+
56335
+ var element = guideline.element;
56336
+ var rect = guideline.elementRect.rect;
56337
+
56338
+ if (rect[names.end] < targetStart) {
56339
+ start.push(guideline);
56340
+ } else if (targetEnd < rect[names.start]) {
56341
+ end.push(guideline);
56342
+ } else if (rect[names.start] <= targetStart && targetEnd <= rect[names.end] && isDisplayInnerSnapDigit) {
56343
+ var pos = guideline.pos;
56344
+ var elementRect1 = {
56345
+ element: element,
56346
+ rect: __assign(__assign({}, rect), (_a = {}, _a[names.end] = rect[names.start], _a))
56347
+ };
56348
+ var elementRect2 = {
56349
+ element: element,
56350
+ rect: __assign(__assign({}, rect), (_b = {}, _b[names.start] = rect[names.end], _b))
56351
+ };
56352
+ var nextPos1 = [0, 0];
56353
+ var nextPos2 = [0, 0];
56354
+ nextPos1[index] = pos[index];
56355
+ nextPos1[otherIndex] = pos[otherIndex];
56356
+ nextPos2[index] = pos[index];
56357
+ nextPos2[otherIndex] = pos[otherIndex] + guideline.size;
56358
+ start.push({
56359
+ type: type,
56360
+ pos: nextPos1,
56361
+ size: 0,
56362
+ elementRect: elementRect1
56363
+ });
56364
+ end.push({
56365
+ type: type,
56366
+ pos: nextPos2,
56367
+ size: 0,
56368
+ elementRect: elementRect2
56369
+ }); // inner.push(guideline);
56370
56370
  }
56371
- }, snapSize > 0 ? snapDistFormat(snapSize) : ""));
56371
+ });
56372
+ start.sort(function (a, b) {
56373
+ return b.pos[otherIndex] - a.pos[otherIndex];
56374
+ });
56375
+ end.sort(function (a, b) {
56376
+ return a.pos[otherIndex] - b.pos[otherIndex];
56377
+ });
56378
+ return {
56379
+ total: nextGuidelines,
56380
+ start: start,
56381
+ end: end,
56382
+ inner: inner
56383
+ };
56372
56384
  });
56373
56385
  }
56386
+ function renderDashedGuidelines(moveable, guidelines, targetPos, targetRect, React) {
56387
+ var isDisplayInnerSnapDigit = moveable.props.isDisplayInnerSnapDigit;
56388
+ var rendered = [];
56389
+ ["vertical", "horizontal"].forEach(function (type) {
56390
+ var nextGuidelines = guidelines.filter(function (guideline) {
56391
+ return guideline.type === type;
56392
+ });
56393
+ var index = type === "vertical" ? 1 : 0;
56394
+ var otherIndex = index ? 0 : 1;
56395
+ var groups = groupByElementGuidelines(type, nextGuidelines, targetRect, isDisplayInnerSnapDigit);
56396
+ var mainNames = index ? HORIZONTAL_NAMES_MAP : VERTICAL_NAMES_MAP;
56397
+ var sideNames = index ? VERTICAL_NAMES_MAP : HORIZONTAL_NAMES_MAP;
56398
+ var targetStart = targetRect[mainNames.start];
56399
+ var targetEnd = targetRect[mainNames.end];
56400
+ groups.forEach(function (_a) {
56401
+ var total = _a.total,
56402
+ start = _a.start,
56403
+ end = _a.end,
56404
+ inner = _a.inner;
56405
+ var sidePos = targetPos[otherIndex] + total[0].pos[otherIndex] - targetRect[sideNames.start];
56406
+ var prevRect = targetRect;
56407
+ start.forEach(function (guideline) {
56408
+ var nextRect = guideline.elementRect.rect;
56409
+ var size = prevRect[mainNames.start] - nextRect[mainNames.end];
56410
+
56411
+ if (size > 0) {
56412
+ var renderPos = [0, 0];
56413
+ renderPos[index] = targetPos[index] + prevRect[mainNames.start] - targetStart - size;
56414
+ renderPos[otherIndex] = sidePos;
56415
+ rendered.push(renderDigitLine(moveable, type, "dashed", rendered.length, size, renderPos, guideline.className, React));
56416
+ }
56417
+
56418
+ prevRect = nextRect;
56419
+ });
56420
+ prevRect = targetRect;
56421
+ end.forEach(function (guideline) {
56422
+ var nextRect = guideline.elementRect.rect;
56423
+ var size = nextRect[mainNames.start] - prevRect[mainNames.end];
56374
56424
 
56375
- function snapStart(moveable) {
56376
- var state = moveable.state;
56425
+ if (size > 0) {
56426
+ var renderPos = [0, 0];
56427
+ renderPos[index] = targetPos[index] + prevRect[mainNames.end] - targetStart;
56428
+ renderPos[otherIndex] = sidePos;
56429
+ rendered.push(renderDigitLine(moveable, type, "dashed", rendered.length, size, renderPos, guideline.className, React));
56430
+ }
56377
56431
 
56378
- if (state.guidelines && state.guidelines.length) {
56379
- return;
56380
- }
56432
+ prevRect = nextRect;
56433
+ });
56434
+ inner.forEach(function (guideline) {
56435
+ var nextRect = guideline.elementRect.rect;
56436
+ var size1 = targetStart - nextRect[mainNames.start];
56437
+ var size2 = nextRect[mainNames.end] - targetEnd;
56438
+ var renderPos1 = [0, 0];
56439
+ var renderPos2 = [0, 0];
56440
+ renderPos1[index] = targetPos[index] - size1;
56441
+ renderPos1[otherIndex] = sidePos;
56442
+ renderPos2[index] = targetPos[index] + targetEnd - targetStart;
56443
+ renderPos2[otherIndex] = sidePos;
56444
+ rendered.push(renderDigitLine(moveable, type, "dashed", rendered.length, size1, renderPos1, guideline.className, React));
56445
+ rendered.push(renderDigitLine(moveable, type, "dashed", rendered.length, size2, renderPos2, guideline.className, React));
56446
+ });
56447
+ });
56448
+ });
56449
+ return rendered;
56450
+ }
56451
+ function renderGapGuidelines(moveable, guidelines, targetPos, targetRect, React) {
56452
+ var rendered = [];
56453
+ ["horizontal", "vertical"].forEach(function (type) {
56454
+ var nextGuidelines = guidelines.filter(function (guideline) {
56455
+ return guideline.type === type;
56456
+ });
56457
+ var index = type === "vertical" ? 0 : 1;
56458
+ var otherIndex = index ? 0 : 1;
56459
+ var mainNames = index ? HORIZONTAL_NAMES_MAP : VERTICAL_NAMES_MAP;
56460
+ var sideNames = index ? VERTICAL_NAMES_MAP : HORIZONTAL_NAMES_MAP;
56461
+ var targetStart = targetRect[mainNames.start];
56462
+ var targetEnd = targetRect[mainNames.end];
56463
+ var targetSideStart = targetRect[sideNames.start];
56464
+ var targetSideEnd = targetRect[sideNames.end];
56465
+ nextGuidelines.forEach(function (_a) {
56466
+ var gap = _a.gap,
56467
+ gapRects = _a.gapRects,
56468
+ className = _a.className;
56469
+ var sideStartPos = Math.max.apply(Math, __spreadArrays([targetSideStart], gapRects.map(function (_a) {
56470
+ var rect = _a.rect;
56471
+ return rect[sideNames.start];
56472
+ })));
56473
+ var sideEndPos = Math.min.apply(Math, __spreadArrays([targetSideEnd], gapRects.map(function (_a) {
56474
+ var rect = _a.rect;
56475
+ return rect[sideNames.end];
56476
+ })));
56477
+ var sideCenterPos = (sideStartPos + sideEndPos) / 2;
56381
56478
 
56382
- var container = moveable.state.container;
56383
- var snapContainer = moveable.props.snapContainer || container;
56384
- var containerClientRect = state.containerClientRect;
56385
- var snapOffset = {
56386
- left: 0,
56387
- top: 0,
56388
- bottom: 0,
56389
- right: 0
56390
- };
56479
+ if (sideStartPos === sideEndPos || sideCenterPos === (targetSideStart + targetSideEnd) / 2) {
56480
+ return;
56481
+ }
56391
56482
 
56392
- if (container !== snapContainer) {
56393
- var snapContainerTarget = getRefTarget(snapContainer, true);
56483
+ gapRects.forEach(function (_a) {
56484
+ var rect = _a.rect;
56485
+ var renderPos = [targetPos[0], targetPos[1]];
56394
56486
 
56395
- if (snapContainerTarget) {
56396
- var snapContainerRect = getClientRect(snapContainerTarget);
56397
- var offset1 = getDragDistByState(state, [snapContainerRect.left - containerClientRect.left, snapContainerRect.top - containerClientRect.top]);
56398
- var offset2 = getDragDistByState(state, [snapContainerRect.right - containerClientRect.right, snapContainerRect.bottom - containerClientRect.bottom]);
56399
- snapOffset.left = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(offset1[0], 0.1);
56400
- snapOffset.top = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(offset1[1], 0.1);
56401
- snapOffset.right = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(offset2[0], 0.1);
56402
- snapOffset.bottom = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(offset2[1], 0.1);
56403
- }
56404
- }
56487
+ if (rect[mainNames.end] < targetStart) {
56488
+ renderPos[index] += rect[mainNames.end] - targetStart;
56489
+ } else if (targetEnd < rect[mainNames.start]) {
56490
+ renderPos[index] += rect[mainNames.start] - targetStart - gap;
56491
+ } else {
56492
+ return;
56493
+ }
56405
56494
 
56406
- state.snapOffset = snapOffset;
56407
- state.elementGuidelineValues = [];
56408
- state.staticGuidelines = getElementGuidelines(moveable, false);
56409
- state.guidelines = getTotalGuidelines(moveable);
56410
- state.enableSnap = true;
56495
+ renderPos[otherIndex] += sideCenterPos - targetSideStart;
56496
+ rendered.push(renderDigitLine(moveable, index ? "vertical" : "horizontal", "gap", rendered.length, gap, renderPos, className, React));
56497
+ });
56498
+ });
56499
+ });
56500
+ return rendered;
56411
56501
  }
56412
- function hasGuidelines(moveable, ableName) {
56413
- var _a = moveable.props,
56414
- snappable = _a.snappable,
56415
- bounds = _a.bounds,
56416
- innerBounds = _a.innerBounds,
56417
- verticalGuidelines = _a.verticalGuidelines,
56418
- horizontalGuidelines = _a.horizontalGuidelines,
56419
- snapGridWidth = _a.snapGridWidth,
56420
- snapGridHeight = _a.snapGridHeight,
56421
- _b = moveable.state,
56422
- guidelines = _b.guidelines,
56423
- enableSnap = _b.enableSnap;
56424
56502
 
56425
- if (!snappable || !enableSnap || ableName && snappable !== true && snappable.indexOf(ableName) < 0) {
56426
- return false;
56503
+ function solveEquation(pos1, pos2, snapOffset, isVertical) {
56504
+ var dx = pos2[0] - pos1[0];
56505
+ var dy = pos2[1] - pos1[1];
56506
+
56507
+ if (Math.abs(dx) < _daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.TINY_NUM) {
56508
+ dx = 0;
56427
56509
  }
56428
56510
 
56429
- if (snapGridWidth || snapGridHeight || bounds || innerBounds || guidelines && guidelines.length || verticalGuidelines && verticalGuidelines.length || horizontalGuidelines && horizontalGuidelines.length) {
56430
- return true;
56511
+ if (Math.abs(dy) < _daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.TINY_NUM) {
56512
+ dy = 0;
56431
56513
  }
56432
56514
 
56433
- return false;
56515
+ if (!dx) {
56516
+ // y = 0 * x + b
56517
+ // only horizontal
56518
+ if (!isVertical) {
56519
+ return [0, snapOffset];
56520
+ }
56521
+
56522
+ return [0, 0];
56523
+ }
56524
+
56525
+ if (!dy) {
56526
+ // only vertical
56527
+ if (isVertical) {
56528
+ return [snapOffset, 0];
56529
+ }
56530
+
56531
+ return [0, 0];
56532
+ } // y = ax + b
56533
+
56534
+
56535
+ var a = dy / dx;
56536
+ var b = pos1[1] - a * pos1[0];
56537
+
56538
+ if (isVertical) {
56539
+ // y = a * x + b
56540
+ var y = a * (pos2[0] + snapOffset) + b;
56541
+ return [snapOffset, y - pos2[1]];
56542
+ } else {
56543
+ // x = (y - b) / a
56544
+ var x = (pos2[1] + snapOffset - b) / a;
56545
+ return [x - pos2[0], snapOffset];
56546
+ }
56434
56547
  }
56435
56548
 
56436
56549
  function solveNextOffset(pos1, pos2, offset, isVertical, datas) {
@@ -56462,22 +56575,6 @@ function solveNextOffset(pos1, pos2, offset, isVertical, datas) {
56462
56575
  };
56463
56576
  }
56464
56577
 
56465
- function getNextFixedPoses(matrix, width, height, fixedPos, direction, is3d) {
56466
- var nextPoses = calculatePoses(matrix, width, height, is3d ? 4 : 3);
56467
- var nextPos = getPosByReverseDirection(nextPoses, direction);
56468
- return getAbsolutePoses(nextPoses, (0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.minus)(fixedPos, nextPos));
56469
- }
56470
-
56471
- function getSnapBoundOffset(boundInfo, snapInfo) {
56472
- if (boundInfo.isBound) {
56473
- return boundInfo.offset;
56474
- } else if (snapInfo.isSnap) {
56475
- return snapInfo.offset;
56476
- }
56477
-
56478
- return 0;
56479
- }
56480
-
56481
56578
  function getSnapBound(boundInfo, snapInfo) {
56482
56579
  if (boundInfo.isBound) {
56483
56580
  return boundInfo.offset;
@@ -56488,51 +56585,148 @@ function getSnapBound(boundInfo, snapInfo) {
56488
56585
  return 0;
56489
56586
  }
56490
56587
 
56491
- function checkSnapBoundsKeepRatio(moveable, startPos, endPos, isRequest) {
56492
- var _a = checkBoundKeepRatio(moveable, startPos, endPos),
56493
- horizontalBoundInfo = _a.horizontal,
56494
- verticalBoundInfo = _a.vertical;
56588
+ function checkThrottleDragRotate(throttleDragRotate, _a, _b, _c, _d) {
56589
+ var distX = _a[0],
56590
+ distY = _a[1];
56591
+ var isVerticalBound = _b[0],
56592
+ isHorizontalBound = _b[1];
56593
+ var isVerticalSnap = _c[0],
56594
+ isHorizontalSnap = _c[1];
56595
+ var verticalOffset = _d[0],
56596
+ horizontalOffset = _d[1];
56597
+ var offsetX = -verticalOffset;
56598
+ var offsetY = -horizontalOffset;
56495
56599
 
56496
- var _b = isRequest ? {
56497
- horizontal: {
56498
- isSnap: false
56499
- },
56500
- vertical: {
56501
- isSnap: false
56600
+ if (throttleDragRotate && distX && distY) {
56601
+ offsetX = 0;
56602
+ offsetY = 0;
56603
+ var adjustPoses = [];
56604
+
56605
+ if (isVerticalBound && isHorizontalBound) {
56606
+ adjustPoses.push([0, horizontalOffset], [verticalOffset, 0]);
56607
+ } else if (isVerticalBound) {
56608
+ adjustPoses.push([verticalOffset, 0]);
56609
+ } else if (isHorizontalBound) {
56610
+ adjustPoses.push([0, horizontalOffset]);
56611
+ } else if (isVerticalSnap && isHorizontalSnap) {
56612
+ adjustPoses.push([0, horizontalOffset], [verticalOffset, 0]);
56613
+ } else if (isVerticalSnap) {
56614
+ adjustPoses.push([verticalOffset, 0]);
56615
+ } else if (isHorizontalSnap) {
56616
+ adjustPoses.push([0, horizontalOffset]);
56502
56617
  }
56503
- } : checkSnapKeepRatio(moveable, startPos, endPos),
56504
- horizontalSnapInfo = _b.horizontal,
56505
- verticalSnapInfo = _b.vertical;
56506
56618
 
56507
- var horizontalOffset = getSnapBoundOffset(horizontalBoundInfo, horizontalSnapInfo);
56508
- var verticalOffset = getSnapBoundOffset(verticalBoundInfo, verticalSnapInfo);
56509
- var horizontalDist = Math.abs(horizontalOffset);
56510
- var verticalDist = Math.abs(verticalOffset);
56511
- return {
56512
- horizontal: {
56513
- isBound: horizontalBoundInfo.isBound,
56514
- isSnap: horizontalSnapInfo.isSnap,
56515
- offset: horizontalOffset,
56516
- dist: horizontalDist
56517
- },
56518
- vertical: {
56519
- isBound: verticalBoundInfo.isBound,
56520
- isSnap: verticalSnapInfo.isSnap,
56521
- offset: verticalOffset,
56522
- dist: verticalDist
56619
+ if (adjustPoses.length) {
56620
+ adjustPoses.sort(function (a, b) {
56621
+ return getDistSize((0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.minus)([distX, distY], a)) - getDistSize((0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.minus)([distX, distY], b));
56622
+ });
56623
+ var adjustPos = adjustPoses[0];
56624
+
56625
+ if (adjustPos[0] && Math.abs(distX) > _daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.TINY_NUM) {
56626
+ offsetX = -adjustPos[0];
56627
+ offsetY = distY * Math.abs(distX + offsetX) / Math.abs(distX) - distY;
56628
+ } else if (adjustPos[1] && Math.abs(distY) > _daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.TINY_NUM) {
56629
+ var prevDistY = distY;
56630
+ offsetY = -adjustPos[1];
56631
+ offsetX = distX * Math.abs(distY + offsetY) / Math.abs(prevDistY) - distX;
56632
+ }
56633
+
56634
+ if (throttleDragRotate && isHorizontalBound && isVerticalBound) {
56635
+ if (Math.abs(offsetX) > _daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.TINY_NUM && Math.abs(offsetX) < Math.abs(verticalOffset)) {
56636
+ var scale = Math.abs(verticalOffset) / Math.abs(offsetX);
56637
+ offsetX *= scale;
56638
+ offsetY *= scale;
56639
+ } else if (Math.abs(offsetY) > _daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.TINY_NUM && Math.abs(offsetY) < Math.abs(horizontalOffset)) {
56640
+ var scale = Math.abs(horizontalOffset) / Math.abs(offsetY);
56641
+ offsetX *= scale;
56642
+ offsetY *= scale;
56643
+ } else {
56644
+ offsetX = maxOffset(-verticalOffset, offsetX);
56645
+ offsetY = maxOffset(-horizontalOffset, offsetY);
56646
+ }
56647
+ }
56523
56648
  }
56649
+ } else {
56650
+ offsetX = distX || isVerticalBound ? -verticalOffset : 0;
56651
+ offsetY = distY || isHorizontalBound ? -horizontalOffset : 0;
56652
+ }
56653
+
56654
+ return [offsetX, offsetY];
56655
+ }
56656
+ function checkSnapBoundsDrag(moveable, distX, distY, throttleDragRotate, isRequest, datas) {
56657
+ if (!hasGuidelines(moveable, "draggable")) {
56658
+ return [{
56659
+ isSnap: false,
56660
+ isBound: false,
56661
+ offset: 0
56662
+ }, {
56663
+ isSnap: false,
56664
+ isBound: false,
56665
+ offset: 0
56666
+ }];
56667
+ }
56668
+
56669
+ var poses = getAbsolutePoses(datas.absolutePoses, [distX, distY]);
56670
+
56671
+ var _a = getRect(poses),
56672
+ left = _a.left,
56673
+ right = _a.right,
56674
+ top = _a.top,
56675
+ bottom = _a.bottom;
56676
+
56677
+ var boundPoses = {
56678
+ horizontal: poses.map(function (pos) {
56679
+ return pos[1];
56680
+ }),
56681
+ vertical: poses.map(function (pos) {
56682
+ return pos[0];
56683
+ })
56524
56684
  };
56685
+ var snapDirections = getSnapDirections(moveable.props.snapDirections);
56686
+ var snapPoses = splitSnapDirectionPoses(snapDirections, {
56687
+ left: left,
56688
+ right: right,
56689
+ top: top,
56690
+ bottom: bottom,
56691
+ center: (left + right) / 2,
56692
+ middle: (top + bottom) / 2
56693
+ });
56694
+
56695
+ var _b = checkMoveableSnapBounds(moveable, isRequest, snapPoses, boundPoses),
56696
+ verticalSnapBoundInfo = _b.vertical,
56697
+ horizontalSnapBoundInfo = _b.horizontal;
56698
+
56699
+ var _c = getInnerBoundDragInfo(moveable, poses, datas),
56700
+ verticalInnerBoundInfo = _c.vertical,
56701
+ horizontalInnerBoundInfo = _c.horizontal;
56702
+
56703
+ var isVerticalSnap = verticalSnapBoundInfo.isSnap;
56704
+ var isHorizontalSnap = horizontalSnapBoundInfo.isSnap;
56705
+ var isVerticalBound = verticalSnapBoundInfo.isBound || verticalInnerBoundInfo.isBound;
56706
+ var isHorizontalBound = horizontalSnapBoundInfo.isBound || horizontalInnerBoundInfo.isBound;
56707
+ var verticalOffset = maxOffset(verticalSnapBoundInfo.offset, verticalInnerBoundInfo.offset);
56708
+ var horizontalOffset = maxOffset(horizontalSnapBoundInfo.offset, horizontalInnerBoundInfo.offset);
56709
+
56710
+ var _d = checkThrottleDragRotate(throttleDragRotate, [distX, distY], [isVerticalBound, isHorizontalBound], [isVerticalSnap, isHorizontalSnap], [verticalOffset, horizontalOffset]),
56711
+ offsetX = _d[0],
56712
+ offsetY = _d[1];
56713
+
56714
+ return [{
56715
+ isBound: isVerticalBound,
56716
+ isSnap: isVerticalSnap,
56717
+ offset: offsetX
56718
+ }, {
56719
+ isBound: isHorizontalBound,
56720
+ isSnap: isHorizontalSnap,
56721
+ offset: offsetY
56722
+ }];
56525
56723
  }
56526
56724
  function checkMoveableSnapBounds(moveable, isRequest, poses, boundPoses) {
56527
56725
  if (boundPoses === void 0) {
56528
56726
  boundPoses = poses;
56529
56727
  }
56530
56728
 
56531
- var _a = checkBoundPoses(getBounds(moveable), boundPoses.map(function (pos) {
56532
- return pos[0];
56533
- }), boundPoses.map(function (pos) {
56534
- return pos[1];
56535
- })),
56729
+ var _a = checkBoundPoses(getBounds(moveable), boundPoses.vertical, boundPoses.horizontal),
56536
56730
  horizontalBoundInfos = _a.horizontal,
56537
56731
  verticalBoundInfos = _a.vertical;
56538
56732
 
@@ -56545,11 +56739,7 @@ function checkMoveableSnapBounds(moveable, isRequest, poses, boundPoses) {
56545
56739
  isSnap: false,
56546
56740
  index: -1
56547
56741
  }
56548
- } : checkMoveableSnapPoses(moveable, poses.map(function (pos) {
56549
- return pos[0];
56550
- }), poses.map(function (pos) {
56551
- return pos[1];
56552
- }), moveable.props.snapCenter),
56742
+ } : checkMoveableSnapPoses(moveable, poses.vertical, poses.horizontal),
56553
56743
  horizontalSnapInfo = _b.horizontal,
56554
56744
  verticalSnapInfo = _b.vertical;
56555
56745
 
@@ -56578,25 +56768,16 @@ function checkMoveableSnapBounds(moveable, isRequest, poses, boundPoses) {
56578
56768
  }
56579
56769
  };
56580
56770
  }
56581
- function checkSnapBounds(guideines, bounds, posesX, posesY, options) {
56582
- if (options === void 0) {
56583
- options = {};
56584
- }
56585
-
56771
+ function checkSnapBounds(guideines, bounds, posesX, posesY, snapThreshold) {
56586
56772
  var _a = checkBoundPoses(bounds, posesX, posesY),
56587
56773
  horizontalBoundInfos = _a.horizontal,
56588
- verticalBoundInfos = _a.vertical;
56774
+ verticalBoundInfos = _a.vertical; // options.isRequest ? {
56775
+ // horizontal: { isSnap: false, index: -1 } as SnapInfo,
56776
+ // vertical: { isSnap: false, index: -1 } as SnapInfo,
56777
+ // } :
56589
56778
 
56590
- var _b = options.isRequest ? {
56591
- horizontal: {
56592
- isSnap: false,
56593
- index: -1
56594
- },
56595
- vertical: {
56596
- isSnap: false,
56597
- index: -1
56598
- }
56599
- } : checkSnapPoses(guideines, posesX, posesY, options),
56779
+
56780
+ var _b = checkSnapPoses(guideines, posesX, posesY, snapThreshold),
56600
56781
  horizontalSnapInfo = _b.horizontal,
56601
56782
  verticalSnapInfo = _b.vertical;
56602
56783
 
@@ -56625,71 +56806,6 @@ function checkSnapBounds(guideines, bounds, posesX, posesY, options) {
56625
56806
  }
56626
56807
  };
56627
56808
  }
56628
- function checkMaxBounds(moveable, poses, direction, fixedPosition, datas) {
56629
- var fixedDirection = [-direction[0], -direction[1]];
56630
- var _a = moveable.state,
56631
- width = _a.width,
56632
- height = _a.height;
56633
- var bounds = moveable.props.bounds;
56634
- var maxWidth = Infinity;
56635
- var maxHeight = Infinity;
56636
-
56637
- if (bounds) {
56638
- var directions = [[direction[0], -direction[1]], [-direction[0], direction[1]]];
56639
- var _b = bounds.left,
56640
- left_1 = _b === void 0 ? -Infinity : _b,
56641
- _c = bounds.top,
56642
- top_1 = _c === void 0 ? -Infinity : _c,
56643
- _d = bounds.right,
56644
- right_1 = _d === void 0 ? Infinity : _d,
56645
- _e = bounds.bottom,
56646
- bottom_1 = _e === void 0 ? Infinity : _e;
56647
- directions.forEach(function (otherDirection) {
56648
- var isCheckVertical = otherDirection[0] !== fixedDirection[0];
56649
- var isCheckHorizontal = otherDirection[1] !== fixedDirection[1];
56650
- var otherPos = getPosByDirection(poses, otherDirection);
56651
- var deg = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.getRad)(fixedPosition, otherPos) * 360 / Math.PI;
56652
-
56653
- if (isCheckHorizontal) {
56654
- var nextOtherPos = otherPos.slice();
56655
-
56656
- if (Math.abs(deg - 360) < 2 || Math.abs(deg - 180) < 2) {
56657
- nextOtherPos[1] = fixedPosition[1];
56658
- }
56659
-
56660
- var _a = solveNextOffset(fixedPosition, nextOtherPos, (fixedPosition[1] < otherPos[1] ? bottom_1 : top_1) - otherPos[1], false, datas),
56661
- _b = _a.offset,
56662
- heightOffset = _b[1],
56663
- isHeightOutside = _a.isOutside;
56664
-
56665
- if (!isNaN(heightOffset)) {
56666
- maxHeight = height + (isHeightOutside ? 1 : -1) * Math.abs(heightOffset);
56667
- }
56668
- }
56669
-
56670
- if (isCheckVertical) {
56671
- var nextOtherPos = otherPos.slice();
56672
-
56673
- if (Math.abs(deg - 90) < 2 || Math.abs(deg - 270) < 2) {
56674
- nextOtherPos[0] = fixedPosition[0];
56675
- }
56676
-
56677
- var _c = solveNextOffset(fixedPosition, nextOtherPos, (fixedPosition[0] < otherPos[0] ? right_1 : left_1) - otherPos[0], true, datas),
56678
- widthOffset = _c.offset[0],
56679
- isWidthOutside = _c.isOutside;
56680
-
56681
- if (!isNaN(widthOffset)) {
56682
- maxWidth = width + (isWidthOutside ? 1 : -1) * Math.abs(widthOffset);
56683
- }
56684
- }
56685
- });
56686
- }
56687
-
56688
- return {
56689
- maxWidth: maxWidth,
56690
- maxHeight: maxHeight
56691
- };
56692
- }
56693
56809
 
56694
56810
  function checkSnapRightLine(startPos, endPos, snapBoundInfo, keepRatio) {
56695
56811
  var rad = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.getRad)(startPos, endPos) / Math.PI * 180;
@@ -56724,7 +56840,10 @@ function getSnapBoundInfo(moveable, poses, directions, keepRatio, isRequest, dat
56724
56840
  endDirection = _a[1];
56725
56841
  var otherStartPos = getPosByDirection(poses, startDirection);
56726
56842
  var otherEndPos = getPosByDirection(poses, endDirection);
56727
- var snapBoundInfo = keepRatio ? checkSnapBoundsKeepRatio(moveable, otherStartPos, otherEndPos, isRequest) : checkMoveableSnapBounds(moveable, isRequest, [otherEndPos]);
56843
+ var snapBoundInfo = keepRatio ? checkSnapBoundsKeepRatio(moveable, otherStartPos, otherEndPos, isRequest) : checkMoveableSnapBounds(moveable, isRequest, {
56844
+ vertical: [otherEndPos[0]],
56845
+ horizontal: [otherEndPos[1]]
56846
+ });
56728
56847
  var _b = snapBoundInfo.horizontal,
56729
56848
  // dist: otherHorizontalDist,
56730
56849
  otherHorizontalOffset = _b.offset,
@@ -56770,37 +56889,157 @@ function getSnapBoundInfo(moveable, poses, directions, keepRatio, isRequest, dat
56770
56889
  });
56771
56890
  }
56772
56891
 
56773
- function getCheckSnapDirections(direction, keepRatio) {
56774
- var directions = [];
56775
- var fixedDirection = [-direction[0], -direction[1]];
56892
+ function getSnapBoundOffset(boundInfo, snapInfo) {
56893
+ if (boundInfo.isBound) {
56894
+ return boundInfo.offset;
56895
+ } else if (snapInfo.isSnap) {
56896
+ return snapInfo.offset;
56897
+ }
56776
56898
 
56777
- if (direction[0] && direction[1]) {
56778
- directions.push([fixedDirection, [direction[0], -direction[1]]], [fixedDirection, [-direction[0], direction[1]]]);
56899
+ return 0;
56900
+ }
56779
56901
 
56780
- if (keepRatio) {
56781
- // pass two direction condition
56782
- directions.push([fixedDirection, direction]);
56902
+ function checkSnapBoundsKeepRatio(moveable, startPos, endPos, isRequest) {
56903
+ var _a = checkBoundKeepRatio(moveable, startPos, endPos),
56904
+ horizontalBoundInfo = _a.horizontal,
56905
+ verticalBoundInfo = _a.vertical;
56906
+
56907
+ var _b = isRequest ? {
56908
+ horizontal: {
56909
+ isSnap: false
56910
+ },
56911
+ vertical: {
56912
+ isSnap: false
56783
56913
  }
56784
- } else if (direction[0]) {
56785
- // vertcal
56786
- if (keepRatio) {
56787
- directions.push([fixedDirection, [fixedDirection[0], -1]], [fixedDirection, [fixedDirection[0], 1]], [fixedDirection, [direction[0], -1]], [fixedDirection, direction], [fixedDirection, [direction[0], 1]]);
56788
- } else {
56789
- directions.push([[fixedDirection[0], -1], [direction[0], -1]], [[fixedDirection[0], 0], [direction[0], 0]], [[fixedDirection[0], 1], [direction[0], 1]]);
56914
+ } : checkSnapKeepRatio(moveable, startPos, endPos),
56915
+ horizontalSnapInfo = _b.horizontal,
56916
+ verticalSnapInfo = _b.vertical;
56917
+
56918
+ var horizontalOffset = getSnapBoundOffset(horizontalBoundInfo, horizontalSnapInfo);
56919
+ var verticalOffset = getSnapBoundOffset(verticalBoundInfo, verticalSnapInfo);
56920
+ var horizontalDist = Math.abs(horizontalOffset);
56921
+ var verticalDist = Math.abs(verticalOffset);
56922
+ return {
56923
+ horizontal: {
56924
+ isBound: horizontalBoundInfo.isBound,
56925
+ isSnap: horizontalSnapInfo.isSnap,
56926
+ offset: horizontalOffset,
56927
+ dist: horizontalDist
56928
+ },
56929
+ vertical: {
56930
+ isBound: verticalBoundInfo.isBound,
56931
+ isSnap: verticalSnapInfo.isSnap,
56932
+ offset: verticalOffset,
56933
+ dist: verticalDist
56790
56934
  }
56791
- } else if (direction[1]) {
56792
- // horizontal
56793
- if (keepRatio) {
56794
- directions.push([fixedDirection, [-1, fixedDirection[1]]], [fixedDirection, [1, fixedDirection[1]]], [fixedDirection, [-1, direction[1]]], [fixedDirection, [1, direction[1]]], [fixedDirection, direction]);
56795
- } else {
56796
- directions.push([[-1, fixedDirection[1]], [-1, direction[1]]], [[0, fixedDirection[1]], [0, direction[1]]], [[1, fixedDirection[1]], [1, direction[1]]]);
56935
+ };
56936
+ }
56937
+ function checkMaxBounds(moveable, poses, direction, fixedPosition, datas) {
56938
+ var fixedDirection = [-direction[0], -direction[1]];
56939
+ var _a = moveable.state,
56940
+ width = _a.width,
56941
+ height = _a.height;
56942
+ var bounds = moveable.props.bounds;
56943
+ var maxWidth = Infinity;
56944
+ var maxHeight = Infinity;
56945
+
56946
+ if (bounds) {
56947
+ var directions = [[direction[0], -direction[1]], [-direction[0], direction[1]]];
56948
+ var _b = bounds.left,
56949
+ left_1 = _b === void 0 ? -Infinity : _b,
56950
+ _c = bounds.top,
56951
+ top_1 = _c === void 0 ? -Infinity : _c,
56952
+ _d = bounds.right,
56953
+ right_1 = _d === void 0 ? Infinity : _d,
56954
+ _e = bounds.bottom,
56955
+ bottom_1 = _e === void 0 ? Infinity : _e;
56956
+ directions.forEach(function (otherDirection) {
56957
+ var isCheckVertical = otherDirection[0] !== fixedDirection[0];
56958
+ var isCheckHorizontal = otherDirection[1] !== fixedDirection[1];
56959
+ var otherPos = getPosByDirection(poses, otherDirection);
56960
+ var deg = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.getRad)(fixedPosition, otherPos) * 360 / Math.PI;
56961
+
56962
+ if (isCheckHorizontal) {
56963
+ var nextOtherPos = otherPos.slice();
56964
+
56965
+ if (Math.abs(deg - 360) < 2 || Math.abs(deg - 180) < 2) {
56966
+ nextOtherPos[1] = fixedPosition[1];
56967
+ }
56968
+
56969
+ var _a = solveNextOffset(fixedPosition, nextOtherPos, (fixedPosition[1] < otherPos[1] ? bottom_1 : top_1) - otherPos[1], false, datas),
56970
+ _b = _a.offset,
56971
+ heightOffset = _b[1],
56972
+ isHeightOutside = _a.isOutside;
56973
+
56974
+ if (!isNaN(heightOffset)) {
56975
+ maxHeight = height + (isHeightOutside ? 1 : -1) * Math.abs(heightOffset);
56976
+ }
56977
+ }
56978
+
56979
+ if (isCheckVertical) {
56980
+ var nextOtherPos = otherPos.slice();
56981
+
56982
+ if (Math.abs(deg - 90) < 2 || Math.abs(deg - 270) < 2) {
56983
+ nextOtherPos[0] = fixedPosition[0];
56984
+ }
56985
+
56986
+ var _c = solveNextOffset(fixedPosition, nextOtherPos, (fixedPosition[0] < otherPos[0] ? right_1 : left_1) - otherPos[0], true, datas),
56987
+ widthOffset = _c.offset[0],
56988
+ isWidthOutside = _c.isOutside;
56989
+
56990
+ if (!isNaN(widthOffset)) {
56991
+ maxWidth = width + (isWidthOutside ? 1 : -1) * Math.abs(widthOffset);
56992
+ }
56993
+ }
56994
+ });
56995
+ }
56996
+
56997
+ return {
56998
+ maxWidth: maxWidth,
56999
+ maxHeight: maxHeight
57000
+ };
57001
+ }
57002
+
57003
+ function snapStart(moveable) {
57004
+ var state = moveable.state;
57005
+
57006
+ if (state.guidelines && state.guidelines.length) {
57007
+ return;
57008
+ }
57009
+
57010
+ var container = moveable.state.container;
57011
+ var snapContainer = moveable.props.snapContainer || container;
57012
+ var containerClientRect = state.containerClientRect;
57013
+ var snapOffset = {
57014
+ left: 0,
57015
+ top: 0,
57016
+ bottom: 0,
57017
+ right: 0
57018
+ };
57019
+
57020
+ if (container !== snapContainer) {
57021
+ var snapContainerTarget = getRefTarget(snapContainer, true);
57022
+
57023
+ if (snapContainerTarget) {
57024
+ var snapContainerRect = getClientRect(snapContainerTarget);
57025
+ var offset1 = getDragDistByState(state, [snapContainerRect.left - containerClientRect.left, snapContainerRect.top - containerClientRect.top]);
57026
+ var offset2 = getDragDistByState(state, [snapContainerRect.right - containerClientRect.right, snapContainerRect.bottom - containerClientRect.bottom]);
57027
+ snapOffset.left = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(offset1[0], 0.1);
57028
+ snapOffset.top = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(offset1[1], 0.1);
57029
+ snapOffset.right = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(offset2[0], 0.1);
57030
+ snapOffset.bottom = (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(offset2[1], 0.1);
56797
57031
  }
56798
- } else {
56799
- // [0, 0] to all direction
56800
- directions.push([fixedDirection, [1, 0]], [fixedDirection, [-1, 0]], [fixedDirection, [0, -1]], [fixedDirection, [0, 1]], [[1, 0], [1, -1]], [[1, 0], [1, 1]], [[0, 1], [1, 1]], [[0, 1], [-1, 1]], [[-1, 0], [-1, -1]], [[-1, 0], [-1, 1]], [[0, -1], [1, -1]], [[0, -1], [-1, -1]]);
56801
57032
  }
56802
57033
 
56803
- return directions;
57034
+ state.snapOffset = snapOffset;
57035
+ state.guidelines = getTotalGuidelines(moveable);
57036
+ state.enableSnap = true;
57037
+ }
57038
+
57039
+ function getNextFixedPoses(matrix, width, height, fixedPos, direction, is3d) {
57040
+ var nextPoses = calculatePoses(matrix, width, height, is3d ? 4 : 3);
57041
+ var nextPos = getPosByReverseDirection(nextPoses, direction);
57042
+ return getAbsolutePoses(nextPoses, (0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.minus)(fixedPos, nextPos));
56804
57043
  }
56805
57044
  function getSizeOffsetInfo(moveable, poses, direction, keepRatio, isRequest, datas) {
56806
57045
  var directions = getCheckSnapDirections(direction, keepRatio);
@@ -56824,7 +57063,10 @@ function getSizeOffsetInfo(moveable, poses, direction, keepRatio, isRequest, dat
56824
57063
  function recheckSizeByTwoDirection(moveable, poses, width, height, maxWidth, maxHeight, direction, isRequest, datas) {
56825
57064
  var snapPos = getPosByDirection(poses, direction);
56826
57065
 
56827
- var _a = checkMoveableSnapBounds(moveable, isRequest, [snapPos]),
57066
+ var _a = checkMoveableSnapBounds(moveable, isRequest, {
57067
+ vertical: [snapPos[0]],
57068
+ horizontal: [snapPos[1]]
57069
+ }),
56828
57070
  horizontalOffset = _a.horizontal.offset,
56829
57071
  verticalOffset = _a.vertical.offset;
56830
57072
 
@@ -56969,179 +57211,9 @@ function checkSnapScale(moveable, scale, direction, isRequest, datas) {
56969
57211
  }, width, height, direction, fixedPosition, isRequest, datas);
56970
57212
  return [sizeDist[0] / width, sizeDist[1] / height];
56971
57213
  }
56972
- function solveEquation(pos1, pos2, snapOffset, isVertical) {
56973
- var dx = pos2[0] - pos1[0];
56974
- var dy = pos2[1] - pos1[1];
56975
-
56976
- if (Math.abs(dx) < TINY_NUM) {
56977
- dx = 0;
56978
- }
56979
-
56980
- if (Math.abs(dy) < TINY_NUM) {
56981
- dy = 0;
56982
- }
56983
-
56984
- if (!dx) {
56985
- // y = 0 * x + b
56986
- // only horizontal
56987
- if (!isVertical) {
56988
- return [0, snapOffset];
56989
- }
56990
-
56991
- return [0, 0];
56992
- }
56993
-
56994
- if (!dy) {
56995
- // only vertical
56996
- if (isVertical) {
56997
- return [snapOffset, 0];
56998
- }
56999
-
57000
- return [0, 0];
57001
- } // y = ax + b
57002
-
57003
-
57004
- var a = dy / dx;
57005
- var b = pos1[1] - a * pos1[0];
57006
-
57007
- if (isVertical) {
57008
- // y = a * x + b
57009
- var y = a * (pos2[0] + snapOffset) + b;
57010
- return [snapOffset, y - pos2[1]];
57011
- } else {
57012
- // x = (y - b) / a
57013
- var x = (pos2[1] + snapOffset - b) / a;
57014
- return [x - pos2[0], snapOffset];
57015
- }
57016
- }
57017
57214
  function startCheckSnapDrag(moveable, datas) {
57018
57215
  datas.absolutePoses = getAbsolutePosesByState(moveable.state);
57019
57216
  }
57020
- function checkThrottleDragRotate(throttleDragRotate, _a, _b, _c, _d) {
57021
- var distX = _a[0],
57022
- distY = _a[1];
57023
- var isVerticalBound = _b[0],
57024
- isHorizontalBound = _b[1];
57025
- var isVerticalSnap = _c[0],
57026
- isHorizontalSnap = _c[1];
57027
- var verticalOffset = _d[0],
57028
- horizontalOffset = _d[1];
57029
- var offsetX = -verticalOffset;
57030
- var offsetY = -horizontalOffset;
57031
-
57032
- if (throttleDragRotate && distX && distY) {
57033
- offsetX = 0;
57034
- offsetY = 0;
57035
- var adjustPoses = [];
57036
-
57037
- if (isVerticalBound && isHorizontalBound) {
57038
- adjustPoses.push([0, horizontalOffset], [verticalOffset, 0]);
57039
- } else if (isVerticalBound) {
57040
- adjustPoses.push([verticalOffset, 0]);
57041
- } else if (isHorizontalBound) {
57042
- adjustPoses.push([0, horizontalOffset]);
57043
- } else if (isVerticalSnap && isHorizontalSnap) {
57044
- adjustPoses.push([0, horizontalOffset], [verticalOffset, 0]);
57045
- } else if (isVerticalSnap) {
57046
- adjustPoses.push([verticalOffset, 0]);
57047
- } else if (isHorizontalSnap) {
57048
- adjustPoses.push([0, horizontalOffset]);
57049
- }
57050
-
57051
- if (adjustPoses.length) {
57052
- adjustPoses.sort(function (a, b) {
57053
- return getDistSize((0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.minus)([distX, distY], a)) - getDistSize((0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.minus)([distX, distY], b));
57054
- });
57055
- var adjustPos = adjustPoses[0];
57056
-
57057
- if (adjustPos[0] && Math.abs(distX) > TINY_NUM) {
57058
- offsetX = -adjustPos[0];
57059
- offsetY = distY * Math.abs(distX + offsetX) / Math.abs(distX) - distY;
57060
- } else if (adjustPos[1] && Math.abs(distY) > TINY_NUM) {
57061
- var prevDistY = distY;
57062
- offsetY = -adjustPos[1];
57063
- offsetX = distX * Math.abs(distY + offsetY) / Math.abs(prevDistY) - distX;
57064
- }
57065
-
57066
- if (throttleDragRotate && isHorizontalBound && isVerticalBound) {
57067
- if (Math.abs(offsetX) > TINY_NUM && Math.abs(offsetX) < Math.abs(verticalOffset)) {
57068
- var scale = Math.abs(verticalOffset) / Math.abs(offsetX);
57069
- offsetX *= scale;
57070
- offsetY *= scale;
57071
- } else if (Math.abs(offsetY) > TINY_NUM && Math.abs(offsetY) < Math.abs(horizontalOffset)) {
57072
- var scale = Math.abs(horizontalOffset) / Math.abs(offsetY);
57073
- offsetX *= scale;
57074
- offsetY *= scale;
57075
- } else {
57076
- offsetX = maxOffset(-verticalOffset, offsetX);
57077
- offsetY = maxOffset(-horizontalOffset, offsetY);
57078
- }
57079
- }
57080
- }
57081
- } else {
57082
- offsetX = distX || isVerticalBound ? -verticalOffset : 0;
57083
- offsetY = distY || isHorizontalBound ? -horizontalOffset : 0;
57084
- }
57085
-
57086
- return [offsetX, offsetY];
57087
- }
57088
- function checkSnapDrag(moveable, distX, distY, throttleDragRotate, isRequest, datas) {
57089
- if (!hasGuidelines(moveable, "draggable")) {
57090
- return [{
57091
- isSnap: false,
57092
- isBound: false,
57093
- offset: 0
57094
- }, {
57095
- isSnap: false,
57096
- isBound: false,
57097
- offset: 0
57098
- }];
57099
- }
57100
-
57101
- var poses = getAbsolutePoses(datas.absolutePoses, [distX, distY]);
57102
-
57103
- var _a = getRect(poses),
57104
- left = _a.left,
57105
- right = _a.right,
57106
- top = _a.top,
57107
- bottom = _a.bottom;
57108
-
57109
- var snapCenter = moveable.props.snapCenter;
57110
- var snapPoses = [[left, top], [right, top], [left, bottom], [right, bottom]];
57111
-
57112
- if (snapCenter) {
57113
- snapPoses.push([(left + right) / 2, (top + bottom) / 2]);
57114
- }
57115
-
57116
- var _b = checkMoveableSnapBounds(moveable, isRequest, snapPoses, poses),
57117
- verticalSnapBoundInfo = _b.vertical,
57118
- horizontalSnapBoundInfo = _b.horizontal;
57119
-
57120
- var _c = getInnerBoundDragInfo(moveable, poses, datas),
57121
- verticalInnerBoundInfo = _c.vertical,
57122
- horizontalInnerBoundInfo = _c.horizontal;
57123
-
57124
- var isVerticalSnap = verticalSnapBoundInfo.isSnap;
57125
- var isHorizontalSnap = horizontalSnapBoundInfo.isSnap;
57126
- var isVerticalBound = verticalSnapBoundInfo.isBound || verticalInnerBoundInfo.isBound;
57127
- var isHorizontalBound = horizontalSnapBoundInfo.isBound || horizontalInnerBoundInfo.isBound;
57128
- var verticalOffset = maxOffset(verticalSnapBoundInfo.offset, verticalInnerBoundInfo.offset);
57129
- var horizontalOffset = maxOffset(horizontalSnapBoundInfo.offset, horizontalInnerBoundInfo.offset);
57130
-
57131
- var _d = checkThrottleDragRotate(throttleDragRotate, [distX, distY], [isVerticalBound, isHorizontalBound], [isVerticalSnap, isHorizontalSnap], [verticalOffset, horizontalOffset]),
57132
- offsetX = _d[0],
57133
- offsetY = _d[1];
57134
-
57135
- return [{
57136
- isBound: isVerticalBound,
57137
- isSnap: isVerticalSnap,
57138
- offset: offsetX
57139
- }, {
57140
- isBound: isHorizontalBound,
57141
- isSnap: isHorizontalSnap,
57142
- offset: offsetY
57143
- }];
57144
- }
57145
57217
 
57146
57218
  function getSnapGuidelines(posInfos) {
57147
57219
  var guidelines = [];
@@ -57159,101 +57231,6 @@ function getSnapGuidelines(posInfos) {
57159
57231
  return guidelines;
57160
57232
  }
57161
57233
 
57162
- function getGapGuidelinesToStart(guidelines, index, targetPos, targetSizes, guidelinePos, gap, otherPos) {
57163
- var absGap = Math.abs(gap);
57164
- var start = guidelinePos[index] + (gap > 0 ? targetSizes[0] : 0);
57165
- return guidelines.filter(function (_a) {
57166
- var gapPos = _a.pos;
57167
- return gapPos[index] <= targetPos[index];
57168
- }).sort(function (_a, _b) {
57169
- var aPos = _a.pos;
57170
- var bPos = _b.pos;
57171
- return bPos[index] - aPos[index];
57172
- }).filter(function (_a) {
57173
- var gapPos = _a.pos,
57174
- gapSizes = _a.sizes;
57175
- var nextPos = gapPos[index];
57176
-
57177
- if ((0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(nextPos + gapSizes[index], FLOAT_POINT_NUM) === (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(start - absGap, FLOAT_POINT_NUM)) {
57178
- start = nextPos;
57179
- return true;
57180
- }
57181
-
57182
- return false;
57183
- }).map(function (gapGuideline) {
57184
- var renderPos = -targetPos[index] + gapGuideline.pos[index] + gapGuideline.sizes[index];
57185
- return __assign(__assign({}, gapGuideline), {
57186
- gap: gap,
57187
- renderPos: index ? [otherPos, renderPos] : [renderPos, otherPos]
57188
- });
57189
- });
57190
- }
57191
-
57192
- function getGapGuidelinesToEnd(guidelines, index, targetPos, targetSizes, guidelinePos, gap, otherPos) {
57193
- var absGap = Math.abs(gap);
57194
- var start = guidelinePos[index] + (gap < 0 ? targetSizes[index] : 0);
57195
- return guidelines.filter(function (_a) {
57196
- var gapPos = _a.pos;
57197
- return gapPos[index] > targetPos[index];
57198
- }).sort(function (_a, _b) {
57199
- var aPos = _a.pos;
57200
- var bPos = _b.pos;
57201
- return aPos[index] - bPos[index];
57202
- }).filter(function (_a) {
57203
- var gapPos = _a.pos,
57204
- gapSizes = _a.sizes;
57205
- var nextPos = gapPos[index];
57206
-
57207
- if ((0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(nextPos, FLOAT_POINT_NUM) === (0,_daybrush_utils__WEBPACK_IMPORTED_MODULE_2__.throttle)(start + absGap, FLOAT_POINT_NUM)) {
57208
- start = nextPos + gapSizes[index];
57209
- return true;
57210
- }
57211
-
57212
- return false;
57213
- }).map(function (gapGuideline) {
57214
- var renderPos = -targetPos[index] + gapGuideline.pos[index] - absGap;
57215
- return __assign(__assign({}, gapGuideline), {
57216
- gap: gap,
57217
- renderPos: index ? [otherPos, renderPos] : [renderPos, otherPos]
57218
- });
57219
- });
57220
- }
57221
-
57222
- function getGapGuidelines$1(guidelines, type, targetPos, targetSizes) {
57223
- var elementGuidelines = guidelines.filter(function (_a) {
57224
- var element = _a.element,
57225
- gap = _a.gap,
57226
- guidelineType = _a.type;
57227
- return element && gap && guidelineType === type;
57228
- });
57229
-
57230
- var _a = type === "vertical" ? [0, 1] : [1, 0],
57231
- index = _a[0],
57232
- otherIndex = _a[1];
57233
-
57234
- return flat(elementGuidelines.map(function (guideline) {
57235
- var pos = guideline.pos;
57236
- var gap = guideline.gap;
57237
- var gapGuidelines = guideline.gapGuidelines;
57238
- var sizes = guideline.sizes;
57239
- var offset = minOffset(pos[otherIndex] + sizes[otherIndex] - targetPos[otherIndex], pos[otherIndex] - targetPos[otherIndex] - targetSizes[otherIndex]);
57240
- var minSize = Math.min(sizes[otherIndex], targetSizes[otherIndex]);
57241
-
57242
- if (offset > 0 && offset > minSize) {
57243
- offset = (offset - minSize / 2) * 2;
57244
- } else if (offset < 0 && offset < -minSize) {
57245
- offset = (offset + minSize / 2) * 2;
57246
- }
57247
-
57248
- if (offset === 0) {
57249
- return [];
57250
- }
57251
-
57252
- var otherPos = (offset > 0 ? 0 : targetSizes[otherIndex]) + offset / 2;
57253
- return __spreadArrays(getGapGuidelinesToStart(gapGuidelines, index, targetPos, targetSizes, pos, gap, otherPos), getGapGuidelinesToEnd(gapGuidelines, index, targetPos, targetSizes, pos, gap, otherPos));
57254
- }));
57255
- }
57256
-
57257
57234
  function addBoundGuidelines(moveable, verticalPoses, horizontalPoses, verticalSnapPoses, horizontalSnapPoses, externalBounds) {
57258
57235
  var _a = checkBoundPoses(getBounds(moveable, externalBounds), verticalPoses, horizontalPoses),
57259
57236
  verticalBoundInfos = _a.vertical,
@@ -57321,10 +57298,8 @@ var Snappable = {
57321
57298
  props: {
57322
57299
  snappable: [Boolean, Array],
57323
57300
  snapContainer: Object,
57324
- snapCenter: Boolean,
57325
- snapHorizontal: Boolean,
57326
- snapVertical: Boolean,
57327
- snapElement: Boolean,
57301
+ snapDirections: [Boolean, Object],
57302
+ elementSnapDirections: [Boolean, Object],
57328
57303
  snapGap: Boolean,
57329
57304
  snapGridWidth: Number,
57330
57305
  snapGridHeight: Number,
@@ -57351,36 +57326,15 @@ var Snappable = {
57351
57326
  pos2 = state.pos2,
57352
57327
  pos3 = state.pos3,
57353
57328
  pos4 = state.pos4,
57354
- snapRenderInfo = state.snapRenderInfo,
57355
- targetClientRect = state.targetClientRect,
57356
- containerClientRect = state.containerClientRect,
57357
- is3d = state.is3d,
57358
- rootMatrix = state.rootMatrix;
57329
+ snapRenderInfo = state.snapRenderInfo;
57359
57330
 
57360
57331
  if (!snapRenderInfo || !hasGuidelines(moveable, "")) {
57361
57332
  return [];
57362
57333
  }
57363
57334
 
57364
- state.staticGuidelines = getElementGuidelines(moveable, false, state.staticGuidelines);
57365
57335
  state.guidelines = getTotalGuidelines(moveable);
57366
- var n = is3d ? 4 : 3;
57367
57336
  var minLeft = Math.min(pos1[0], pos2[0], pos3[0], pos4[0]);
57368
57337
  var minTop = Math.min(pos1[1], pos2[1], pos3[1], pos4[1]);
57369
- var containerPos = calculateContainerPos(rootMatrix, containerClientRect, n);
57370
-
57371
- var _a = calculateInversePosition(rootMatrix, [targetClientRect.left - containerPos[0], targetClientRect.top - containerPos[1]], n),
57372
- clientLeft = _a[0],
57373
- clientTop = _a[1];
57374
-
57375
- var _b = moveable.props,
57376
- _c = _b.snapThreshold,
57377
- snapThreshold = _c === void 0 ? 5 : _c,
57378
- _d = _b.snapDigit,
57379
- snapDigit = _d === void 0 ? 0 : _d,
57380
- _e = _b.snapDistFormat,
57381
- snapDistFormat = _e === void 0 ? function (v) {
57382
- return v;
57383
- } : _e;
57384
57338
  var externalPoses = snapRenderInfo.externalPoses || [];
57385
57339
  var poses = getAbsolutePosesByState(moveable.state);
57386
57340
  var verticalSnapPoses = [];
@@ -57389,14 +57343,22 @@ var Snappable = {
57389
57343
  var horizontalGuidelines = [];
57390
57344
  var snapInfos = [];
57391
57345
 
57392
- var _f = getRect(poses),
57393
- width = _f.width,
57394
- height = _f.height,
57395
- top = _f.top,
57396
- left = _f.left,
57397
- bottom = _f.bottom,
57398
- right = _f.right;
57346
+ var _a = getRect(poses),
57347
+ width = _a.width,
57348
+ height = _a.height,
57349
+ top = _a.top,
57350
+ left = _a.left,
57351
+ bottom = _a.bottom,
57352
+ right = _a.right;
57399
57353
 
57354
+ var targetRect = {
57355
+ left: left,
57356
+ right: right,
57357
+ top: top,
57358
+ bottom: bottom,
57359
+ center: (left + right) / 2,
57360
+ middle: (top + bottom) / 2
57361
+ };
57400
57362
  var hasExternalPoses = externalPoses.length > 0;
57401
57363
  var externalRect = hasExternalPoses ? getRect(externalPoses) : {};
57402
57364
 
@@ -57413,7 +57375,7 @@ var Snappable = {
57413
57375
  rect.center = (rect.left + rect.right) / 2;
57414
57376
  }
57415
57377
 
57416
- snapInfos.push(checkSnaps(moveable, rect, true, 1));
57378
+ snapInfos.push(checkSnaps(moveable, rect, 1));
57417
57379
  }
57418
57380
 
57419
57381
  if (hasExternalPoses) {
@@ -57422,7 +57384,7 @@ var Snappable = {
57422
57384
  externalRect.center = (externalRect.left + externalRect.right) / 2;
57423
57385
  }
57424
57386
 
57425
- snapInfos.push(checkSnaps(moveable, externalRect, true, 1));
57387
+ snapInfos.push(checkSnaps(moveable, externalRect, 1));
57426
57388
  }
57427
57389
 
57428
57390
  snapInfos.forEach(function (snapInfo) {
@@ -57463,37 +57425,23 @@ var Snappable = {
57463
57425
  addBoundGuidelines(moveable, [externalRect.left, externalRect.right], [externalRect.top, externalRect.bottom], verticalSnapPoses, horizontalSnapPoses, snapRenderInfo.externalBounds);
57464
57426
  }
57465
57427
 
57466
- var gapHorizontalGuidelines = getGapGuidelines$1(verticalGuidelines, "vertical", [targetLeft, targetTop], [width, height]);
57467
- var gapVerticalGuidelines = getGapGuidelines$1(horizontalGuidelines, "horizontal", [targetLeft, targetTop], [width, height]);
57468
-
57469
57428
  var allGuidelines = __spreadArrays(verticalGuidelines, horizontalGuidelines);
57470
57429
 
57430
+ var elementGuidelines = allGuidelines.filter(function (guideline) {
57431
+ return guideline.element && !guideline.gapRects;
57432
+ });
57433
+ var gapGuidelines = allGuidelines.filter(function (guideline) {
57434
+ return guideline.gapRects;
57435
+ });
57471
57436
  triggerEvent(moveable, "onSnap", {
57472
57437
  guidelines: allGuidelines.filter(function (_a) {
57473
57438
  var element = _a.element;
57474
57439
  return !element;
57475
57440
  }),
57476
- elements: groupBy(allGuidelines.filter(function (_a) {
57477
- var element = _a.element;
57478
- return element;
57479
- }), function (_a) {
57480
- var element = _a.element;
57481
- return element;
57482
- }),
57483
- gaps: __spreadArrays(gapVerticalGuidelines, gapHorizontalGuidelines)
57441
+ elements: elementGuidelines,
57442
+ gaps: gapGuidelines
57484
57443
  }, true);
57485
-
57486
- var _g = filterElementInnerGuidelines(moveable, horizontalGuidelines, 0, [targetLeft, targetTop], [clientLeft, clientTop], [width, height]),
57487
- nextHorizontalGuidelines = _g.guidelines,
57488
- elementHorizontalGroups = _g.groups,
57489
- innerGapHorizontalGuidelines = _g.gapGuidelines;
57490
-
57491
- var _h = filterElementInnerGuidelines(moveable, verticalGuidelines, 1, [targetLeft, targetTop], [clientLeft, clientTop], [width, height]),
57492
- nextVerticalGuidelines = _h.guidelines,
57493
- elementVerticalGroups = _h.groups,
57494
- innerGapVerticalGuidelines = _h.gapGuidelines;
57495
-
57496
- return __spreadArrays(renderGapGuidelines(moveable, "vertical", __spreadArrays(gapVerticalGuidelines, innerGapVerticalGuidelines), snapDistFormat, React), renderGapGuidelines(moveable, "horizontal", __spreadArrays(gapHorizontalGuidelines, innerGapHorizontalGuidelines), snapDistFormat, React), renderElementGroups(moveable, "horizontal", elementHorizontalGroups, minLeft, clientLeft, width, targetTop, snapThreshold, snapDigit, 0, snapDistFormat, React), renderElementGroups(moveable, "vertical", elementVerticalGroups, minTop, clientTop, height, targetLeft, snapThreshold, snapDigit, 1, snapDistFormat, React), renderGuidelines(moveable, "horizontal", nextHorizontalGuidelines, [targetLeft, targetTop], React), renderGuidelines(moveable, "vertical", nextVerticalGuidelines, [targetLeft, targetTop], React), renderSnapPoses(moveable, "horizontal", horizontalSnapPoses, minLeft, targetTop, width, 0, React), renderSnapPoses(moveable, "vertical", verticalSnapPoses, minTop, targetLeft, height, 1, React));
57444
+ return __spreadArrays(renderDashedGuidelines(moveable, elementGuidelines, [minLeft, minTop], targetRect, React), renderGapGuidelines(moveable, gapGuidelines, [minLeft, minTop], targetRect, React), renderGuidelines(moveable, "horizontal", horizontalGuidelines, [targetLeft, targetTop], targetRect, React), renderGuidelines(moveable, "vertical", verticalGuidelines, [targetLeft, targetTop], targetRect, React), renderSnapPoses(moveable, "horizontal", horizontalSnapPoses, minLeft, targetTop, width, 0, React), renderSnapPoses(moveable, "vertical", verticalSnapPoses, minTop, targetLeft, height, 1, React));
57497
57445
  },
57498
57446
  dragStart: function (moveable, e) {
57499
57447
  moveable.state.snapRenderInfo = {
@@ -57505,7 +57453,6 @@ var Snappable = {
57505
57453
  },
57506
57454
  drag: function (moveable) {
57507
57455
  var state = moveable.state;
57508
- state.staticGuidelines = getElementGuidelines(moveable, false, state.staticGuidelines);
57509
57456
  state.guidelines = getTotalGuidelines(moveable);
57510
57457
  },
57511
57458
  pinchStart: function (moveable) {
@@ -57555,14 +57502,15 @@ var Snappable = {
57555
57502
  unset: function (moveable) {
57556
57503
  var state = moveable.state;
57557
57504
  state.enableSnap = false;
57558
- state.staticGuidelines = [];
57559
57505
  state.guidelines = [];
57560
57506
  state.snapRenderInfo = null;
57507
+ state.elementRects = [];
57561
57508
  }
57562
57509
  };
57563
57510
  /**
57564
57511
  * Whether or not target can be snapped to the guideline. (default: false)
57565
57512
  * @name Moveable.Snappable#snappable
57513
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57566
57514
  * @example
57567
57515
  * import Moveable from "moveable";
57568
57516
  *
@@ -57574,6 +57522,7 @@ var Snappable = {
57574
57522
  /**
57575
57523
  * A snap container that is the basis for snap, bounds, and innerBounds. (default: null = container)
57576
57524
  * @name Moveable.Snappable#snapContainer
57525
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57577
57526
  * @example
57578
57527
  * import Moveable from "moveable";
57579
57528
  *
@@ -57583,53 +57532,39 @@ var Snappable = {
57583
57532
  */
57584
57533
 
57585
57534
  /**
57586
- * When you drag, make the snap in the center of the target. (default: false)
57587
- * @name Moveable.Snappable#snapCenter
57535
+ * You can specify the directions to snap to the target. (default: { left: true, top: true, right: true, bottom: true })
57536
+ * @name Moveable.Snappable#snapDirections
57537
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57588
57538
  * @example
57589
57539
  * import Moveable from "moveable";
57590
57540
  *
57591
57541
  * const moveable = new Moveable(document.body, {
57592
57542
  * snappable: true,
57543
+ * snapDirections: true,
57593
57544
  * });
57594
- *
57595
- * moveable.snapCenter = true;
57545
+ * // snap center
57546
+ * moveable.snapDirections = { left: true, top: true, right: true, bottom: true, center: true, middle: true };
57596
57547
  */
57597
57548
 
57598
57549
  /**
57599
- * When you drag, make the snap in the vertical guidelines. (default: true)
57600
- * @name Moveable.Snappable#snapVertical
57550
+ * You can specify the snap directions of elements. (default: { left: true, top: true, right: true, bottom: true })
57551
+ * @name Moveable.Snappable#elementSnapDirections
57552
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57601
57553
  * @example
57602
57554
  * import Moveable from "moveable";
57603
57555
  *
57604
57556
  * const moveable = new Moveable(document.body, {
57605
57557
  * snappable: true,
57606
- * snapVertical: true,
57607
- * snapHorizontal: true,
57608
- * snapElement: true,
57558
+ * elementSnapDirections: true,
57609
57559
  * });
57610
- *
57611
- * moveable.snapVertical = false;
57612
- */
57613
-
57614
- /**
57615
- * When you drag, make the snap in the horizontal guidelines. (default: true)
57616
- * @name Moveable.Snappable#snapHorizontal
57617
- * @example
57618
- * import Moveable from "moveable";
57619
- *
57620
- * const moveable = new Moveable(document.body, {
57621
- * snappable: true,
57622
- * snapVertical: true,
57623
- * snapHorizontal: true,
57624
- * snapElement: true,
57625
- * });
57626
- *
57627
- * moveable.snapHorizontal = false;
57560
+ * // snap center
57561
+ * moveable.elementSnapDirections = { left: true, top: true, right: true, bottom: true, center: true, middle: true };
57628
57562
  */
57629
57563
 
57630
57564
  /**
57631
57565
  * When you drag, make the gap snap in the element guidelines. (default: true)
57632
57566
  * @name Moveable.Snappable#snapGap
57567
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57633
57568
  * @example
57634
57569
  * import Moveable from "moveable";
57635
57570
  *
@@ -57644,25 +57579,10 @@ var Snappable = {
57644
57579
  * moveable.snapGap = false;
57645
57580
  */
57646
57581
 
57647
- /**
57648
- * When you drag, make the snap in the element guidelines. (default: true)
57649
- * @name Moveable.Snappable#snapElement
57650
- * @example
57651
- * import Moveable from "moveable";
57652
- *
57653
- * const moveable = new Moveable(document.body, {
57654
- * snappable: true,
57655
- * snapVertical: true,
57656
- * snapHorizontal: true,
57657
- * snapElement: true,
57658
- * });
57659
- *
57660
- * moveable.snapElement = false;
57661
- */
57662
-
57663
57582
  /**
57664
57583
  * Distance value that can snap to guidelines. (default: 5)
57665
57584
  * @name Moveable.Snappable#snapThreshold
57585
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57666
57586
  * @example
57667
57587
  * import Moveable from "moveable";
57668
57588
  *
@@ -57674,6 +57594,7 @@ var Snappable = {
57674
57594
  /**
57675
57595
  * Add guidelines in the horizontal direction. (default: [])
57676
57596
  * @name Moveable.Snappable#horizontalGuidelines
57597
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57677
57598
  * @example
57678
57599
  * import Moveable from "moveable";
57679
57600
  *
@@ -57685,6 +57606,7 @@ var Snappable = {
57685
57606
  /**
57686
57607
  * Add guidelines in the vertical direction. (default: [])
57687
57608
  * @name Moveable.Snappable#verticalGuidelines
57609
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57688
57610
  * @example
57689
57611
  * import Moveable from "moveable";
57690
57612
  *
@@ -57696,6 +57618,7 @@ var Snappable = {
57696
57618
  /**
57697
57619
  * Add guidelines for the element. (default: [])
57698
57620
  * @name Moveable.Snappable#elementGuidelines
57621
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57699
57622
  * @example
57700
57623
  * import Moveable from "moveable";
57701
57624
  *
@@ -57709,6 +57632,7 @@ var Snappable = {
57709
57632
  /**
57710
57633
  * You can set up boundaries. (default: null)
57711
57634
  * @name Moveable.Snappable#bounds
57635
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57712
57636
  * @example
57713
57637
  * import Moveable from "moveable";
57714
57638
  *
@@ -57720,6 +57644,7 @@ var Snappable = {
57720
57644
  /**
57721
57645
  * You can set up inner boundaries. (default: null)
57722
57646
  * @name Moveable.Snappable#innerBounds
57647
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57723
57648
  * @example
57724
57649
  * import Moveable from "moveable";
57725
57650
  *
@@ -57731,6 +57656,7 @@ var Snappable = {
57731
57656
  /**
57732
57657
  * snap distance digits (default: 0)
57733
57658
  * @name Moveable.Snappable#snapDigit
57659
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57734
57660
  * @example
57735
57661
  * import Moveable from "moveable";
57736
57662
  *
@@ -57742,6 +57668,7 @@ var Snappable = {
57742
57668
  /**
57743
57669
  * If width size is greater than 0, you can vertical snap to the grid. (default: 0)
57744
57670
  * @name Moveable.Snappable#snapGridWidth
57671
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57745
57672
  * @example
57746
57673
  * import Moveable from "moveable";
57747
57674
  *
@@ -57753,6 +57680,7 @@ var Snappable = {
57753
57680
  /**
57754
57681
  * If height size is greater than 0, you can horizontal snap to the grid. (default: 0)
57755
57682
  * @name Moveable.Snappable#snapGridHeight
57683
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57756
57684
  * @example
57757
57685
  * import Moveable from "moveable";
57758
57686
  *
@@ -57764,6 +57692,7 @@ var Snappable = {
57764
57692
  /**
57765
57693
  * Whether to show snap distance (default: true)
57766
57694
  * @name Moveable.Snappable#isDisplaySnapDigit
57695
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57767
57696
  * @example
57768
57697
  * import Moveable from "moveable";
57769
57698
  *
@@ -57775,6 +57704,7 @@ var Snappable = {
57775
57704
  /**
57776
57705
  * Whether to show element inner snap distance (default: false)
57777
57706
  * @name Moveable.Snappable#isDisplayInnerSnapDigit
57707
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57778
57708
  * @example
57779
57709
  * import Moveable from "moveable";
57780
57710
  *
@@ -57786,6 +57716,7 @@ var Snappable = {
57786
57716
  /**
57787
57717
  * You can set the text format of the distance shown in the guidelines. (default: self)
57788
57718
  * @name Moveable.Snappable#snapDistFormat
57719
+ * @see {@link https://daybrush.com/moveable/release/latest/doc/Moveable.Snappable.html#.SnappableOptions}
57789
57720
  * @example
57790
57721
  * import Moveable from "moveable";
57791
57722
  *
@@ -57890,6 +57821,8 @@ var Draggable = {
57890
57821
  datas.prevDist = [0, 0];
57891
57822
  datas.prevBeforeDist = [0, 0];
57892
57823
  datas.isDrag = false;
57824
+ datas.deltaOffset = [0, 0];
57825
+ datas.distOffset = [0, 0];
57893
57826
  var params = fillParams(moveable, e, __assign({
57894
57827
  set: function (translate) {
57895
57828
  datas.startValue = translate;
@@ -57911,6 +57844,10 @@ var Draggable = {
57911
57844
  return datas.isDrag ? params : false;
57912
57845
  },
57913
57846
  drag: function (moveable, e) {
57847
+ if (!e) {
57848
+ return;
57849
+ }
57850
+
57914
57851
  resolveTransformEvent(e, "translate");
57915
57852
  var datas = e.datas,
57916
57853
  parentEvent = e.parentEvent,
@@ -57922,12 +57859,15 @@ var Draggable = {
57922
57859
  var isDrag = datas.isDrag,
57923
57860
  prevDist = datas.prevDist,
57924
57861
  prevBeforeDist = datas.prevBeforeDist,
57925
- startValue = datas.startValue;
57862
+ startValue = datas.startValue,
57863
+ distOffset = datas.distOffset;
57926
57864
 
57927
57865
  if (!isDrag) {
57928
57866
  return;
57929
57867
  }
57930
57868
 
57869
+ distX += distOffset[0];
57870
+ distY += distOffset[1];
57931
57871
  var props = moveable.props;
57932
57872
  var parentMoveable = props.parentMoveable;
57933
57873
  var throttleDrag = parentEvent ? 0 : props.throttleDrag || 0;
@@ -57947,7 +57887,7 @@ var Draggable = {
57947
57887
  }
57948
57888
 
57949
57889
  if (!isPinch && !parentEvent && !parentFlag && (!throttleDragRotate || distX || distY)) {
57950
- var _a = checkSnapDrag(moveable, distX, distY, throttleDragRotate, isRequest, datas),
57890
+ var _a = checkSnapBoundsDrag(moveable, distX, distY, throttleDragRotate, isRequest, datas),
57951
57891
  verticalInfo = _a[0],
57952
57892
  horizontalInfo = _a[1];
57953
57893
 
@@ -57962,10 +57902,6 @@ var Draggable = {
57962
57902
  distY += horizontalOffset;
57963
57903
  }
57964
57904
 
57965
- datas.passDeltaX = distX - (datas.passDistX || 0);
57966
- datas.passDeltaY = distY - (datas.passDistY || 0);
57967
- datas.passDistX = distX;
57968
- datas.passDistY = distY;
57969
57905
  var beforeTranslate = (0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.plus)(getBeforeDragDist({
57970
57906
  datas: datas,
57971
57907
  distX: distX,
@@ -57988,6 +57924,12 @@ var Draggable = {
57988
57924
  var beforeDelta = (0,_scena_matrix__WEBPACK_IMPORTED_MODULE_3__.minus)(beforeDist, prevBeforeDist);
57989
57925
  datas.prevDist = dist;
57990
57926
  datas.prevBeforeDist = beforeDist;
57927
+ datas.passDelta = delta; //distX - (datas.passDistX || 0);
57928
+ // datas.passDeltaY = distY - (datas.passDistY || 0);
57929
+
57930
+ datas.passDist = dist; //distX;
57931
+ // datas.passDistY = distY;
57932
+
57991
57933
  var left = datas.left + beforeDist[0];
57992
57934
  var top = datas.top + beforeDist[1];
57993
57935
  var right = datas.right - beforeDist[0];
@@ -58025,6 +57967,21 @@ var Draggable = {
58025
57967
  !parentEvent && triggerEvent(moveable, "onDrag", params);
58026
57968
  return params;
58027
57969
  },
57970
+ dragAfter: function (moveable, e) {
57971
+ var datas = e.datas;
57972
+ var _a = e.datas,
57973
+ deltaOffset = _a.deltaOffset,
57974
+ distOffset = _a.distOffset;
57975
+
57976
+ if (deltaOffset[0] || deltaOffset[1]) {
57977
+ datas.deltaOffset = [0, 0];
57978
+ distOffset[0] += deltaOffset[0];
57979
+ distOffset[1] += deltaOffset[1];
57980
+ return this.drag(moveable, e);
57981
+ }
57982
+
57983
+ return false;
57984
+ },
58028
57985
  dragEnd: function (moveable, e) {
58029
57986
  var parentEvent = e.parentEvent,
58030
57987
  datas = e.datas,
@@ -58069,10 +58026,8 @@ var Draggable = {
58069
58026
  }
58070
58027
 
58071
58028
  var params = this.drag(moveable, e);
58072
- var _a = e.datas,
58073
- passDeltaX = _a.passDeltaX,
58074
- passDeltaY = _a.passDeltaY;
58075
- var events = triggerChildGesto(moveable, this, "drag", [passDeltaX, passDeltaY], e, false);
58029
+ var passDelta = e.datas.passDelta;
58030
+ var events = triggerChildGesto(moveable, this, "drag", passDelta, e, false);
58076
58031
 
58077
58032
  if (!params) {
58078
58033
  return;
@@ -60628,9 +60583,14 @@ var Warpable = {
60628
60583
  selectedPoses.push([(selectedPoses[0][0] + selectedPoses[1][0]) / 2, (selectedPoses[0][1] + selectedPoses[1][1]) / 2]);
60629
60584
  }
60630
60585
 
60631
- var _a = checkMoveableSnapBounds(moveable, isRequest, selectedPoses.map(function (pos) {
60632
- return [pos[0] + distX, pos[1] + distY];
60633
- })),
60586
+ var _a = checkMoveableSnapBounds(moveable, isRequest, {
60587
+ horizontal: selectedPoses.map(function (pos) {
60588
+ return pos[1] + distY;
60589
+ }),
60590
+ vertical: selectedPoses.map(function (pos) {
60591
+ return pos[0] + distX;
60592
+ })
60593
+ }),
60634
60594
  horizontalSnapInfo = _a.horizontal,
60635
60595
  verticalSnapInfo = _a.vertical;
60636
60596
 
@@ -61249,6 +61209,7 @@ var Default = {
61249
61209
  checkInput: Boolean,
61250
61210
  cspNonce: String,
61251
61211
  translateZ: Number,
61212
+ hideDefaultLines: Boolean,
61252
61213
  props: Object
61253
61214
  },
61254
61215
  events: {}
@@ -62342,21 +62303,29 @@ var Clippable = {
62342
62303
  });
62343
62304
  }
62344
62305
 
62306
+ var boundDelta = [0, 0];
62307
+
62345
62308
  var _loop_1 = function (i) {
62346
62309
  var _a = checkSnapBounds(guidelines, props.clipTargetBounds && {
62347
62310
  left: 0,
62348
62311
  top: 0,
62349
62312
  right: width,
62350
62313
  bottom: height
62351
- }, guideXPoses, guideYPoses, {
62352
- snapThreshold: 5
62353
- }),
62314
+ }, guideXPoses, guideYPoses, 5),
62354
62315
  horizontalSnapInfo = _a.horizontal,
62355
62316
  verticalSnapInfo = _a.vertical;
62356
62317
 
62357
62318
  var snapOffsetY = horizontalSnapInfo.offset;
62358
62319
  var snapOffsetX = verticalSnapInfo.offset;
62359
62320
 
62321
+ if (horizontalSnapInfo.isBound) {
62322
+ boundDelta[1] += snapOffsetY;
62323
+ }
62324
+
62325
+ if (verticalSnapInfo.isBound) {
62326
+ boundDelta[0] += snapOffsetX;
62327
+ }
62328
+
62360
62329
  if ((isEllipse || isCircle) && dists[0][0] === 0 && dists[0][1] === 0) {
62361
62330
  var guideRect = getRect(nextPoses);
62362
62331
  var cy = guideRect.bottom - guideRect.top;
@@ -62427,9 +62396,12 @@ var Clippable = {
62427
62396
  top: 0,
62428
62397
  right: width,
62429
62398
  bottom: height
62430
- }, guideXPoses, guideYPoses, {
62431
- snapThreshold: 1
62432
- });
62399
+ }, guideXPoses, guideYPoses, 1);
62400
+
62401
+ if (originalDatas.draggable) {
62402
+ originalDatas.draggable.deltaOffset = boundDelta;
62403
+ }
62404
+
62433
62405
  triggerEvent(moveable, "onClip", fillParams(moveable, e, {
62434
62406
  clipEventType: "changed",
62435
62407
  clipType: clipType,
@@ -63813,7 +63785,7 @@ function triggerAble(moveable, ableType, eventOperation, eventAffix, eventType,
63813
63785
  } // const isGroup = eventAffix.indexOf("Group") > -1;
63814
63786
 
63815
63787
 
63816
- var ables = __spreadArrays([BeforeRenderable], moveable[ableType].slice(), [Renderable]);
63788
+ var ables = __spreadArrays([BeforeRenderable], moveable[ableType], [Renderable]);
63817
63789
 
63818
63790
  if (isRequest) {
63819
63791
  var requestAble_1 = e.requestAble;
@@ -64010,7 +63982,6 @@ function (_super) {
64010
63982
 
64011
63983
  _this.state = __assign({
64012
63984
  container: null,
64013
- target: null,
64014
63985
  gesto: null,
64015
63986
  renderPoses: [[0, 0], [0, 0], [0, 0], [0, 0]],
64016
63987
  disableNativeEvent: false
@@ -64039,8 +64010,7 @@ function (_super) {
64039
64010
  __proto.render = function () {
64040
64011
  var props = this.props;
64041
64012
  var state = this.state;
64042
- var edge = props.edge,
64043
- parentPosition = props.parentPosition,
64013
+ var parentPosition = props.parentPosition,
64044
64014
  className = props.className,
64045
64015
  propsTarget = props.target,
64046
64016
  zoom = props.zoom,
@@ -64061,15 +64031,11 @@ function (_super) {
64061
64031
  var left = state.left,
64062
64032
  top = state.top,
64063
64033
  stateTarget = state.target,
64064
- direction = state.direction,
64065
- renderPoses = state.renderPoses;
64034
+ direction = state.direction;
64066
64035
  var groupTargets = props.targets;
64067
64036
  var isDisplay = (groupTargets && groupTargets.length || propsTarget) && stateTarget;
64068
64037
  var isDragging = this.isDragging();
64069
64038
  var ableAttributes = {};
64070
- var Renderer = {
64071
- createElement: react_simple_compat__WEBPACK_IMPORTED_MODULE_9__.createElement
64072
- };
64073
64039
  this.getEnabledAbles().forEach(function (able) {
64074
64040
  ableAttributes["data-able-" + able.name.toLowerCase()] = true;
64075
64041
  });
@@ -64087,7 +64053,7 @@ function (_super) {
64087
64053
  "--zoom": zoom,
64088
64054
  "--zoompx": zoom + "px"
64089
64055
  }
64090
- }), this.renderAbles(), renderLine(Renderer, edge ? "n" : "", renderPoses[0], renderPoses[1], zoom, 0), renderLine(Renderer, edge ? "e" : "", renderPoses[1], renderPoses[3], zoom, 1), renderLine(Renderer, edge ? "w" : "", renderPoses[0], renderPoses[2], zoom, 2), renderLine(Renderer, edge ? "s" : "", renderPoses[2], renderPoses[3], zoom, 3));
64056
+ }), this.renderAbles(), this._renderLines());
64091
64057
  };
64092
64058
 
64093
64059
  __proto.componentDidMount = function () {
@@ -64749,6 +64715,23 @@ function (_super) {
64749
64715
  this.targetGesto && (this.targetGesto.options.checkInput = this.props.checkInput);
64750
64716
  };
64751
64717
 
64718
+ __proto._renderLines = function () {
64719
+ var props = this.props;
64720
+ var edge = props.edge,
64721
+ zoom = props.zoom,
64722
+ hideDefaultLines = props.hideDefaultLines;
64723
+
64724
+ if (hideDefaultLines) {
64725
+ return [];
64726
+ }
64727
+
64728
+ var renderPoses = this.state.renderPoses;
64729
+ var Renderer = {
64730
+ createElement: react_simple_compat__WEBPACK_IMPORTED_MODULE_9__.createElement
64731
+ };
64732
+ return [renderLine(Renderer, edge ? "n" : "", renderPoses[0], renderPoses[1], zoom, 0), renderLine(Renderer, edge ? "e" : "", renderPoses[1], renderPoses[3], zoom, 1), renderLine(Renderer, edge ? "w" : "", renderPoses[0], renderPoses[2], zoom, 2), renderLine(Renderer, edge ? "s" : "", renderPoses[2], renderPoses[3], zoom, 3)];
64733
+ };
64734
+
64752
64735
  MoveableManager.defaultProps = {
64753
64736
  target: null,
64754
64737
  dragTarget: null,
@@ -64772,6 +64755,7 @@ function (_super) {
64772
64755
  pinchOutside: true,
64773
64756
  checkInput: false,
64774
64757
  groupable: false,
64758
+ hideDefaultLines: false,
64775
64759
  cspNonce: "",
64776
64760
  translateZ: 0,
64777
64761
  cssStyled: null,
@@ -64988,6 +64972,10 @@ var Clickable = makeAble("clickable", {
64988
64972
  var inputEvent = e.inputEvent;
64989
64973
  var inputTarget = e.inputTarget;
64990
64974
 
64975
+ if (!e.isDrag) {
64976
+ this.unset(moveable);
64977
+ }
64978
+
64991
64979
  if (!inputEvent || !inputTarget || e.isDrag || moveable.isMoveableElement(inputTarget) // External event duplicate target or dragAreaElement
64992
64980
  ) {
64993
64981
  return;
@@ -65722,7 +65710,7 @@ name: react-simple-compat
65722
65710
  license: MIT
65723
65711
  author: Daybrush
65724
65712
  repository: git+https://github.com/daybrush/react-simple-compat.git
65725
- version: 1.2.1
65713
+ version: 1.2.2
65726
65714
  */
65727
65715
 
65728
65716
 
@@ -66386,11 +66374,12 @@ function (_super) {
66386
66374
  };
66387
66375
 
66388
66376
  __proto._setState = function (nextState) {
66389
- if (!nextState) {
66377
+ var base = this.base;
66378
+
66379
+ if (!base || !nextState) {
66390
66380
  return;
66391
66381
  }
66392
66382
 
66393
- var base = this.base;
66394
66383
  base.state = nextState;
66395
66384
  };
66396
66385
 
@@ -68199,11 +68188,10 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
68199
68188
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
68200
68189
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
68201
68190
  };
68202
- var _Button_instances, _a, _Button_procMasume4txt, _Button_procMasume4pic, _Button_idc, _Button_sp_b_pic, _Button_sp_pic, _Button_loaded_b_pic, _Button_loaded_pic;
68191
+ var _Button_instances, _a, _Button_procMasume4txt, _Button_procMasume4pic, _Button_rctBtnTxt, _Button_idc, _Button_sp_b_pic, _Button_sp_pic, _Button_loaded_b_pic, _Button_normal, _Button_hover, _Button_clicked, _Button_loaded_pic;
68203
68192
  Object.defineProperty(exports, "__esModule", ({ value: true }));
68204
68193
  exports.Button = void 0;
68205
68194
  const pixi_js_1 = __webpack_require__(/*! pixi.js */ "./node_modules/pixi.js/dist/esm/pixi.js");
68206
- const pixi_js_2 = __webpack_require__(/*! pixi.js */ "./node_modules/pixi.js/dist/esm/pixi.js");
68207
68195
  const CmnLib_1 = __webpack_require__(/*! ./CmnLib */ "./core/src/sn/CmnLib.ts");
68208
68196
  const GrpLayer_1 = __webpack_require__(/*! ./GrpLayer */ "./core/src/sn/GrpLayer.ts");
68209
68197
  const Layer_1 = __webpack_require__(/*! ./Layer */ "./core/src/sn/Layer.ts");
@@ -68216,14 +68204,18 @@ class Button extends pixi_js_1.Container {
68216
68204
  this.resolve = resolve;
68217
68205
  this.canFocus = canFocus;
68218
68206
  _Button_instances.add(this);
68207
+ this.getBtnBounds = () => __classPrivateFieldGet(this, _Button_rctBtnTxt, "f");
68208
+ _Button_rctBtnTxt.set(this, new pixi_js_1.Rectangle);
68219
68209
  _Button_idc.set(this, void 0);
68220
68210
  _Button_sp_b_pic.set(this, null);
68221
68211
  _Button_sp_pic.set(this, null);
68212
+ _Button_normal.set(this, () => { });
68213
+ _Button_hover.set(this, () => false);
68214
+ _Button_clicked.set(this, () => { });
68222
68215
  if (CmnLib_1.CmnLib.isDbg) {
68223
68216
  this.makeDesignCast = gdc => gdc(__classPrivateFieldGet(this, _Button_idc, "f"));
68224
68217
  this.cvsResize = () => __classPrivateFieldGet(this, _Button_idc, "f").cvsResize();
68225
68218
  }
68226
- this.name = JSON.stringify(hArg);
68227
68219
  let oName = {
68228
68220
  x: this.x = (0, CmnLib_1.uint)(hArg.left ?? 0),
68229
68221
  y: this.y = (0, CmnLib_1.uint)(hArg.top ?? 0),
@@ -68232,125 +68224,142 @@ class Button extends pixi_js_1.Container {
68232
68224
  pivot_y: this.pivot.y = (0, CmnLib_1.argChk_Num)(hArg, 'pivot_y', this.pivot.y),
68233
68225
  scale_x: this.scale.x = (0, CmnLib_1.argChk_Num)(hArg, 'scale_x', this.scale.x),
68234
68226
  scale_y: this.scale.y = (0, CmnLib_1.argChk_Num)(hArg, 'scale_y', this.scale.y),
68227
+ width: 0, height: 0,
68235
68228
  };
68236
68229
  const enabled = oName.enabled = (0, CmnLib_1.argChk_Boolean)(hArg, 'enabled', true);
68237
- if ('text' in hArg) {
68238
- const height = (0, CmnLib_1.argChk_Num)(hArg, 'height', 30);
68239
- const style = new pixi_js_1.TextStyle({
68240
- align: 'center',
68241
- dropShadow: true,
68242
- dropShadowAlpha: 0.7,
68243
- dropShadowColor: '#ffffff',
68244
- dropShadowBlur: 7,
68245
- dropShadowDistance: 0,
68246
- fill: 'black',
68247
- fontFamily: Button.fontFamily,
68248
- fontSize: height,
68249
- padding: 5,
68250
- });
68251
- if (hArg.style)
68252
- try {
68253
- const o = JSON.parse(hArg.style);
68254
- for (const nm in o)
68255
- style[nm] = o[nm];
68256
- }
68257
- catch (e) {
68258
- throw new Error(`[button] style指定が異常です。JSON文字列は「"」で囲んで下さい err:${e}`);
68259
- }
68260
- const txt = new pixi_js_1.Text(hArg.text ?? '', style);
68261
- txt.alpha = (0, CmnLib_1.argChk_Num)(hArg, 'alpha', txt.alpha);
68262
- txt.width = (0, CmnLib_1.argChk_Num)(hArg, 'width', 100);
68263
- txt.height = height;
68264
- hArg.height = height;
68265
- oName.type = 'text';
68266
- oName = { ...oName, ...style };
68267
- oName.alpha = txt.alpha;
68268
- oName.text = txt.text;
68269
- oName.width = txt.width;
68270
- oName.height = txt.height;
68271
- __classPrivateFieldSet(this, _Button_idc, new DesignCast_1.TxtBtnDesignCast(this, hArg, txt), "f");
68272
- let isStop = false;
68273
- if (hArg.b_pic) {
68274
- oName.b_pic = hArg.b_pic;
68275
- isStop = GrpLayer_1.GrpLayer.csv2Sprites(hArg.b_pic, this, sp => __classPrivateFieldGet(this, _Button_instances, "m", _Button_loaded_b_pic).call(this, sp, txt), isStop => {
68276
- Layer_1.Layer.setBlendmode(this, hArg);
68277
- if (isStop)
68278
- resolve();
68279
- });
68230
+ this.getBtnBounds = () => {
68231
+ __classPrivateFieldGet(this, _Button_rctBtnTxt, "f").x = oName.x;
68232
+ __classPrivateFieldGet(this, _Button_rctBtnTxt, "f").y = oName.y;
68233
+ return __classPrivateFieldGet(this, _Button_rctBtnTxt, "f");
68234
+ };
68235
+ if (hArg.pic) {
68236
+ oName.type = 'pic';
68237
+ __classPrivateFieldSet(this, _Button_idc, new DesignCast_1.PicBtnDesignCast(this, hArg), "f");
68238
+ if (enabled)
68239
+ this.evtMng.button(this.hArg, this, () => __classPrivateFieldGet(this, _Button_normal, "f").call(this), () => __classPrivateFieldGet(this, _Button_hover, "f").call(this), () => __classPrivateFieldGet(this, _Button_clicked, "f").call(this));
68240
+ if (!GrpLayer_1.GrpLayer.csv2Sprites(hArg.pic, this, sp => {
68241
+ __classPrivateFieldGet(this, _Button_instances, "m", _Button_loaded_pic).call(this, sp, oName);
68242
+ __classPrivateFieldGet(this, _Button_rctBtnTxt, "f").width = sp.width * oName.scale_x;
68243
+ __classPrivateFieldGet(this, _Button_rctBtnTxt, "f").height = sp.height * oName.scale_y;
68244
+ }, isStop => { if (isStop)
68245
+ resolve(); }))
68246
+ resolve();
68247
+ return;
68248
+ }
68249
+ if (!hArg.text)
68250
+ throw 'textまたはpic属性は必須です';
68251
+ const height = (0, CmnLib_1.argChk_Num)(hArg, 'height', 30);
68252
+ const style = new pixi_js_1.TextStyle({
68253
+ align: 'center',
68254
+ dropShadow: true,
68255
+ dropShadowAlpha: 0.7,
68256
+ dropShadowColor: '#ffffff',
68257
+ dropShadowBlur: 7,
68258
+ dropShadowDistance: 0,
68259
+ fill: 'black',
68260
+ fontFamily: Button.fontFamily,
68261
+ fontSize: height,
68262
+ padding: 5,
68263
+ });
68264
+ if (hArg.style)
68265
+ try {
68266
+ const o = JSON.parse(hArg.style);
68267
+ for (const nm in o)
68268
+ style[nm] = o[nm];
68280
68269
  }
68281
- txt.name = JSON.stringify(oName);
68282
- this.addChild(txt);
68283
- if (!hArg.b_pic)
68270
+ catch (e) {
68271
+ throw new Error(`[button] style指定が異常です。JSON文字列は「"」で囲んで下さい err:${e}`);
68272
+ }
68273
+ const txt = new pixi_js_1.Text(hArg.text ?? '', style);
68274
+ txt.alpha = (0, CmnLib_1.argChk_Num)(hArg, 'alpha', txt.alpha);
68275
+ txt.width = (0, CmnLib_1.argChk_Num)(hArg, 'width', 100);
68276
+ txt.height = hArg.height = height;
68277
+ this.setText = text => txt.text = text;
68278
+ oName.type = 'text';
68279
+ oName = { ...oName, ...style };
68280
+ oName.alpha = txt.alpha;
68281
+ oName.text = txt.text;
68282
+ oName.width = txt.width;
68283
+ oName.height = txt.height;
68284
+ __classPrivateFieldSet(this, _Button_idc, new DesignCast_1.TxtBtnDesignCast(this, hArg, txt), "f");
68285
+ let isStop = false;
68286
+ if (hArg.b_pic) {
68287
+ oName.b_pic = hArg.b_pic;
68288
+ isStop = GrpLayer_1.GrpLayer.csv2Sprites(hArg.b_pic, this, sp => {
68289
+ __classPrivateFieldGet(this, _Button_instances, "m", _Button_loaded_b_pic).call(this, sp, txt);
68290
+ oName.width = this.width;
68291
+ oName.height = this.height;
68292
+ }, isStop => {
68284
68293
  Layer_1.Layer.setBlendmode(this, hArg);
68285
- __classPrivateFieldGet(Button, _a, "f", _Button_procMasume4txt).call(Button, this, txt);
68286
- if (!enabled) {
68287
- if (!isStop)
68294
+ if (isStop)
68288
68295
  resolve();
68289
- return;
68290
- }
68291
- const style_hover = style.clone();
68292
- if (hArg.style_hover)
68293
- try {
68294
- const o = JSON.parse(hArg.style_hover);
68295
- for (const nm in o)
68296
- style_hover[nm] = o[nm];
68297
- }
68298
- catch (e) {
68299
- throw new Error(`[button] style_hover指定が異常です。JSON文字列は「"」で囲んで下さい err:${e}`);
68300
- }
68301
- else
68302
- style_hover.fill = 'white';
68303
- const style_clicked = style_hover.clone();
68304
- if (hArg.style_clicked)
68305
- try {
68306
- const o = JSON.parse(hArg.style_clicked);
68307
- for (const nm in o)
68308
- style_clicked[nm] = o[nm];
68309
- }
68310
- catch (e) {
68311
- throw new Error(`[button] style_clicked指定が異常です。JSON文字列は「"」で囲んで下さい err:${e}`);
68312
- }
68313
- else
68314
- style_clicked.dropShadow = false;
68315
- evtMng.button(hArg, this, () => txt.style = style, () => {
68316
- if (!canFocus())
68317
- return false;
68318
- txt.style = style_hover;
68319
- return true;
68320
- }, () => txt.style = style_clicked);
68296
+ });
68297
+ }
68298
+ txt.name = JSON.stringify(oName);
68299
+ this.addChild(txt);
68300
+ __classPrivateFieldGet(this, _Button_rctBtnTxt, "f").width = txt.width;
68301
+ __classPrivateFieldGet(this, _Button_rctBtnTxt, "f").height = txt.height;
68302
+ oName.width = this.width;
68303
+ oName.height = this.height;
68304
+ if (!hArg.b_pic)
68305
+ Layer_1.Layer.setBlendmode(this, hArg);
68306
+ __classPrivateFieldGet(Button, _a, "f", _Button_procMasume4txt).call(Button, this, txt);
68307
+ if (!enabled) {
68321
68308
  if (!isStop)
68322
68309
  resolve();
68323
68310
  return;
68324
68311
  }
68325
- if (!hArg.pic)
68326
- throw 'textまたはpic属性は必須です';
68327
- oName.type = 'pic';
68328
- __classPrivateFieldSet(this, _Button_idc, new DesignCast_1.PicBtnDesignCast(this, hArg), "f");
68329
- if (!GrpLayer_1.GrpLayer.csv2Sprites(hArg.pic, this, sp => __classPrivateFieldGet(this, _Button_instances, "m", _Button_loaded_pic).call(this, sp, oName), isStop => { if (isStop)
68330
- resolve(); }))
68312
+ const style_hover = style.clone();
68313
+ if (hArg.style_hover)
68314
+ try {
68315
+ const o = JSON.parse(hArg.style_hover);
68316
+ for (const nm in o)
68317
+ style_hover[nm] = o[nm];
68318
+ }
68319
+ catch (e) {
68320
+ throw new Error(`[button] style_hover指定が異常です。JSON文字列は「"」で囲んで下さい err:${e}`);
68321
+ }
68322
+ else
68323
+ style_hover.fill = 'white';
68324
+ const style_clicked = style_hover.clone();
68325
+ if (hArg.style_clicked)
68326
+ try {
68327
+ const o = JSON.parse(hArg.style_clicked);
68328
+ for (const nm in o)
68329
+ style_clicked[nm] = o[nm];
68330
+ }
68331
+ catch (e) {
68332
+ throw new Error(`[button] style_clicked指定が異常です。JSON文字列は「"」で囲んで下さい err:${e}`);
68333
+ }
68334
+ else
68335
+ style_clicked.dropShadow = false;
68336
+ evtMng.button(hArg, this, () => txt.style = style, () => {
68337
+ if (!canFocus())
68338
+ return false;
68339
+ txt.style = style_hover;
68340
+ return true;
68341
+ }, () => txt.style = style_clicked);
68342
+ if (!isStop)
68331
68343
  resolve();
68332
68344
  }
68333
68345
  static init(cfg) {
68334
68346
  if (!cfg.oCfg.debug.masume)
68335
68347
  return;
68336
- __classPrivateFieldSet(Button, _a, (me, txt) => {
68337
- const grpDbgMasume = new pixi_js_2.Graphics;
68338
- grpDbgMasume.clear();
68339
- grpDbgMasume.beginFill(0x883388, 0.2);
68340
- grpDbgMasume.lineStyle(1, 0x883388, 1);
68341
- grpDbgMasume.drawRect(txt.x, txt.y, txt.width, txt.height);
68342
- grpDbgMasume.endFill();
68343
- me.addChild(grpDbgMasume);
68344
- }, "f", _Button_procMasume4txt);
68345
- __classPrivateFieldSet(Button, _a, (me, sp, w3, h) => {
68346
- const grpDbgMasume = new pixi_js_2.Graphics;
68347
- grpDbgMasume.clear();
68348
- grpDbgMasume.beginFill(0x883388, 0.2);
68349
- grpDbgMasume.lineStyle(1, 0x883388, 1);
68350
- grpDbgMasume.drawRect(sp.x, sp.y, w3, h);
68351
- grpDbgMasume.endFill();
68352
- me.addChild(grpDbgMasume);
68353
- }, "f", _Button_procMasume4pic);
68348
+ __classPrivateFieldSet(Button, _a, (me, txt) => me.addChild((new pixi_js_1.Graphics)
68349
+ .beginFill(0x883388, 0.2)
68350
+ .lineStyle(1, 0x883388, 1)
68351
+ .drawRect(txt.x, txt.y, txt.width, txt.height)
68352
+ .endFill()), "f", _Button_procMasume4txt);
68353
+ __classPrivateFieldSet(Button, _a, (me, sp, w3, h) => me.addChild((new pixi_js_1.Graphics)
68354
+ .beginFill(0x883388, 0.2)
68355
+ .lineStyle(1, 0x883388, 1)
68356
+ .drawRect(sp.x, sp.y, w3, h)
68357
+ .endFill()), "f", _Button_procMasume4pic);
68358
+ }
68359
+ setText(_text) { }
68360
+ destroy(_options) {
68361
+ this.evtMng.unButton(this);
68362
+ super.destroy();
68354
68363
  }
68355
68364
  makeDesignCast(_gdc) { }
68356
68365
  showDesignCast() { __classPrivateFieldGet(this, _Button_idc, "f").visible = true; }
@@ -68377,11 +68386,12 @@ class Button extends pixi_js_1.Container {
68377
68386
  }
68378
68387
  }
68379
68388
  exports.Button = Button;
68380
- _a = Button, _Button_idc = new WeakMap(), _Button_sp_b_pic = new WeakMap(), _Button_sp_pic = new WeakMap(), _Button_instances = new WeakSet(), _Button_loaded_b_pic = function _Button_loaded_b_pic(sp, txt) {
68389
+ _a = Button, _Button_rctBtnTxt = new WeakMap(), _Button_idc = new WeakMap(), _Button_sp_b_pic = new WeakMap(), _Button_sp_pic = new WeakMap(), _Button_normal = new WeakMap(), _Button_hover = new WeakMap(), _Button_clicked = new WeakMap(), _Button_instances = new WeakSet(), _Button_loaded_b_pic = function _Button_loaded_b_pic(sp, txt) {
68381
68390
  __classPrivateFieldSet(this, _Button_sp_b_pic, sp, "f");
68382
68391
  this.setChildIndex(sp, 0);
68383
68392
  sp.alpha = txt.alpha;
68384
68393
  sp.setTransform(txt.x, txt.y, 1, 1, txt.rotation, 0, 0, (sp.width - txt.width) / 2, (sp.height - txt.height) / 2);
68394
+ sp.name = txt.name;
68385
68395
  }, _Button_loaded_pic = function _Button_loaded_pic(sp, oName) {
68386
68396
  __classPrivateFieldSet(this, _Button_sp_pic, sp, "f");
68387
68397
  oName.alpha = sp.alpha = (0, CmnLib_1.argChk_Num)(this.hArg, 'alpha', sp.alpha);
@@ -68394,13 +68404,14 @@ _a = Button, _Button_idc = new WeakMap(), _Button_sp_b_pic = new WeakMap(), _But
68394
68404
  const txHover = new pixi_js_1.Texture(tx, new pixi_js_1.Rectangle(w3 * 2, 0, w3, h));
68395
68405
  const normal = () => sp.texture = txNormal;
68396
68406
  normal();
68397
- if (oName.enabled)
68398
- this.evtMng.button(this.hArg, this, normal, () => {
68399
- if (!this.canFocus())
68400
- return false;
68401
- sp.texture = txHover;
68402
- return true;
68403
- }, () => sp.texture = txClicked);
68407
+ __classPrivateFieldSet(this, _Button_normal, normal, "f");
68408
+ __classPrivateFieldSet(this, _Button_hover, () => {
68409
+ if (!this.canFocus())
68410
+ return false;
68411
+ sp.texture = txHover;
68412
+ return true;
68413
+ }, "f");
68414
+ __classPrivateFieldSet(this, _Button_clicked, () => sp.texture = txClicked, "f");
68404
68415
  if ('width' in this.hArg) {
68405
68416
  oName.width = (0, CmnLib_1.uint)(this.hArg.width);
68406
68417
  this.scale.x *= oName.width / w3;
@@ -69812,7 +69823,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
69812
69823
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
69813
69824
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
69814
69825
  };
69815
- var _EventMng_instances, _EventMng_elc, _EventMng_hint, _EventMng_zxHint, _EventMng_zyHint, _EventMng_gamepad, _EventMng_fcs, _EventMng_resvFlameEvent4Wheel, _EventMng_ev_keydown, _EventMng_ev_contextmenu, _EventMng_ev_wheel, _EventMng_wheeling, _EventMng_extend_wheel, _EventMng_ev_wheel_waitstop, _EventMng_hLocalEvt2Fnc, _EventMng_hGlobalEvt2Fnc, _EventMng_isDbgBreak, _EventMng_isWait, _EventMng_getEvt2Fnc, _EventMng_waitEventBase, _EventMng_firstWait, _EventMng_dispHint, _EventMng_procWheel4wle, _EventMng_elcWLE, _EventMng_clear_event, _EventMng_clear_eventer, _EventMng_event, _EventMng_canFocus, _EventMng_getHtmlElmList, _EventMng_goTxt, _EventMng_l, _EventMng_p, _EventMng_fncCancelSkip, _EventMng_set_cancel_skip, _EventMng_unregisterClickEvts, _EventMng_wait, _EventMng_waitclick, _EventMng_hDownKeys;
69826
+ var _EventMng_instances, _EventMng_elc, _EventMng_cvsHint, _EventMng_picHint_w, _EventMng_picHint_h, _EventMng_padHint, _EventMng_grpHint, _EventMng_gamepad, _EventMng_fcs, _EventMng_resvFlameEvent4Wheel, _EventMng_ev_keydown, _EventMng_ev_contextmenu, _EventMng_ev_wheel, _EventMng_wheeling, _EventMng_extend_wheel, _EventMng_ev_wheel_waitstop, _EventMng_hLocalEvt2Fnc, _EventMng_hGlobalEvt2Fnc, _EventMng_isDbgBreak, _EventMng_isWait, _EventMng_getEvt2Fnc, _EventMng_waitEventBase, _EventMng_firstWait, _EventMng_dispHint, _EventMng_dispHint_masume, _EventMng_procWheel4wle, _EventMng_elcWLE, _EventMng_clear_event, _EventMng_clear_eventer, _EventMng_event, _EventMng_canFocus, _EventMng_getHtmlElmList, _EventMng_goTxt, _EventMng_l, _EventMng_p, _EventMng_fncCancelSkip, _EventMng_set_cancel_skip, _EventMng_unregisterClickEvts, _EventMng_wait, _EventMng_waitclick, _EventMng_hDownKeys;
69816
69827
  Object.defineProperty(exports, "__esModule", ({ value: true }));
69817
69828
  exports.EventMng = void 0;
69818
69829
  const CmnLib_1 = __webpack_require__(/*! ./CmnLib */ "./core/src/sn/CmnLib.ts");
@@ -69823,6 +69834,7 @@ const FocusMng_1 = __webpack_require__(/*! ./FocusMng */ "./core/src/sn/FocusMng
69823
69834
  const tween_js_1 = __webpack_require__(/*! @tweenjs/tween.js */ "./node_modules/@tweenjs/tween.js/dist/tween.esm.js");
69824
69835
  const pixi_js_1 = __webpack_require__(/*! pixi.js */ "./node_modules/pixi.js/dist/esm/pixi.js");
69825
69836
  const Config_1 = __webpack_require__(/*! ./Config */ "./core/src/sn/Config.ts");
69837
+ const GrpLayer_1 = __webpack_require__(/*! ./GrpLayer */ "./core/src/sn/GrpLayer.ts");
69826
69838
  const { GamepadListener } = __webpack_require__(/*! gamepad.js */ "./node_modules/gamepad.js/gamepad.js");
69827
69839
  class EventMng {
69828
69840
  constructor(cfg, hTag, appPixi, main, layMng, val, sndMng, scrItr, sys) {
@@ -69837,9 +69849,12 @@ class EventMng {
69837
69849
  this.sys = sys;
69838
69850
  _EventMng_instances.add(this);
69839
69851
  _EventMng_elc.set(this, new EventListenerCtn_1.EventListenerCtn);
69840
- _EventMng_hint.set(this, void 0);
69841
- _EventMng_zxHint.set(this, void 0);
69842
- _EventMng_zyHint.set(this, void 0);
69852
+ _EventMng_cvsHint.set(this, document.createElement('canvas'));
69853
+ _EventMng_picHint_w.set(this, 100);
69854
+ _EventMng_picHint_h.set(this, 50);
69855
+ _EventMng_padHint.set(this, void 0);
69856
+ _EventMng_grpHint.set(this, new pixi_js_1.Graphics);
69857
+ this.setTxtHint = (_txt, _fillStyle, _hint_font) => { };
69843
69858
  _EventMng_gamepad.set(this, new GamepadListener({
69844
69859
  analog: false,
69845
69860
  deadZone: 0.3,
@@ -69858,6 +69873,26 @@ class EventMng {
69858
69873
  __classPrivateFieldSet(this, _EventMng_firstWait, () => { }, "f");
69859
69874
  this.scrItr.firstWait();
69860
69875
  });
69876
+ _EventMng_dispHint_masume.set(this, (hArg, ctnBtn, rctBtn, isLink, hint_width, hint_tate) => {
69877
+ __classPrivateFieldGet(this, _EventMng_grpHint, "f").zIndex = 1000;
69878
+ __classPrivateFieldGet(this, _EventMng_grpHint, "f").x = rctBtn.x;
69879
+ __classPrivateFieldGet(this, _EventMng_grpHint, "f").y = rctBtn.y;
69880
+ __classPrivateFieldGet(this, _EventMng_grpHint, "f").rotation = ctnBtn.rotation;
69881
+ const p = (isLink ? ctnBtn.parent : ctnBtn).scale;
69882
+ const isBtnPic = (hArg.タグ名 === 'button') && (hArg.pic);
69883
+ __classPrivateFieldGet(this, _EventMng_grpHint, "f").clear()
69884
+ .beginFill(0x33FF00, 0.2)
69885
+ .lineStyle(1, 0x33FF00, 1)
69886
+ .drawRect(0, 0, rctBtn.width, rctBtn.height)
69887
+ .endFill()
69888
+ .beginFill(0x0033FF, 0.2)
69889
+ .lineStyle(2, 0x0033FF, 1);
69890
+ if (hint_tate)
69891
+ __classPrivateFieldGet(this, _EventMng_grpHint, "f").drawRect(isLink ? rctBtn.height : rctBtn.width, ((isLink ? rctBtn.width : rctBtn.height) - hint_width) / 2, __classPrivateFieldGet(this, _EventMng_picHint_h, "f") * (isBtnPic ? 1 : p.x), hint_width * (isBtnPic ? 1 : p.y));
69892
+ else
69893
+ __classPrivateFieldGet(this, _EventMng_grpHint, "f").drawRect((rctBtn.width - hint_width) / 2, -__classPrivateFieldGet(this, _EventMng_picHint_h, "f"), hint_width * (isBtnPic ? 1 : p.x), __classPrivateFieldGet(this, _EventMng_picHint_h, "f") * (isBtnPic ? 1 : p.y));
69894
+ __classPrivateFieldGet(this, _EventMng_grpHint, "f").endFill();
69895
+ });
69861
69896
  _EventMng_procWheel4wle.set(this, (_elc, _fnc) => { });
69862
69897
  _EventMng_elcWLE.set(this, new EventListenerCtn_1.EventListenerCtn);
69863
69898
  _EventMng_goTxt.set(this, () => this.layMng.goTxt());
@@ -69916,16 +69951,52 @@ class EventMng {
69916
69951
  sys.addHook(type => hHook[type]?.());
69917
69952
  }
69918
69953
  let fnHint = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyBAMAAABYG2ONAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGuGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDIgNzkuMTY0NDYwLCAyMDIwLzA1LzEyLTE2OjA0OjE3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjEuMiAoTWFjaW50b3NoKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjAtMDgtMTlUMDM6MDk6MjUrMDk6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIwLTA4LTE5VDIzOjUyOjI5KzA5OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIwLTA4LTE5VDIzOjUyOjI5KzA5OjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9InNSR0IgSUVDNjE5NjYtMi4xIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjI5ZjM1YWNlLTc0NzMtNGI3My05OGJjLWQ1OTk4ZDk5MjQzNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDphY2U0MDcwOS04ZTQxLTQ1YjYtYTMwZi05NDU1YWM1OTAwMmEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDphY2U0MDcwOS04ZTQxLTQ1YjYtYTMwZi05NDU1YWM1OTAwMmEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmFjZTQwNzA5LThlNDEtNDViNi1hMzBmLTk0NTVhYzU5MDAyYSIgc3RFdnQ6d2hlbj0iMjAyMC0wOC0xOVQwMzowOToyNSswOTowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDIxLjIgKE1hY2ludG9zaCkiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjA3Mzg4MzYwLWJjMjctNDRkZi1hMTYwLTk5N2M4ODNmYTA0ZCIgc3RFdnQ6d2hlbj0iMjAyMC0wOC0xOVQyMjo0NTozNiswOTowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDIxLjIgKE1hY2ludG9zaCkiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjI5ZjM1YWNlLTc0NzMtNGI3My05OGJjLWQ1OTk4ZDk5MjQzNiIgc3RFdnQ6d2hlbj0iMjAyMC0wOC0xOVQyMzo1MjoyOSswOTowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDIxLjIgKE1hY2ludG9zaCkiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+WWAYXwAAACdQTFRF////PDIlPDIlPDIlPDIlPDIlPDIlPDIlPDIlPDIlPDIlPDIlPDIlCOA6SAAAAA10Uk5TACB/MID/EJBA8NCwYDCdv6cAAABoSURBVHgBYxicYBQIKZEIlJmMSQWGTKS7a8RpGdUyqmVUy6iWUS3y7zGBAlwai+wnrOZwTA2FgBnE220F0RFlQLwWtq1gLdtI8SI7SEc4acFyMjQ08gBpgWzlAEKkgayoBJJj7AAuCQAm1kUjHh83WgAAAABJRU5ErkJggg==';
69954
+ let isCustomHint = false;
69919
69955
  try {
69920
69956
  fnHint = cfg.searchPath('hint', Config_1.Config.EXT_SPRITE);
69957
+ isCustomHint = true;
69921
69958
  }
69922
69959
  catch { }
69923
- __classPrivateFieldSet(this, _EventMng_hint, new Button_1.Button({ enabled: false, text: 'hint', style: `{"fill": "white", "fontSize": "${30 * 0.7}px"}`, b_pic: fnHint, width: 80, design: false }, this, () => { }, () => false), "f");
69924
- __classPrivateFieldGet(this, _EventMng_hint, "f").visible = false;
69925
- appPixi.stage.addChild(__classPrivateFieldGet(this, _EventMng_hint, "f"));
69926
- const rctHint = __classPrivateFieldGet(this, _EventMng_hint, "f").getBounds();
69927
- __classPrivateFieldSet(this, _EventMng_zxHint, __classPrivateFieldGet(this, _EventMng_hint, "f").x - rctHint.x, "f");
69928
- __classPrivateFieldSet(this, _EventMng_zyHint, __classPrivateFieldGet(this, _EventMng_hint, "f").y - rctHint.y, "f");
69960
+ const ctx = __classPrivateFieldGet(this, _EventMng_cvsHint, "f").getContext('2d');
69961
+ if (ctx) {
69962
+ const cvs = document.getElementById(CmnLib_1.CmnLib.SN_ID);
69963
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f").hidden = true;
69964
+ cvs.parentElement.appendChild(__classPrivateFieldGet(this, _EventMng_cvsHint, "f"));
69965
+ const s = __classPrivateFieldGet(this, _EventMng_cvsHint, "f").style;
69966
+ s.position = 'absolute';
69967
+ s.left = s.top = '0';
69968
+ s.zIndex = '10000';
69969
+ s.pointerEvents = 'none';
69970
+ s.userSelect = 'none';
69971
+ __classPrivateFieldSet(this, _EventMng_padHint, 10, "f");
69972
+ const img = new Image;
69973
+ const initHint = () => {
69974
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f").width = __classPrivateFieldSet(this, _EventMng_picHint_w, img.width, "f");
69975
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f").height = __classPrivateFieldSet(this, _EventMng_picHint_h, img.height, "f");
69976
+ this.setTxtHint('行方向の変更', 'white', '22px Arial');
69977
+ };
69978
+ this.setTxtHint = (txt, fillStyle, hint_font) => {
69979
+ ctx.clearRect(0, 0, __classPrivateFieldGet(this, _EventMng_cvsHint, "f").width, __classPrivateFieldGet(this, _EventMng_cvsHint, "f").height);
69980
+ ctx.drawImage(img, 0, 0);
69981
+ ctx.textBaseline = 'top';
69982
+ ctx.font = hint_font;
69983
+ ctx.fillStyle = fillStyle;
69984
+ ctx.fillText(txt, __classPrivateFieldGet(this, _EventMng_padHint, "f"), 16, __classPrivateFieldGet(this, _EventMng_picHint_w, "f") - __classPrivateFieldGet(this, _EventMng_padHint, "f") * 2);
69985
+ };
69986
+ if (isCustomHint)
69987
+ GrpLayer_1.GrpLayer.loadPic2Img('hint', img, i => {
69988
+ if (img === i)
69989
+ initHint();
69990
+ });
69991
+ else {
69992
+ img.src = fnHint;
69993
+ img.onload = initHint;
69994
+ }
69995
+ }
69996
+ if (this.cfg.oCfg.debug.masume)
69997
+ appPixi.stage.addChild(__classPrivateFieldGet(this, _EventMng_grpHint, "f"));
69998
+ else
69999
+ __classPrivateFieldSet(this, _EventMng_dispHint_masume, () => { }, "f");
69929
70000
  appPixi.stage.interactive = true;
69930
70001
  if (CmnLib_1.CmnLib.isMobile)
69931
70002
  appPixi.stage.on('pointerdown', (e) => this.fire('click', e));
@@ -70023,6 +70094,7 @@ class EventMng {
70023
70094
  destroy() {
70024
70095
  __classPrivateFieldGet(this, _EventMng_fcs, "f").destroy();
70025
70096
  __classPrivateFieldGet(this, _EventMng_elc, "f").clear();
70097
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f")?.parentElement.removeChild(__classPrivateFieldGet(this, _EventMng_cvsHint, "f"));
70026
70098
  }
70027
70099
  fire(KEY, e) {
70028
70100
  if (__classPrivateFieldGet(this, _EventMng_isDbgBreak, "f"))
@@ -70043,7 +70115,7 @@ class EventMng {
70043
70115
  if (!ke) {
70044
70116
  if (key.slice(0, 5) === 'swipe') {
70045
70117
  const esw = e;
70046
- globalThis.scrollBy(-(esw.deltaX ?? 0), -(esw.deltaY ?? 0));
70118
+ globalThis.scrollBy(-esw.deltaX ?? 0, -esw.deltaY ?? 0);
70047
70119
  }
70048
70120
  return;
70049
70121
  }
@@ -70054,7 +70126,7 @@ class EventMng {
70054
70126
  this.layMng.clickTxtLay();
70055
70127
  __classPrivateFieldSet(this, _EventMng_isWait, false, "f");
70056
70128
  ke(e);
70057
- __classPrivateFieldGet(this, _EventMng_hint, "f").visible = false;
70129
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f").hidden = true;
70058
70130
  }
70059
70131
  popLocalEvts() {
70060
70132
  const ret = __classPrivateFieldGet(this, _EventMng_hLocalEvt2Fnc, "f");
@@ -70076,10 +70148,11 @@ class EventMng {
70076
70148
  __classPrivateFieldGet(this, _EventMng_instances, "m", _EventMng_waitEventBase).call(this, onFinish, canskip, global);
70077
70149
  return true;
70078
70150
  }
70079
- button(hArg, em, normal, hover, clicked) {
70151
+ unButton(ctnBtn) { __classPrivateFieldGet(this, _EventMng_fcs, "f").remove(ctnBtn); }
70152
+ button(hArg, ctnBtn, normal, hover, clicked) {
70080
70153
  if (!hArg.fn && !hArg.label)
70081
70154
  this.main.errScript('fnまたはlabelは必須です');
70082
- em.interactive = em.buttonMode = true;
70155
+ ctnBtn.interactive = ctnBtn.buttonMode = true;
70083
70156
  const key = hArg.key?.toLowerCase() ?? ' ';
70084
70157
  if (!hArg.fn)
70085
70158
  hArg.fn = this.scrItr.scriptFn;
@@ -70088,24 +70161,24 @@ class EventMng {
70088
70161
  __classPrivateFieldGet(this, _EventMng_hGlobalEvt2Fnc, "f")[key] = () => this.main.resumeByJumpOrCall(hArg);
70089
70162
  else
70090
70163
  __classPrivateFieldGet(this, _EventMng_hLocalEvt2Fnc, "f")[key] = () => this.main.resumeByJumpOrCall(hArg);
70091
- const ee = em;
70164
+ const ee = ctnBtn;
70092
70165
  ee.on('pointerdown', (e) => this.fire(key, e));
70093
- const onHint = hArg.hint ? () => __classPrivateFieldGet(this, _EventMng_instances, "m", _EventMng_dispHint).call(this, hArg, em) : () => { };
70094
- const nr = () => { normal(); __classPrivateFieldGet(this, _EventMng_hint, "f").visible = false; };
70166
+ const onHint = hArg.hint ? () => __classPrivateFieldGet(this, _EventMng_instances, "m", _EventMng_dispHint).call(this, hArg, ctnBtn) : () => { };
70167
+ const nr = () => { normal(); __classPrivateFieldGet(this, _EventMng_cvsHint, "f").hidden = true; };
70095
70168
  const hv = () => { onHint(); return hover(); };
70096
70169
  ee.on('pointerover', hv);
70097
- ee.on('pointerout', () => { if (__classPrivateFieldGet(this, _EventMng_fcs, "f").isFocus(em))
70170
+ ee.on('pointerout', () => { if (__classPrivateFieldGet(this, _EventMng_fcs, "f").isFocus(ctnBtn))
70098
70171
  hv();
70099
70172
  else
70100
70173
  nr(); });
70101
70174
  ee.on('pointerdown', clicked);
70102
70175
  ee.on('pointerup', CmnLib_1.CmnLib.isMobile
70103
70176
  ? nr
70104
- : () => { if (__classPrivateFieldGet(this, _EventMng_fcs, "f").isFocus(em))
70177
+ : () => { if (__classPrivateFieldGet(this, _EventMng_fcs, "f").isFocus(ctnBtn))
70105
70178
  hv();
70106
70179
  else
70107
70180
  nr(); });
70108
- __classPrivateFieldGet(this, _EventMng_fcs, "f").add(em, hv, nr);
70181
+ __classPrivateFieldGet(this, _EventMng_fcs, "f").add(ctnBtn, hv, nr);
70109
70182
  if (hArg.clickse) {
70110
70183
  this.cfg.searchPath(hArg.clickse, Config_1.Config.EXT_SOUND);
70111
70184
  ee.on('pointerdown', () => {
@@ -70226,7 +70299,7 @@ class EventMng {
70226
70299
  }
70227
70300
  }
70228
70301
  exports.EventMng = EventMng;
70229
- _EventMng_elc = new WeakMap(), _EventMng_hint = new WeakMap(), _EventMng_zxHint = new WeakMap(), _EventMng_zyHint = new WeakMap(), _EventMng_gamepad = new WeakMap(), _EventMng_fcs = new WeakMap(), _EventMng_resvFlameEvent4Wheel = new WeakMap(), _EventMng_wheeling = new WeakMap(), _EventMng_extend_wheel = new WeakMap(), _EventMng_hLocalEvt2Fnc = new WeakMap(), _EventMng_hGlobalEvt2Fnc = new WeakMap(), _EventMng_isDbgBreak = new WeakMap(), _EventMng_isWait = new WeakMap(), _EventMng_getEvt2Fnc = new WeakMap(), _EventMng_firstWait = new WeakMap(), _EventMng_procWheel4wle = new WeakMap(), _EventMng_elcWLE = new WeakMap(), _EventMng_goTxt = new WeakMap(), _EventMng_fncCancelSkip = new WeakMap(), _EventMng_hDownKeys = new WeakMap(), _EventMng_instances = new WeakSet(), _EventMng_ev_keydown = function _EventMng_ev_keydown(e) {
70302
+ _EventMng_elc = new WeakMap(), _EventMng_cvsHint = new WeakMap(), _EventMng_picHint_w = new WeakMap(), _EventMng_picHint_h = new WeakMap(), _EventMng_padHint = new WeakMap(), _EventMng_grpHint = new WeakMap(), _EventMng_gamepad = new WeakMap(), _EventMng_fcs = new WeakMap(), _EventMng_resvFlameEvent4Wheel = new WeakMap(), _EventMng_wheeling = new WeakMap(), _EventMng_extend_wheel = new WeakMap(), _EventMng_hLocalEvt2Fnc = new WeakMap(), _EventMng_hGlobalEvt2Fnc = new WeakMap(), _EventMng_isDbgBreak = new WeakMap(), _EventMng_isWait = new WeakMap(), _EventMng_getEvt2Fnc = new WeakMap(), _EventMng_firstWait = new WeakMap(), _EventMng_dispHint_masume = new WeakMap(), _EventMng_procWheel4wle = new WeakMap(), _EventMng_elcWLE = new WeakMap(), _EventMng_goTxt = new WeakMap(), _EventMng_fncCancelSkip = new WeakMap(), _EventMng_hDownKeys = new WeakMap(), _EventMng_instances = new WeakSet(), _EventMng_ev_keydown = function _EventMng_ev_keydown(e) {
70230
70303
  if (e['isComposing'])
70231
70304
  return;
70232
70305
  if (e.key in __classPrivateFieldGet(this, _EventMng_hDownKeys, "f"))
@@ -70287,30 +70360,32 @@ _EventMng_elc = new WeakMap(), _EventMng_hint = new WeakMap(), _EventMng_zxHint
70287
70360
  : key => __classPrivateFieldGet(this, _EventMng_hLocalEvt2Fnc, "f")[key], "f");
70288
70361
  __classPrivateFieldSet(this, _EventMng_isWait, true, "f");
70289
70362
  __classPrivateFieldGet(this, _EventMng_firstWait, "f").call(this);
70290
- }, _EventMng_dispHint = function _EventMng_dispHint(hArg, em) {
70291
- const h = __classPrivateFieldGet(this, _EventMng_hint, "f");
70292
- const tx = h.children[1];
70293
- if (!tx)
70294
- return;
70295
- tx.text = hArg.hint;
70296
- const isBgTextBtn = em.name?.includes('"b_pic":');
70297
- const isPicBtn = em.name?.includes('"pic":');
70363
+ if (CmnLib_1.CmnLib.debugLog) {
70364
+ const o = Object.create(null);
70365
+ o.local = Object.keys(__classPrivateFieldGet(this, _EventMng_hLocalEvt2Fnc, "f"));
70366
+ o.global = Object.keys(__classPrivateFieldGet(this, _EventMng_hGlobalEvt2Fnc, "f"));
70367
+ console.log(`🎍 wait event... %o`, o);
70368
+ }
70369
+ }, _EventMng_dispHint = function _EventMng_dispHint(hArg, ctnBtn) {
70370
+ const rctBtn = ctnBtn instanceof Button_1.Button
70371
+ ? ctnBtn.getBtnBounds()
70372
+ : ctnBtn.getBounds();
70298
70373
  const isLink = (hArg.タグ名 === 'link');
70299
- h.parent?.removeChild(h);
70300
- (isLink ? em.parent : em).addChild(h);
70301
- if ((0, CmnLib_1.argChk_Boolean)(hArg, 'hint_tate', false))
70302
- h.setTransform(isPicBtn ? em.width / em.scale.x
70303
- : (isBgTextBtn ? (h.width - em.width) / 2 - __classPrivateFieldGet(this, _EventMng_zxHint, "f") : 0)
70304
- + (isLink ? em.x : 0) + em.width, isPicBtn ? em.height / 2 / em.scale.y
70305
- : isBgTextBtn ? h.height / 2
70306
- : ((isLink ? em.y : 0) + em.height / 2 + __classPrivateFieldGet(this, _EventMng_zyHint, "f")), 1, 1, 1.570796327, 0, 0, h.width / 2, h.height - __classPrivateFieldGet(this, _EventMng_zxHint, "f") * 2);
70307
- else
70308
- h.setTransform(isPicBtn ? (em.width - h.width + __classPrivateFieldGet(this, _EventMng_zxHint, "f")) / 2
70309
- : isBgTextBtn ? 0
70310
- : (isLink ? em.x : 0) + (em.width - h.width) / 2, isPicBtn ? 0
70311
- : isBgTextBtn ? (h.height - em.height) / 2
70312
- : isLink ? em.y : 0, 1, 1, 0, 0, 0, -__classPrivateFieldGet(this, _EventMng_zxHint, "f") / 2, h.height - 10);
70313
- h.visible = true;
70374
+ if (!isLink) {
70375
+ const cpp = ctnBtn.parent.parent;
70376
+ rctBtn.x += cpp.x;
70377
+ rctBtn.y += cpp.y;
70378
+ }
70379
+ this.setTxtHint(hArg.hint ?? '', hArg.hint_color ?? 'white', hArg.hint_font ?? '22px Arial');
70380
+ const hint_width = (0, CmnLib_1.argChk_Num)(hArg, 'hint_width', __classPrivateFieldGet(this, _EventMng_picHint_w, "f"));
70381
+ const scale_x = hint_width / __classPrivateFieldGet(this, _EventMng_picHint_w, "f");
70382
+ const hint_tate = (0, CmnLib_1.argChk_Boolean)(hArg, 'hint_tate', false);
70383
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f").style.left = `${rctBtn.x}px`;
70384
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f").style.top = `${rctBtn.y}px`;
70385
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f").style.transformOrigin = 'top left';
70386
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f").style.transform = `rotateZ(${ctnBtn.rotation + (hint_tate ? Math.PI * 90 / 180 : 0)}rad) scale(${scale_x}, 1) translate(${((hint_tate ? rctBtn.height : rctBtn.width) - hint_width) / 2 / scale_x}px, ${(hint_tate ? -rctBtn.width : 0) - __classPrivateFieldGet(this, _EventMng_picHint_h, "f")}px)`;
70387
+ __classPrivateFieldGet(this, _EventMng_cvsHint, "f").hidden = false;
70388
+ __classPrivateFieldGet(this, _EventMng_dispHint_masume, "f").call(this, hArg, ctnBtn, rctBtn, isLink, hint_width, hint_tate);
70314
70389
  }, _EventMng_clear_event = function _EventMng_clear_event(hArg) {
70315
70390
  const glb = (0, CmnLib_1.argChk_Boolean)(hArg, 'global', false);
70316
70391
  const h = glb ? __classPrivateFieldGet(this, _EventMng_hGlobalEvt2Fnc, "f") : __classPrivateFieldGet(this, _EventMng_hLocalEvt2Fnc, "f");
@@ -70741,12 +70816,13 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
70741
70816
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
70742
70817
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
70743
70818
  };
70744
- var _FrameMng_instances, _FrameMng_evtMng, _FrameMng_hIfrm, _FrameMng_add_frame, _FrameMng_hDisabled, _FrameMng_hAEncImg, _FrameMng_hEncImgOUrl, _FrameMng_rect, _FrameMng_let_frame, _FrameMng_set_frame, _FrameMng_zIdx, _FrameMng_frame, _FrameMng_tsy_frame;
70819
+ var _FrameMng_instances, _FrameMng_evtMng, _FrameMng_hIfrm, _FrameMng_add_frame, _FrameMng_hDisabled, _FrameMng_rect, _FrameMng_let_frame, _FrameMng_set_frame, _FrameMng_zIdx, _FrameMng_frame, _FrameMng_tsy_frame;
70745
70820
  Object.defineProperty(exports, "__esModule", ({ value: true }));
70746
70821
  exports.FrameMng = void 0;
70747
70822
  const CmnLib_1 = __webpack_require__(/*! ./CmnLib */ "./core/src/sn/CmnLib.ts");
70748
70823
  const CmnTween_1 = __webpack_require__(/*! ./CmnTween */ "./core/src/sn/CmnTween.ts");
70749
70824
  const Config_1 = __webpack_require__(/*! ./Config */ "./core/src/sn/Config.ts");
70825
+ const GrpLayer_1 = __webpack_require__(/*! ./GrpLayer */ "./core/src/sn/GrpLayer.ts");
70750
70826
  const tween_js_1 = __webpack_require__(/*! @tweenjs/tween.js */ "./node_modules/@tweenjs/tween.js/dist/tween.esm.js");
70751
70827
  const pixi_js_1 = __webpack_require__(/*! pixi.js */ "./node_modules/pixi.js/dist/esm/pixi.js");
70752
70828
  class FrameMng {
@@ -70760,9 +70836,7 @@ class FrameMng {
70760
70836
  _FrameMng_instances.add(this);
70761
70837
  _FrameMng_evtMng.set(this, void 0);
70762
70838
  _FrameMng_hIfrm.set(this, Object.create(null));
70763
- _FrameMng_hDisabled.set(this, Object.create(null));
70764
- _FrameMng_hAEncImg.set(this, Object.create(null));
70765
- _FrameMng_hEncImgOUrl.set(this, Object.create(null));
70839
+ _FrameMng_hDisabled.set(this, {});
70766
70840
  _FrameMng_zIdx.set(this, 1);
70767
70841
  hTag.add_frame = o => __classPrivateFieldGet(this, _FrameMng_instances, "m", _FrameMng_add_frame).call(this, o);
70768
70842
  hTag.let_frame = o => __classPrivateFieldGet(this, _FrameMng_instances, "m", _FrameMng_let_frame).call(this, o);
@@ -70795,7 +70869,7 @@ class FrameMng {
70795
70869
  }
70796
70870
  }
70797
70871
  exports.FrameMng = FrameMng;
70798
- _FrameMng_evtMng = new WeakMap(), _FrameMng_hIfrm = new WeakMap(), _FrameMng_hDisabled = new WeakMap(), _FrameMng_hAEncImg = new WeakMap(), _FrameMng_hEncImgOUrl = new WeakMap(), _FrameMng_zIdx = new WeakMap(), _FrameMng_instances = new WeakSet(), _FrameMng_add_frame = function _FrameMng_add_frame(hArg) {
70872
+ _FrameMng_evtMng = new WeakMap(), _FrameMng_hIfrm = new WeakMap(), _FrameMng_hDisabled = new WeakMap(), _FrameMng_zIdx = new WeakMap(), _FrameMng_instances = new WeakSet(), _FrameMng_add_frame = function _FrameMng_add_frame(hArg) {
70799
70873
  const id = hArg.id;
70800
70874
  if (!id)
70801
70875
  throw 'idは必須です';
@@ -70849,46 +70923,7 @@ _FrameMng_evtMng = new WeakMap(), _FrameMng_hIfrm = new WeakMap(), _FrameMng_hDi
70849
70923
  this.val.setVal_Nochk('tmp', frmnm + '.visible', v);
70850
70924
  const win = ifrm.contentWindow;
70851
70925
  __classPrivateFieldGet(this, _FrameMng_evtMng, "f").resvFlameEvent(win);
70852
- (win.sn_repRes)?.((i) => {
70853
- const src = (i.dataset.src ?? '').replace(/(.+\/|\..+)/g, '');
70854
- const oUrl = __classPrivateFieldGet(this, _FrameMng_hEncImgOUrl, "f")[src];
70855
- if (oUrl) {
70856
- i.src = oUrl;
70857
- return;
70858
- }
70859
- const aImg = __classPrivateFieldGet(this, _FrameMng_hAEncImg, "f")[src];
70860
- if (aImg) {
70861
- aImg.push(i);
70862
- return;
70863
- }
70864
- __classPrivateFieldGet(this, _FrameMng_hAEncImg, "f")[src] = [i];
70865
- const url2 = this.cfg.searchPath(src, Config_1.Config.EXT_SPRITE);
70866
- const ld2 = (new pixi_js_1.Loader)
70867
- .add({ name: src, url: url2, xhrType: pixi_js_1.LoaderResource.XHR_RESPONSE_TYPE.BUFFER, });
70868
- if (this.sys.crypto)
70869
- ld2.use((res, next) => {
70870
- this.sys.dec(res.extension, res.data)
70871
- .then(r => {
70872
- if (res.extension !== 'bin') {
70873
- next?.();
70874
- return;
70875
- }
70876
- res.data = r;
70877
- if (r instanceof HTMLImageElement) {
70878
- res.type = pixi_js_1.LoaderResource.TYPE.IMAGE;
70879
- }
70880
- next?.();
70881
- })
70882
- .catch(e => this.main.errScript(`Graphic ロード失敗です fn:${res.name} ${e}`, false));
70883
- });
70884
- ld2.load((_ldr, hRes) => {
70885
- for (const s2 in hRes) {
70886
- const u2 = __classPrivateFieldGet(this, _FrameMng_hEncImgOUrl, "f")[s2] = hRes[s2].data.src;
70887
- __classPrivateFieldGet(this, _FrameMng_hAEncImg, "f")[s2].forEach(v => v.src = u2);
70888
- delete __classPrivateFieldGet(this, _FrameMng_hAEncImg, "f")[s2];
70889
- }
70890
- });
70891
- });
70926
+ (win.sn_repRes)?.((img) => GrpLayer_1.GrpLayer.loadPic2Img((img.dataset.src ?? '').replace(/(.+\/|\..+)/g, ''), img));
70892
70927
  this.main.resume();
70893
70928
  };
70894
70929
  });
@@ -71301,7 +71336,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
71301
71336
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
71302
71337
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
71303
71338
  };
71304
- var _a, _GrpLayer_elc, _GrpLayer_hFace, _GrpLayer_main, _GrpLayer_cfg, _GrpLayer_sys, _GrpLayer_glbVol, _GrpLayer_movVol, _GrpLayer_evtMng, _GrpLayer_idc, _GrpLayer_csvFn, _GrpLayer_sBkFn, _GrpLayer_sBkFace, _GrpLayer_width, _GrpLayer_height, _GrpLayer_dec2cache, _GrpLayer_sortAFrameName, _GrpLayer_dec2cache4Cripto, _GrpLayer_mkSprite;
71339
+ var _a, _GrpLayer_elc, _GrpLayer_hFace, _GrpLayer_main, _GrpLayer_cfg, _GrpLayer_sys, _GrpLayer_glbVol, _GrpLayer_movVol, _GrpLayer_evtMng, _GrpLayer_idc, _GrpLayer_csvFn, _GrpLayer_sBkFn, _GrpLayer_sBkFace, _GrpLayer_width, _GrpLayer_height, _GrpLayer_dec2cache, _GrpLayer_sortAFrameName, _GrpLayer_dec2cache4Cripto, _GrpLayer_mkSprite, _GrpLayer_hAEncImg, _GrpLayer_hEncImgOUrl;
71305
71340
  Object.defineProperty(exports, "__esModule", ({ value: true }));
71306
71341
  exports.GrpLayer = void 0;
71307
71342
  const Layer_1 = __webpack_require__(/*! ./Layer */ "./core/src/sn/Layer.ts");
@@ -71488,6 +71523,49 @@ class GrpLayer extends Layer_1.Layer {
71488
71523
  hve.addEventListener('ended', fnc, { once: true, passive: true });
71489
71524
  return __classPrivateFieldGet(GrpLayer, _a, "f", _GrpLayer_evtMng).waitEvent(() => { hve.pause(); fnc(); }, (0, CmnLib_1.argChk_Boolean)(hArg, 'canskip', true), (0, CmnLib_1.argChk_Boolean)(hArg, 'global', false));
71490
71525
  }
71526
+ static loadPic2Img(src, img, onload) {
71527
+ const oUrl = __classPrivateFieldGet(this, _a, "f", _GrpLayer_hEncImgOUrl)[src];
71528
+ if (oUrl) {
71529
+ img.src = oUrl;
71530
+ return;
71531
+ }
71532
+ const aImg = __classPrivateFieldGet(this, _a, "f", _GrpLayer_hAEncImg)[src];
71533
+ if (aImg) {
71534
+ aImg.push(img);
71535
+ return;
71536
+ }
71537
+ __classPrivateFieldGet(this, _a, "f", _GrpLayer_hAEncImg)[src] = [img];
71538
+ const url2 = __classPrivateFieldGet(GrpLayer, _a, "f", _GrpLayer_cfg).searchPath(src, Config_1.Config.EXT_SPRITE);
71539
+ const ld2 = (new pixi_js_1.Loader)
71540
+ .add({ name: src, url: url2, xhrType: pixi_js_1.LoaderResource.XHR_RESPONSE_TYPE.BUFFER, });
71541
+ if (__classPrivateFieldGet(GrpLayer, _a, "f", _GrpLayer_sys).crypto)
71542
+ ld2.use((res, next) => {
71543
+ __classPrivateFieldGet(GrpLayer, _a, "f", _GrpLayer_sys).dec(res.extension, res.data)
71544
+ .then(r => {
71545
+ if (res.extension !== 'bin') {
71546
+ next?.();
71547
+ return;
71548
+ }
71549
+ res.data = r;
71550
+ if (r instanceof HTMLImageElement) {
71551
+ res.type = pixi_js_1.LoaderResource.TYPE.IMAGE;
71552
+ }
71553
+ next?.();
71554
+ })
71555
+ .catch(e => __classPrivateFieldGet(GrpLayer, _a, "f", _GrpLayer_main).errScript(`GrpLayer loadPic ロード失敗です fn:${res.name} ${e}`, false));
71556
+ });
71557
+ ld2.load((_ldr, hRes) => {
71558
+ for (const s2 in hRes) {
71559
+ const u2 = __classPrivateFieldGet(this, _a, "f", _GrpLayer_hEncImgOUrl)[s2] = hRes[s2].data.src;
71560
+ __classPrivateFieldGet(this, _a, "f", _GrpLayer_hAEncImg)[s2].forEach(i => {
71561
+ i.src = u2;
71562
+ if (onload)
71563
+ i.onload = () => onload(i);
71564
+ });
71565
+ delete __classPrivateFieldGet(this, _a, "f", _GrpLayer_hAEncImg)[s2];
71566
+ }
71567
+ });
71568
+ }
71491
71569
  setPos(hArg) {
71492
71570
  Layer_1.Layer.setXY((this.spLay.children.length === 0) ? this.spLay : this.spLay.children[0], hArg, this.spLay, true);
71493
71571
  }
@@ -71639,6 +71717,8 @@ _GrpLayer_dec2cache = { value: (_r, res, next) => {
71639
71717
  next();
71640
71718
  } };
71641
71719
  GrpLayer.hFn2VElm = {};
71720
+ _GrpLayer_hAEncImg = { value: {} };
71721
+ _GrpLayer_hEncImgOUrl = { value: {} };
71642
71722
 
71643
71723
 
71644
71724
  /***/ }),
@@ -72113,10 +72193,11 @@ void main(void) {
72113
72193
  if (cfg.existsBreakpage)
72114
72194
  this.breakPage = () => __classPrivateFieldGet(this, _LayerMng_cmdTxt, "f").call(this, 'grp|{"id":"break","pic":"breakpage"}');
72115
72195
  const grp = new pixi_js_1.Graphics;
72116
- grp.beginFill(cfg.oCfg.init.bg_color, 1);
72117
- grp.lineStyle(0, cfg.oCfg.init.bg_color);
72118
- grp.drawRect(0, 0, CmnLib_1.CmnLib.stageW, CmnLib_1.CmnLib.stageH);
72119
- grp.endFill();
72196
+ grp
72197
+ .beginFill(cfg.oCfg.init.bg_color, 1)
72198
+ .lineStyle(0, cfg.oCfg.init.bg_color)
72199
+ .drawRect(0, 0, CmnLib_1.CmnLib.stageW, CmnLib_1.CmnLib.stageH)
72200
+ .endFill();
72120
72201
  __classPrivateFieldGet(this, _LayerMng_fore, "f").addChild(grp.clone());
72121
72202
  __classPrivateFieldGet(this, _LayerMng_back, "f").addChild(grp);
72122
72203
  __classPrivateFieldGet(this, _LayerMng_back, "f").visible = false;
@@ -72155,14 +72236,12 @@ void main(void) {
72155
72236
  __classPrivateFieldGet(this, _LayerMng_grpCover, "f").destroy();
72156
72237
  __classPrivateFieldSet(this, _LayerMng_grpCover, null, "f");
72157
72238
  }
72158
- if (visible) {
72159
- __classPrivateFieldSet(this, _LayerMng_grpCover, new pixi_js_1.Graphics, "f");
72160
- __classPrivateFieldGet(this, _LayerMng_grpCover, "f").beginFill(bg_color);
72161
- __classPrivateFieldGet(this, _LayerMng_grpCover, "f").lineStyle(0, bg_color);
72162
- __classPrivateFieldGet(this, _LayerMng_grpCover, "f").drawRect(0, 0, CmnLib_1.CmnLib.stageW, CmnLib_1.CmnLib.stageH);
72163
- __classPrivateFieldGet(this, _LayerMng_grpCover, "f").endFill();
72164
- __classPrivateFieldGet(this, _LayerMng_stage, "f").addChild(__classPrivateFieldGet(this, _LayerMng_grpCover, "f"));
72165
- }
72239
+ if (visible)
72240
+ __classPrivateFieldGet(this, _LayerMng_stage, "f").addChild((__classPrivateFieldSet(this, _LayerMng_grpCover, new pixi_js_1.Graphics, "f"))
72241
+ .beginFill(bg_color)
72242
+ .lineStyle(0, bg_color)
72243
+ .drawRect(0, 0, CmnLib_1.CmnLib.stageW, CmnLib_1.CmnLib.stageH)
72244
+ .endFill());
72166
72245
  }
72167
72246
  setEvtMng(evtMng) {
72168
72247
  __classPrivateFieldSet(this, _LayerMng_evtMng, evtMng, "f");
@@ -76424,7 +76503,7 @@ class TxtLayer extends Layer_1.Layer {
76424
76503
  }
76425
76504
  dump() {
76426
76505
  __classPrivateFieldGet(this, _TxtLayer_putCh, "f").call(this, '', 'gotxt|');
76427
- return super.dump() + `, "enabled":"${this.enabled}", ${__classPrivateFieldGet(this, _TxtLayer_txs, "f").dump()}, "b_pic":"${__classPrivateFieldGet(this, _TxtLayer_b_pic, "f")}", "b_color":"${__classPrivateFieldGet(this, _TxtLayer_b_color, "f")}", "b_alpha":${__classPrivateFieldGet(this, _TxtLayer_b_alpha, "f")}, "b_alpha_isfixed":"${__classPrivateFieldGet(this, _TxtLayer_b_alpha_isfixed, "f")}", "b_width":${__classPrivateFieldGet(this, _TxtLayer_infTL, "f").$width}, "b_height":${__classPrivateFieldGet(this, _TxtLayer_infTL, "f").$height}, "pixi_obj":[${this.spLay.children.map(e => `{"class":"${(e instanceof pixi_js_1.Sprite) ? 'Sprite' : ((e instanceof pixi_js_1.Graphics) ? 'Graphics' : ((e instanceof pixi_js_1.Container) ? 'Container' : '?'))}", "name":"${e.name}", "alpha":${e.alpha}, "x":${e.x}, "y":${e.y}, "visible":"${e.visible}"}`).join(',')}], "button":[${__classPrivateFieldGet(this, _TxtLayer_cntBtn, "f").children.map(d => d.children[0].name).join(',')}]`;
76506
+ return super.dump() + `, "enabled":"${this.enabled}", ${__classPrivateFieldGet(this, _TxtLayer_txs, "f").dump()}, "b_pic":"${__classPrivateFieldGet(this, _TxtLayer_b_pic, "f")}", "b_color":"${__classPrivateFieldGet(this, _TxtLayer_b_color, "f")}", "b_alpha":${__classPrivateFieldGet(this, _TxtLayer_b_alpha, "f")}, "b_alpha_isfixed":"${__classPrivateFieldGet(this, _TxtLayer_b_alpha_isfixed, "f")}", "b_width":${__classPrivateFieldGet(this, _TxtLayer_infTL, "f").$width}, "b_height":${__classPrivateFieldGet(this, _TxtLayer_infTL, "f").$height}, "pixi_obj":[${this.spLay.children.map(e => `{"class":"${(e instanceof pixi_js_1.Sprite) ? 'Sprite' : ((e instanceof pixi_js_1.Graphics) ? 'Graphics' : ((e instanceof pixi_js_1.Container) ? 'Container' : '?'))}", "name":"${e.name}", "alpha":${e.alpha}, "x":${e.x}, "y":${e.y}, "visible":"${e.visible}"}`).join(',')}], "button":[${__classPrivateFieldGet(this, _TxtLayer_cntBtn, "f").children.map(d => d.children[0].name ?? '{}').join(',')}]`;
76428
76507
  }
76429
76508
  }
76430
76509
  exports.TxtLayer = TxtLayer;
@@ -76839,21 +76918,22 @@ class TxtStage extends pixi_js_1.Container {
76839
76918
  var _b;
76840
76919
  __classPrivateFieldGet(TxtStage, _a, "f", _TxtStage_cntBreak).visible = false;
76841
76920
  const begin = __classPrivateFieldGet(this, _TxtStage_aRect, "f").length;
76842
- if (__classPrivateFieldGet(TxtStage, _a, "f", _TxtStage_cfg).oCfg.debug.masume && begin === 0) {
76843
- if (CmnLib_1.CmnLib.debugLog)
76844
- console.log(`🍌 masume ${this.name} v:${this.visible} l:${this.x} t:${this.y} a:${this.alpha} pl:${this.infTL.pad_left} pr:${this.infTL.pad_right} pt:${this.infTL.pad_top} pb:${this.infTL.pad_bottom} w:${this.infTL.$width} h:${this.infTL.$height}`);
76845
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").clear();
76846
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").beginFill(0x33FF00, 0.2);
76847
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").lineStyle(1, 0x33FF00, 1);
76848
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").drawRect(-this.infTL.pad_left, -this.infTL.pad_top, this.infTL.$width, this.infTL.$height);
76849
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").endFill();
76850
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").beginFill(0x0033FF, 0.2);
76851
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").lineStyle(2, 0x0033FF, 1);
76852
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").drawRect(0, 0, this.infTL.$width - this.infTL.pad_left - this.infTL.pad_right, this.infTL.$height - this.infTL.pad_top - this.infTL.pad_bottom);
76853
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").endFill();
76854
- }
76855
- if (begin === 0)
76921
+ if (begin === 0) {
76922
+ if (__classPrivateFieldGet(TxtStage, _a, "f", _TxtStage_cfg).oCfg.debug.masume) {
76923
+ if (CmnLib_1.CmnLib.debugLog)
76924
+ console.log(`🍌 masume ${this.name} v:${this.visible} l:${this.x} t:${this.y} a:${this.alpha} pl:${this.infTL.pad_left} pr:${this.infTL.pad_right} pt:${this.infTL.pad_top} pb:${this.infTL.pad_bottom} w:${this.infTL.$width} h:${this.infTL.$height}`);
76925
+ __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").clear()
76926
+ .beginFill(0x33FF00, 0.2)
76927
+ .lineStyle(1, 0x33FF00, 1)
76928
+ .drawRect(-this.infTL.pad_left, -this.infTL.pad_top, this.infTL.$width, this.infTL.$height)
76929
+ .endFill()
76930
+ .beginFill(0x0033FF, 0.2)
76931
+ .lineStyle(2, 0x0033FF, 1)
76932
+ .drawRect(0, 0, this.infTL.$width - this.infTL.pad_left - this.infTL.pad_right, this.infTL.$height - this.infTL.pad_top - this.infTL.pad_bottom)
76933
+ .endFill();
76934
+ }
76856
76935
  __classPrivateFieldGet(this, _TxtStage_htmTxt, "f").innerHTML = [...aSpan].join('');
76936
+ }
76857
76937
  else
76858
76938
  __classPrivateFieldGet(this, _TxtStage_htmTxt, "f").insertAdjacentHTML('beforeend', aSpan.slice(__classPrivateFieldGet(this, _TxtStage_lenHtmTxt, "f")).join(''));
76859
76939
  __classPrivateFieldSet(this, _TxtStage_lenHtmTxt, aSpan.length, "f");
@@ -76937,16 +77017,17 @@ class TxtStage extends pixi_js_1.Container {
76937
77017
  const fncMasume = (__classPrivateFieldGet(TxtStage, _a, "f", _TxtStage_cfg).oCfg.debug.masume)
76938
77018
  ? (v, rct) => {
76939
77019
  fncMasumeLog(v, rct);
76940
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").beginFill(0x66CCFF, 0.5);
76941
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").lineStyle(2, 0xFF3300, 1);
76942
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").drawRect(rct.x, rct.y, rct.width, rct.height);
76943
- __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f").endFill();
77020
+ __classPrivateFieldGet(this, _TxtStage_grpDbgMasume, "f")
77021
+ .beginFill(0x66CCFF, 0.5)
77022
+ .lineStyle(2, 0xFF3300, 1)
77023
+ .drawRect(rct.x, rct.y, rct.width, rct.height)
77024
+ .endFill();
76944
77025
  }
76945
77026
  : () => { };
76946
77027
  const ease = CmnTween_1.CmnTween.ease(__classPrivateFieldGet(this, _TxtStage_fi_easing, "f"));
76947
77028
  const bcr = __classPrivateFieldGet(this, _TxtStage_htmTxt, "f").getBoundingClientRect();
76948
- const sx = bcr.left + globalThis.pageXOffset + this.infTL.pad_left;
76949
- const sy = bcr.top + globalThis.pageYOffset + this.infTL.pad_top;
77029
+ const sx = bcr.left + globalThis.scrollX + this.infTL.pad_left;
77030
+ const sy = bcr.top + globalThis.scrollY + this.infTL.pad_top;
76950
77031
  for (let i = begin; i < len; ++i) {
76951
77032
  const v = __classPrivateFieldGet(this, _TxtStage_aRect, "f")[i];
76952
77033
  const rct = v.rect;
@@ -76985,13 +77066,13 @@ class TxtStage extends pixi_js_1.Container {
76985
77066
  const style_normal = v.elm.style.cssText;
76986
77067
  const style_hover = arg.style_hover ?? '';
76987
77068
  const style_clicked = arg.style_clicked ?? '';
76988
- const isLinkHead = __classPrivateFieldGet(this, _TxtStage_beforeHTMLElm, "f") !== v.elm;
76989
- __classPrivateFieldGet(TxtStage, _a, "f", _TxtStage_evtMng).button(arg, sp, () => v.elm.style.cssText = style_normal, isLinkHead ? () => {
76990
- if (!this.canFocus())
76991
- return false;
76992
- v.elm.style.cssText = style_hover;
76993
- return true;
76994
- }
77069
+ __classPrivateFieldGet(TxtStage, _a, "f", _TxtStage_evtMng).button(arg, sp, () => v.elm.style.cssText = style_normal, __classPrivateFieldGet(this, _TxtStage_beforeHTMLElm, "f") !== v.elm
77070
+ ? () => {
77071
+ if (!this.canFocus())
77072
+ return false;
77073
+ v.elm.style.cssText = style_hover;
77074
+ return true;
77075
+ }
76995
77076
  : () => false, () => v.elm.style.cssText = style_clicked);
76996
77077
  __classPrivateFieldSet(this, _TxtStage_beforeHTMLElm, v.elm, "f");
76997
77078
  __classPrivateFieldGet(this, _TxtStage_cntTxt, "f").addChild(sp);
@@ -77452,6 +77533,8 @@ _a = TxtStage, _TxtStage_htmTxt = new WeakMap(), _TxtStage_cntTxt = new WeakMap(
77452
77533
  canvas.height = this.infTL.$height;
77453
77534
  canvas.getContext('2d').drawImage(img, 0, 0);
77454
77535
  canvas.toBlob(blob => {
77536
+ if (!blob)
77537
+ return;
77455
77538
  const url = URL.createObjectURL(blob);
77456
77539
  pixi_js_1.Texture.from(url).once('update', (tx2) => {
77457
77540
  fnc(tx2);
@@ -77511,7 +77594,7 @@ _a = TxtStage, _TxtStage_htmTxt = new WeakMap(), _TxtStage_cntTxt = new WeakMap(
77511
77594
  const ch = range.toString();
77512
77595
  const cr = {
77513
77596
  ch: ch,
77514
- rect: new pixi_js_1.Rectangle(r.left + globalThis.pageXOffset, r.top + globalThis.pageYOffset, r.width, r.height + ('gjqy'.includes(ch) ? __classPrivateFieldGet(this, _TxtStage_lh_half, "f") : 0)),
77597
+ rect: new pixi_js_1.Rectangle(r.left + globalThis.scrollX, r.top + globalThis.scrollY, r.width, r.height + ('gjqy'.includes(ch) ? __classPrivateFieldGet(this, _TxtStage_lh_half, "f") : 0)),
77515
77598
  elm: pe,
77516
77599
  cmd: pe.getAttribute('data-cmd') ?? undefined,
77517
77600
  arg: pe.getAttribute('data-arg') ?? undefined,
@@ -77553,7 +77636,11 @@ _a = TxtStage, _TxtStage_htmTxt = new WeakMap(), _TxtStage_cntTxt = new WeakMap(
77553
77636
  });
77554
77637
  const end = () => {
77555
77638
  old.parentElement.removeChild(old);
77556
- __classPrivateFieldGet(this, _TxtStage_cntTxt, "f").removeChildren().forEach(c => c.destroy());
77639
+ __classPrivateFieldGet(this, _TxtStage_cntTxt, "f").removeChildren().forEach(c => {
77640
+ if (c instanceof pixi_js_1.Container)
77641
+ __classPrivateFieldGet(TxtStage, _a, "f", _TxtStage_evtMng).unButton(c);
77642
+ c.destroy();
77643
+ });
77557
77644
  };
77558
77645
  if (sum_wait === 0) {
77559
77646
  __classPrivateFieldGet(this, _TxtStage_htmTxt, "f").textContent = '';
@@ -81675,13 +81762,7 @@ class Manager extends component_emitter_1.Emitter {
81675
81762
  debug("disconnect");
81676
81763
  this.skipReconnect = true;
81677
81764
  this._reconnecting = false;
81678
- if ("opening" === this._readyState) {
81679
- // `onclose` will not fire because
81680
- // an open event never happened
81681
- this.cleanup();
81682
- }
81683
- this.backoff.reset();
81684
- this._readyState = "closed";
81765
+ this.onclose("forced close");
81685
81766
  if (this.engine)
81686
81767
  this.engine.close();
81687
81768
  }
@@ -81699,7 +81780,7 @@ class Manager extends component_emitter_1.Emitter {
81699
81780
  * @private
81700
81781
  */
81701
81782
  onclose(reason) {
81702
- debug("onclose");
81783
+ debug("closed due to %s", reason);
81703
81784
  this.cleanup();
81704
81785
  this.backoff.reset();
81705
81786
  this._readyState = "closed";
@@ -81922,9 +82003,11 @@ class Socket extends component_emitter_1.Emitter {
81922
82003
  packet.options.compress = this.flags.compress !== false;
81923
82004
  // event ack callback
81924
82005
  if ("function" === typeof args[args.length - 1]) {
81925
- debug("emitting packet with ack id %d", this.ids);
81926
- this.acks[this.ids] = args.pop();
81927
- packet.id = this.ids++;
82006
+ const id = this.ids++;
82007
+ debug("emitting packet with ack id %d", id);
82008
+ const ack = args.pop();
82009
+ this._registerAckCallback(id, ack);
82010
+ packet.id = id;
81928
82011
  }
81929
82012
  const isTransportWritable = this.io.engine &&
81930
82013
  this.io.engine.transport &&
@@ -81942,6 +82025,33 @@ class Socket extends component_emitter_1.Emitter {
81942
82025
  this.flags = {};
81943
82026
  return this;
81944
82027
  }
82028
+ /**
82029
+ * @private
82030
+ */
82031
+ _registerAckCallback(id, ack) {
82032
+ const timeout = this.flags.timeout;
82033
+ if (timeout === undefined) {
82034
+ this.acks[id] = ack;
82035
+ return;
82036
+ }
82037
+ // @ts-ignore
82038
+ const timer = this.io.setTimeoutFn(() => {
82039
+ delete this.acks[id];
82040
+ for (let i = 0; i < this.sendBuffer.length; i++) {
82041
+ if (this.sendBuffer[i].id === id) {
82042
+ debug("removing packet with ack id %d from the buffer", id);
82043
+ this.sendBuffer.splice(i, 1);
82044
+ }
82045
+ }
82046
+ debug("event with ack id %d has timed out after %d ms", id, timeout);
82047
+ ack.call(this, new Error("operation has timed out"));
82048
+ }, timeout);
82049
+ this.acks[id] = (...args) => {
82050
+ // @ts-ignore
82051
+ this.io.clearTimeoutFn(timer);
82052
+ ack.apply(this, [null, ...args]);
82053
+ };
82054
+ }
81945
82055
  /**
81946
82056
  * Sends a packet.
81947
82057
  *
@@ -82028,6 +82138,7 @@ class Socket extends component_emitter_1.Emitter {
82028
82138
  this.ondisconnect();
82029
82139
  break;
82030
82140
  case socket_io_parser_1.PacketType.CONNECT_ERROR:
82141
+ this.destroy();
82031
82142
  const err = new Error(packet.data.message);
82032
82143
  // @ts-ignore
82033
82144
  err.data = packet.data.data;
@@ -82201,6 +82312,25 @@ class Socket extends component_emitter_1.Emitter {
82201
82312
  this.flags.volatile = true;
82202
82313
  return this;
82203
82314
  }
82315
+ /**
82316
+ * Sets a modifier for a subsequent event emission that the callback will be called with an error when the
82317
+ * given number of milliseconds have elapsed without an acknowledgement from the server:
82318
+ *
82319
+ * ```
82320
+ * socket.timeout(5000).emit("my-event", (err) => {
82321
+ * if (err) {
82322
+ * // the server did not acknowledge the event in the given delay
82323
+ * }
82324
+ * });
82325
+ * ```
82326
+ *
82327
+ * @returns self
82328
+ * @public
82329
+ */
82330
+ timeout(timeout) {
82331
+ this.flags.timeout = timeout;
82332
+ return this;
82333
+ }
82204
82334
  /**
82205
82335
  * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
82206
82336
  * callback.