@meta2d/core 1.0.47 → 1.0.48

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meta2d/core",
3
- "version": "1.0.47",
3
+ "version": "1.0.48",
4
4
  "description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -229,6 +229,7 @@ export declare class Canvas {
229
229
  onScroll: () => void;
230
230
  calibrateMouse: (pt: Point) => Point;
231
231
  clearHover(): void;
232
+ private getContainerHover;
232
233
  private getHover;
233
234
  private inPens;
234
235
  private dockInAnchor;
@@ -1360,6 +1360,8 @@ var Canvas = /** @class */ (function () {
1360
1360
  }
1361
1361
  }
1362
1362
  _this.movePens(e);
1363
+ //图元是否进入容器图元
1364
+ _this.getContainerHover(e);
1363
1365
  return;
1364
1366
  }
1365
1367
  }
@@ -1714,6 +1716,27 @@ var Canvas = /** @class */ (function () {
1714
1716
  pt.y -= _this.store.data.y;
1715
1717
  return pt;
1716
1718
  };
1719
+ this.getContainerHover = function (pt) {
1720
+ var _a;
1721
+ if (_this.dragRect) {
1722
+ return;
1723
+ }
1724
+ var containerPens = _this.store.data.pens.filter(function (pen) { var _a; return pen.container || ((_a = _this.store.options.containerShapes) === null || _a === void 0 ? void 0 : _a.includes(pen.name)); });
1725
+ if (containerPens.length) {
1726
+ for (var i = containerPens.length - 1; i >= 0; --i) {
1727
+ var pen = containerPens[i];
1728
+ if (pen.visible == false ||
1729
+ pen.calculative.inView == false ||
1730
+ pen.locked === LockState.Disable ||
1731
+ pen.calculative.active) {
1732
+ continue;
1733
+ }
1734
+ if (pointInRect(pt, pen.calculative.worldRect)) {
1735
+ (_a = pen === null || pen === void 0 ? void 0 : pen.onMouseMove) === null || _a === void 0 ? void 0 : _a.call(pen, pen, pt);
1736
+ }
1737
+ }
1738
+ }
1739
+ };
1717
1740
  this.getHover = function (pt) {
1718
1741
  var _a, _b;
1719
1742
  if (_this.dragRect) {
@@ -1896,6 +1919,9 @@ var Canvas = /** @class */ (function () {
1896
1919
  else {
1897
1920
  _this.externalElements.style.cursor = _this.store.options.hoverCursor;
1898
1921
  }
1922
+ if (pen.calculative.disabled) {
1923
+ _this.externalElements.style.cursor = 'not-allowed';
1924
+ }
1899
1925
  _this.store.hover = pen;
1900
1926
  _this.store.pointAt = pos.point;
1901
1927
  _this.store.pointAtIndex = pos.i;
@@ -1940,6 +1966,9 @@ var Canvas = /** @class */ (function () {
1940
1966
  else {
1941
1967
  _this.externalElements.style.cursor = _this.store.options.hoverCursor;
1942
1968
  }
1969
+ if (pen.calculative.disabled) {
1970
+ _this.externalElements.style.cursor = 'not-allowed';
1971
+ }
1943
1972
  _this.store.hover = pen;
1944
1973
  _this.initTemplateCanvas([_this.store.hover]);
1945
1974
  hoverType = HoverType.Node;
@@ -2483,7 +2512,8 @@ var Canvas = /** @class */ (function () {
2483
2512
  !_this.store.hover ||
2484
2513
  _this.store.hover.locked ||
2485
2514
  _this.store.hover.externElement ||
2486
- _this.store.hover.disableInput) {
2515
+ _this.store.hover.disableInput ||
2516
+ _this.store.hover.disabled) {
2487
2517
  return;
2488
2518
  }
2489
2519
  if (_this.inputDiv.dataset.penId === pen.id) {
@@ -2761,7 +2791,8 @@ var Canvas = /** @class */ (function () {
2761
2791
  this.setDropdownList = function (search) {
2762
2792
  var e_6, _a;
2763
2793
  _this.clearDropdownList();
2764
- if (!_this.store.data.locked) {
2794
+ var pen = _this.store.pens[_this.inputDiv.dataset.penId];
2795
+ if (!_this.store.data.locked && !['table'].includes(pen.name)) {
2765
2796
  return;
2766
2797
  }
2767
2798
  _this.dropdown.style.display = 'block';
@@ -2770,7 +2801,6 @@ var Canvas = /** @class */ (function () {
2770
2801
  _this.inputRight.style.transform = 'rotate(315deg)';
2771
2802
  _this.inputRight.style.zoom = _this.store.data.scale;
2772
2803
  });
2773
- var pen = _this.store.pens[_this.inputDiv.dataset.penId];
2774
2804
  if (!pen || !pen.dropdownList) {
2775
2805
  _this.dropdown.style.display = 'none';
2776
2806
  _this.inputRight.style.display = 'none';
@@ -6266,6 +6296,10 @@ var Canvas = /** @class */ (function () {
6266
6296
  //根据pens顺序复制
6267
6297
  copyPens.forEach(function (activePen) {
6268
6298
  activePen.copyIndex = _this.store.data.pens.findIndex(function (pen) { return pen.id === activePen.id; });
6299
+ if (activePen.pathId) {
6300
+ //复制svgpath
6301
+ activePen.path = _this.store.data.paths[activePen.pathId];
6302
+ }
6269
6303
  });
6270
6304
  copyPens.sort(function (a, b) {
6271
6305
  return a.copyIndex - b.copyIndex;
@@ -6770,6 +6804,16 @@ var Canvas = /** @class */ (function () {
6770
6804
  }, 300);
6771
6805
  };
6772
6806
  this.inputDiv.oninput = function (e) {
6807
+ var pen = _this.store.pens[_this.inputDiv.dataset.penId];
6808
+ if (pen.inputType === 'number') {
6809
+ var value = e.target.innerText;
6810
+ var numericValue = value.replace(/[^0-9]/g, ''); // 移除非数字字符
6811
+ // 如果输入的值不是纯数字,则替换为纯数字
6812
+ if (value !== numericValue) {
6813
+ e.preventDefault();
6814
+ e.target.innerText = numericValue;
6815
+ }
6816
+ }
6773
6817
  // //无文本时,光标确保居中
6774
6818
  if (navigator.userAgent.includes('Firefox')) {
6775
6819
  if (!e.target.innerText.trim()) {