rendx-engine 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.cjs CHANGED
@@ -477,7 +477,7 @@ getEmitter_fn = function() {
477
477
  };
478
478
 
479
479
  // src/core/graphics.ts
480
- var _nameMap, _classlist, _Graphics_instances, removeFromNameMap_fn, updateMat2d_fn, updateWorldMatrix_fn, updateEZ_fn;
480
+ var _nameMap, _classlist, _Graphics_instances, removeFromNameMap_fn, inheritState_fn, updateMat2d_fn, updateWorldMatrix_fn, updateEZ_fn;
481
481
  var Graphics = class extends EventTarget {
482
482
  constructor() {
483
483
  super(...arguments);
@@ -593,6 +593,7 @@ var Graphics = class extends EventTarget {
593
593
  this.children.push(child);
594
594
  if (__privateGet(this, _nameMap).has(child.name)) throw new Error(`The name "${child.name}" is already used.`);
595
595
  if (child.name) __privateGet(this, _nameMap).set(child.name, child);
596
+ __privateMethod(this, _Graphics_instances, inheritState_fn).call(this, child);
596
597
  this.setDirty(true);
597
598
  return this;
598
599
  }
@@ -601,6 +602,7 @@ var Graphics = class extends EventTarget {
601
602
  child.parent = this;
602
603
  this.children.unshift(child);
603
604
  __privateMethod(this, _Graphics_instances, removeFromNameMap_fn).call(this, child);
605
+ __privateMethod(this, _Graphics_instances, inheritState_fn).call(this, child);
604
606
  this.setDirty(true);
605
607
  return this;
606
608
  }
@@ -610,6 +612,7 @@ var Graphics = class extends EventTarget {
610
612
  const node = this.children[index];
611
613
  this.children.splice(index, 1);
612
614
  __privateMethod(this, _Graphics_instances, removeFromNameMap_fn).call(this, node);
615
+ node.parent = null;
613
616
  this.setDirty(true);
614
617
  }
615
618
  return this;
@@ -796,8 +799,9 @@ var Graphics = class extends EventTarget {
796
799
  }
797
800
  /** 检查是否需要重绘(自身或子树有脏标记/更新标记) */
798
801
  sign() {
802
+ if (this.dirty) return true;
799
803
  if (!this.display) return false;
800
- if (this.dirty || this.needUpdate || this.worldMatrixNeedUpdate) return true;
804
+ if (this.needUpdate || this.worldMatrixNeedUpdate) return true;
801
805
  for (let i = 0; i < this.children.length; i++) if (this.children[i].sign()) return true;
802
806
  return false;
803
807
  }
@@ -843,6 +847,22 @@ _Graphics_instances = new WeakSet();
843
847
  removeFromNameMap_fn = function(g) {
844
848
  if (__privateGet(this, _nameMap).has(g.name)) __privateGet(this, _nameMap).delete(g.name);
845
849
  };
850
+ /**
851
+ * 将父节点的可继承状态(visible / display / pointerEvents)传播给新增子节点。
852
+ * 模拟 DOM 中 CSS 继承属性的行为:
853
+ * - 父级 pointer-events: none → 子级默认继承 none,除非子级显式覆盖
854
+ * - 父级 visibility: hidden → 同上
855
+ * - 父级 display: none → 整棵子树不渲染
856
+ *
857
+ * 使用 bySelf=false 调用,尊重子节点的 autoX 标记:
858
+ * - autoX=true(默认)→ 接受父级值
859
+ * - autoX=false(子节点显式设置过)→ 保持自身值不变
860
+ */
861
+ inheritState_fn = function(child) {
862
+ if (!this.visible) child.setVisible(false, false);
863
+ if (!this.display) child.setDisplay(false, false);
864
+ if (!this.pointerEvents) child.setPointerEvents(false, false);
865
+ };
846
866
  updateMat2d_fn = function() {
847
867
  if (!this.needUpdate) return;
848
868
  import_gl_matrix.mat2d.identity(this.matrix);
@@ -1200,7 +1220,7 @@ var Scene = class extends Graphics {
1200
1220
  });
1201
1221
  }
1202
1222
  queue.sort((a, b) => a.ez - b.ez);
1203
- this.setDirty(false);
1223
+ this.dirty = false;
1204
1224
  __privateSet(this, _queue, queue);
1205
1225
  }
1206
1226
  return __privateGet(this, _queue);
@@ -1252,7 +1272,7 @@ var Group = class extends Graphics {
1252
1272
 
1253
1273
  // src/scene/node.ts
1254
1274
  var import_gl_matrix3 = require("gl-matrix");
1255
- var import_rendx_bounding15 = require("rendx-bounding");
1275
+ var import_rendx_bounding16 = require("rendx-bounding");
1256
1276
 
1257
1277
  // src/shapes/symbol.ts
1258
1278
  var import_rendx_bounding2 = require("rendx-bounding");
@@ -1649,6 +1669,8 @@ var ArcShape = class extends Shape {
1649
1669
  };
1650
1670
 
1651
1671
  // src/shapes/path.ts
1672
+ var import_rendx_bounding9 = require("rendx-bounding");
1673
+ var import_rendx_path9 = require("rendx-path");
1652
1674
  var PathShape = class extends Shape {
1653
1675
  constructor() {
1654
1676
  super(...arguments);
@@ -1657,11 +1679,19 @@ var PathShape = class extends Shape {
1657
1679
  from(d) {
1658
1680
  this.d = d;
1659
1681
  this.p = null;
1682
+ if (this.autoNeedUpdate) this.needUpdate = true;
1683
+ }
1684
+ box() {
1685
+ const result = (0, import_rendx_path9.pathBBox)(this.d);
1686
+ if (result) {
1687
+ this.boundingBox = import_rendx_bounding9.BoundingBox.fromPoints(result[0], result[1], result[2], result[3]);
1688
+ }
1689
+ return this.boundingBox;
1660
1690
  }
1661
1691
  };
1662
1692
 
1663
1693
  // src/shapes/text.ts
1664
- var import_rendx_bounding9 = require("rendx-bounding");
1694
+ var import_rendx_bounding10 = require("rendx-bounding");
1665
1695
  var _attrs;
1666
1696
  var _TextShape = class _TextShape extends Shape {
1667
1697
  constructor() {
@@ -1694,7 +1724,7 @@ var _TextShape = class _TextShape extends Shape {
1694
1724
  if (measureFn && this.text) {
1695
1725
  const bb = measureFn(this.text, __privateGet(this, _attrs));
1696
1726
  if (bb) {
1697
- this.boundingBox = import_rendx_bounding9.BoundingBox.fromRect(this.x, this.y - bb.height, bb.width, bb.height);
1727
+ this.boundingBox = import_rendx_bounding10.BoundingBox.fromRect(this.x, this.y - bb.height, bb.width, bb.height);
1698
1728
  return this.boundingBox;
1699
1729
  }
1700
1730
  }
@@ -1725,7 +1755,7 @@ _TextShape.defaultMeasure = null;
1725
1755
  var TextShape = _TextShape;
1726
1756
 
1727
1757
  // src/shapes/line.ts
1728
- var import_rendx_bounding10 = require("rendx-bounding");
1758
+ var import_rendx_bounding11 = require("rendx-bounding");
1729
1759
  var LineShape = class extends Shape {
1730
1760
  constructor() {
1731
1761
  super(...arguments);
@@ -1757,13 +1787,13 @@ var LineShape = class extends Shape {
1757
1787
  }
1758
1788
  box() {
1759
1789
  const { x1, y1, x2, y2 } = this;
1760
- this.boundingBox = import_rendx_bounding10.BoundingBox.fromPoints(x1, y1, x2, y2);
1790
+ this.boundingBox = import_rendx_bounding11.BoundingBox.fromPoints(x1, y1, x2, y2);
1761
1791
  return this.boundingBox;
1762
1792
  }
1763
1793
  };
1764
1794
 
1765
1795
  // src/shapes/rect.ts
1766
- var import_rendx_bounding11 = require("rendx-bounding");
1796
+ var import_rendx_bounding12 = require("rendx-bounding");
1767
1797
  var RectShape = class extends Shape {
1768
1798
  constructor() {
1769
1799
  super(...arguments);
@@ -1793,13 +1823,13 @@ var RectShape = class extends Shape {
1793
1823
  }
1794
1824
  box() {
1795
1825
  const { x, y, width, height } = this;
1796
- this.boundingBox = import_rendx_bounding11.BoundingBox.fromRect(x, y, width, height);
1826
+ this.boundingBox = import_rendx_bounding12.BoundingBox.fromRect(x, y, width, height);
1797
1827
  return this.boundingBox;
1798
1828
  }
1799
1829
  };
1800
1830
 
1801
1831
  // src/shapes/circle.ts
1802
- var import_rendx_bounding12 = require("rendx-bounding");
1832
+ var import_rendx_bounding13 = require("rendx-bounding");
1803
1833
  var CircleShape = class extends Shape {
1804
1834
  constructor() {
1805
1835
  super(...arguments);
@@ -1826,13 +1856,13 @@ var CircleShape = class extends Shape {
1826
1856
  }
1827
1857
  box() {
1828
1858
  const { cx, cy, r } = this;
1829
- this.boundingBox = import_rendx_bounding12.BoundingBox.fromPoints(cx - r, cy - r, cx + r, cy + r);
1859
+ this.boundingBox = import_rendx_bounding13.BoundingBox.fromPoints(cx - r, cy - r, cx + r, cy + r);
1830
1860
  return this.boundingBox;
1831
1861
  }
1832
1862
  };
1833
1863
 
1834
1864
  // src/shapes/image.ts
1835
- var import_rendx_bounding13 = require("rendx-bounding");
1865
+ var import_rendx_bounding14 = require("rendx-bounding");
1836
1866
  var ImageShape = class extends Shape {
1837
1867
  constructor() {
1838
1868
  super(...arguments);
@@ -1876,15 +1906,15 @@ var ImageShape = class extends Shape {
1876
1906
  }
1877
1907
  box() {
1878
1908
  const { x, y, width, height } = this;
1879
- this.boundingBox = import_rendx_bounding13.BoundingBox.fromRect(x, y, width, height);
1909
+ this.boundingBox = import_rendx_bounding14.BoundingBox.fromRect(x, y, width, height);
1880
1910
  return this.boundingBox;
1881
1911
  }
1882
1912
  };
1883
1913
 
1884
1914
  // src/shapes/rect-buffer.ts
1885
- var import_rendx_bounding14 = require("rendx-bounding");
1915
+ var import_rendx_bounding15 = require("rendx-bounding");
1886
1916
  var import_rendx_shape8 = require("rendx-shape");
1887
- var import_rendx_path9 = require("rendx-path");
1917
+ var import_rendx_path10 = require("rendx-path");
1888
1918
  var RectBufferShape = class extends Shape {
1889
1919
  constructor() {
1890
1920
  super(...arguments);
@@ -1901,7 +1931,7 @@ var RectBufferShape = class extends Shape {
1901
1931
  build() {
1902
1932
  if (!this.needUpdate) return;
1903
1933
  if (this.mode === "render") {
1904
- if (!this.creator) this.creator = new import_rendx_path9.Path();
1934
+ if (!this.creator) this.creator = new import_rendx_path10.Path();
1905
1935
  else this.creator.clear();
1906
1936
  const { buffer } = this;
1907
1937
  for (let i = 0; i < buffer.length; i += 4) {
@@ -1948,7 +1978,7 @@ var RectBufferShape = class extends Shape {
1948
1978
  x1 = Math.max(x1, x + width);
1949
1979
  y1 = Math.max(y1, y + height);
1950
1980
  }
1951
- this.boundingBox = import_rendx_bounding14.BoundingBox.fromPoints(x0, y0, x1, y1);
1981
+ this.boundingBox = import_rendx_bounding15.BoundingBox.fromPoints(x0, y0, x1, y1);
1952
1982
  return this.boundingBox;
1953
1983
  }
1954
1984
  };
@@ -2051,7 +2081,7 @@ var _Node = class _Node extends Graphics {
2051
2081
  if (wx > maxX) maxX = wx;
2052
2082
  if (wy < minY) minY = wy;
2053
2083
  if (wy > maxY) maxY = wy;
2054
- return import_rendx_bounding15.BoundingBox.fromPoints(minX, minY, maxX, maxY);
2084
+ return import_rendx_bounding16.BoundingBox.fromPoints(minX, minY, maxX, maxY);
2055
2085
  }
2056
2086
  /**
2057
2087
  * 命中检测:将屏幕坐标通过逆世界矩阵变换为本地坐标,然后检测是否命中
@@ -2213,7 +2243,7 @@ var Layer = class extends Group {
2213
2243
  if (node.type === 3) queue.push(node);
2214
2244
  });
2215
2245
  queue.sort((a, b) => a.ez - b.ez);
2216
- this.setDirty(false);
2246
+ this.dirty = false;
2217
2247
  __privateSet(this, _queue2, queue);
2218
2248
  }
2219
2249
  return __privateGet(this, _queue2);
@@ -2228,6 +2258,7 @@ var Layer = class extends Group {
2228
2258
  if (this.isEventLayer) return;
2229
2259
  this.update();
2230
2260
  const queue = this.getQueue();
2261
+ this.setDirty(false);
2231
2262
  this.renderer.draw(this.culling ? __privateMethod(this, _Layer_instances, cullViewport_fn).call(this, queue) : queue);
2232
2263
  }
2233
2264
  resize(size) {
@@ -2997,6 +3028,26 @@ var _App = class _App {
2997
3028
  plugin.resize?.(width, height);
2998
3029
  }
2999
3030
  }
3031
+ // ========================
3032
+ // Cursor
3033
+ // ========================
3034
+ /**
3035
+ * 设置容器的鼠标光标样式。
3036
+ * @param cursor - CSS cursor 值(如 'pointer'、'crosshair'、'grab')
3037
+ */
3038
+ setCursor(cursor) {
3039
+ if (__privateGet(this, _container)) {
3040
+ __privateGet(this, _container).style.cursor = cursor;
3041
+ }
3042
+ }
3043
+ /**
3044
+ * 重置鼠标光标为默认值。
3045
+ */
3046
+ resetCursor() {
3047
+ if (__privateGet(this, _container)) {
3048
+ __privateGet(this, _container).style.cursor = "";
3049
+ }
3050
+ }
3000
3051
  clear() {
3001
3052
  if (__privateGet(this, _rafId) !== null) {
3002
3053
  cancelAnimationFrame(__privateGet(this, _rafId));
package/dist/main.d.cts CHANGED
@@ -618,6 +618,7 @@ declare class ArcShape extends Shape {
618
618
  declare class PathShape extends Shape {
619
619
  command: "path";
620
620
  from(d: string): void;
621
+ box(): BoundingBox;
621
622
  }
622
623
 
623
624
  /**
@@ -946,6 +947,15 @@ declare class App {
946
947
  * @param height - 新高度(像素)
947
948
  */
948
949
  resize(width: number, height: number): void;
950
+ /**
951
+ * 设置容器的鼠标光标样式。
952
+ * @param cursor - CSS cursor 值(如 'pointer'、'crosshair'、'grab')
953
+ */
954
+ setCursor(cursor: string): void;
955
+ /**
956
+ * 重置鼠标光标为默认值。
957
+ */
958
+ resetCursor(): void;
949
959
  clear(): void;
950
960
  dispose(): void;
951
961
  /** 将所有渲染层合成到一个 Canvas 上并返回 */
package/dist/main.d.ts CHANGED
@@ -618,6 +618,7 @@ declare class ArcShape extends Shape {
618
618
  declare class PathShape extends Shape {
619
619
  command: "path";
620
620
  from(d: string): void;
621
+ box(): BoundingBox;
621
622
  }
622
623
 
623
624
  /**
@@ -946,6 +947,15 @@ declare class App {
946
947
  * @param height - 新高度(像素)
947
948
  */
948
949
  resize(width: number, height: number): void;
950
+ /**
951
+ * 设置容器的鼠标光标样式。
952
+ * @param cursor - CSS cursor 值(如 'pointer'、'crosshair'、'grab')
953
+ */
954
+ setCursor(cursor: string): void;
955
+ /**
956
+ * 重置鼠标光标为默认值。
957
+ */
958
+ resetCursor(): void;
949
959
  clear(): void;
950
960
  dispose(): void;
951
961
  /** 将所有渲染层合成到一个 Canvas 上并返回 */
package/dist/main.js CHANGED
@@ -403,7 +403,7 @@ getEmitter_fn = function() {
403
403
  };
404
404
 
405
405
  // src/core/graphics.ts
406
- var _nameMap, _classlist, _Graphics_instances, removeFromNameMap_fn, updateMat2d_fn, updateWorldMatrix_fn, updateEZ_fn;
406
+ var _nameMap, _classlist, _Graphics_instances, removeFromNameMap_fn, inheritState_fn, updateMat2d_fn, updateWorldMatrix_fn, updateEZ_fn;
407
407
  var Graphics = class extends EventTarget {
408
408
  constructor() {
409
409
  super(...arguments);
@@ -519,6 +519,7 @@ var Graphics = class extends EventTarget {
519
519
  this.children.push(child);
520
520
  if (__privateGet(this, _nameMap).has(child.name)) throw new Error(`The name "${child.name}" is already used.`);
521
521
  if (child.name) __privateGet(this, _nameMap).set(child.name, child);
522
+ __privateMethod(this, _Graphics_instances, inheritState_fn).call(this, child);
522
523
  this.setDirty(true);
523
524
  return this;
524
525
  }
@@ -527,6 +528,7 @@ var Graphics = class extends EventTarget {
527
528
  child.parent = this;
528
529
  this.children.unshift(child);
529
530
  __privateMethod(this, _Graphics_instances, removeFromNameMap_fn).call(this, child);
531
+ __privateMethod(this, _Graphics_instances, inheritState_fn).call(this, child);
530
532
  this.setDirty(true);
531
533
  return this;
532
534
  }
@@ -536,6 +538,7 @@ var Graphics = class extends EventTarget {
536
538
  const node = this.children[index];
537
539
  this.children.splice(index, 1);
538
540
  __privateMethod(this, _Graphics_instances, removeFromNameMap_fn).call(this, node);
541
+ node.parent = null;
539
542
  this.setDirty(true);
540
543
  }
541
544
  return this;
@@ -722,8 +725,9 @@ var Graphics = class extends EventTarget {
722
725
  }
723
726
  /** 检查是否需要重绘(自身或子树有脏标记/更新标记) */
724
727
  sign() {
728
+ if (this.dirty) return true;
725
729
  if (!this.display) return false;
726
- if (this.dirty || this.needUpdate || this.worldMatrixNeedUpdate) return true;
730
+ if (this.needUpdate || this.worldMatrixNeedUpdate) return true;
727
731
  for (let i = 0; i < this.children.length; i++) if (this.children[i].sign()) return true;
728
732
  return false;
729
733
  }
@@ -769,6 +773,22 @@ _Graphics_instances = new WeakSet();
769
773
  removeFromNameMap_fn = function(g) {
770
774
  if (__privateGet(this, _nameMap).has(g.name)) __privateGet(this, _nameMap).delete(g.name);
771
775
  };
776
+ /**
777
+ * 将父节点的可继承状态(visible / display / pointerEvents)传播给新增子节点。
778
+ * 模拟 DOM 中 CSS 继承属性的行为:
779
+ * - 父级 pointer-events: none → 子级默认继承 none,除非子级显式覆盖
780
+ * - 父级 visibility: hidden → 同上
781
+ * - 父级 display: none → 整棵子树不渲染
782
+ *
783
+ * 使用 bySelf=false 调用,尊重子节点的 autoX 标记:
784
+ * - autoX=true(默认)→ 接受父级值
785
+ * - autoX=false(子节点显式设置过)→ 保持自身值不变
786
+ */
787
+ inheritState_fn = function(child) {
788
+ if (!this.visible) child.setVisible(false, false);
789
+ if (!this.display) child.setDisplay(false, false);
790
+ if (!this.pointerEvents) child.setPointerEvents(false, false);
791
+ };
772
792
  updateMat2d_fn = function() {
773
793
  if (!this.needUpdate) return;
774
794
  mat2d.identity(this.matrix);
@@ -1126,7 +1146,7 @@ var Scene = class extends Graphics {
1126
1146
  });
1127
1147
  }
1128
1148
  queue.sort((a, b) => a.ez - b.ez);
1129
- this.setDirty(false);
1149
+ this.dirty = false;
1130
1150
  __privateSet(this, _queue, queue);
1131
1151
  }
1132
1152
  return __privateGet(this, _queue);
@@ -1178,7 +1198,7 @@ var Group = class extends Graphics {
1178
1198
 
1179
1199
  // src/scene/node.ts
1180
1200
  import { mat2d as mat2d3, vec2 as vec23 } from "gl-matrix";
1181
- import { BoundingBox as BoundingBox15 } from "rendx-bounding";
1201
+ import { BoundingBox as BoundingBox16 } from "rendx-bounding";
1182
1202
 
1183
1203
  // src/shapes/symbol.ts
1184
1204
  import { BoundingBox as BoundingBox2 } from "rendx-bounding";
@@ -1575,6 +1595,8 @@ var ArcShape = class extends Shape {
1575
1595
  };
1576
1596
 
1577
1597
  // src/shapes/path.ts
1598
+ import { BoundingBox as BoundingBox9 } from "rendx-bounding";
1599
+ import { pathBBox } from "rendx-path";
1578
1600
  var PathShape = class extends Shape {
1579
1601
  constructor() {
1580
1602
  super(...arguments);
@@ -1583,11 +1605,19 @@ var PathShape = class extends Shape {
1583
1605
  from(d) {
1584
1606
  this.d = d;
1585
1607
  this.p = null;
1608
+ if (this.autoNeedUpdate) this.needUpdate = true;
1609
+ }
1610
+ box() {
1611
+ const result = pathBBox(this.d);
1612
+ if (result) {
1613
+ this.boundingBox = BoundingBox9.fromPoints(result[0], result[1], result[2], result[3]);
1614
+ }
1615
+ return this.boundingBox;
1586
1616
  }
1587
1617
  };
1588
1618
 
1589
1619
  // src/shapes/text.ts
1590
- import { BoundingBox as BoundingBox9 } from "rendx-bounding";
1620
+ import { BoundingBox as BoundingBox10 } from "rendx-bounding";
1591
1621
  var _attrs;
1592
1622
  var _TextShape = class _TextShape extends Shape {
1593
1623
  constructor() {
@@ -1620,7 +1650,7 @@ var _TextShape = class _TextShape extends Shape {
1620
1650
  if (measureFn && this.text) {
1621
1651
  const bb = measureFn(this.text, __privateGet(this, _attrs));
1622
1652
  if (bb) {
1623
- this.boundingBox = BoundingBox9.fromRect(this.x, this.y - bb.height, bb.width, bb.height);
1653
+ this.boundingBox = BoundingBox10.fromRect(this.x, this.y - bb.height, bb.width, bb.height);
1624
1654
  return this.boundingBox;
1625
1655
  }
1626
1656
  }
@@ -1651,7 +1681,7 @@ _TextShape.defaultMeasure = null;
1651
1681
  var TextShape = _TextShape;
1652
1682
 
1653
1683
  // src/shapes/line.ts
1654
- import { BoundingBox as BoundingBox10 } from "rendx-bounding";
1684
+ import { BoundingBox as BoundingBox11 } from "rendx-bounding";
1655
1685
  var LineShape = class extends Shape {
1656
1686
  constructor() {
1657
1687
  super(...arguments);
@@ -1683,13 +1713,13 @@ var LineShape = class extends Shape {
1683
1713
  }
1684
1714
  box() {
1685
1715
  const { x1, y1, x2, y2 } = this;
1686
- this.boundingBox = BoundingBox10.fromPoints(x1, y1, x2, y2);
1716
+ this.boundingBox = BoundingBox11.fromPoints(x1, y1, x2, y2);
1687
1717
  return this.boundingBox;
1688
1718
  }
1689
1719
  };
1690
1720
 
1691
1721
  // src/shapes/rect.ts
1692
- import { BoundingBox as BoundingBox11 } from "rendx-bounding";
1722
+ import { BoundingBox as BoundingBox12 } from "rendx-bounding";
1693
1723
  var RectShape = class extends Shape {
1694
1724
  constructor() {
1695
1725
  super(...arguments);
@@ -1719,13 +1749,13 @@ var RectShape = class extends Shape {
1719
1749
  }
1720
1750
  box() {
1721
1751
  const { x, y, width, height } = this;
1722
- this.boundingBox = BoundingBox11.fromRect(x, y, width, height);
1752
+ this.boundingBox = BoundingBox12.fromRect(x, y, width, height);
1723
1753
  return this.boundingBox;
1724
1754
  }
1725
1755
  };
1726
1756
 
1727
1757
  // src/shapes/circle.ts
1728
- import { BoundingBox as BoundingBox12 } from "rendx-bounding";
1758
+ import { BoundingBox as BoundingBox13 } from "rendx-bounding";
1729
1759
  var CircleShape = class extends Shape {
1730
1760
  constructor() {
1731
1761
  super(...arguments);
@@ -1752,13 +1782,13 @@ var CircleShape = class extends Shape {
1752
1782
  }
1753
1783
  box() {
1754
1784
  const { cx, cy, r } = this;
1755
- this.boundingBox = BoundingBox12.fromPoints(cx - r, cy - r, cx + r, cy + r);
1785
+ this.boundingBox = BoundingBox13.fromPoints(cx - r, cy - r, cx + r, cy + r);
1756
1786
  return this.boundingBox;
1757
1787
  }
1758
1788
  };
1759
1789
 
1760
1790
  // src/shapes/image.ts
1761
- import { BoundingBox as BoundingBox13 } from "rendx-bounding";
1791
+ import { BoundingBox as BoundingBox14 } from "rendx-bounding";
1762
1792
  var ImageShape = class extends Shape {
1763
1793
  constructor() {
1764
1794
  super(...arguments);
@@ -1802,13 +1832,13 @@ var ImageShape = class extends Shape {
1802
1832
  }
1803
1833
  box() {
1804
1834
  const { x, y, width, height } = this;
1805
- this.boundingBox = BoundingBox13.fromRect(x, y, width, height);
1835
+ this.boundingBox = BoundingBox14.fromRect(x, y, width, height);
1806
1836
  return this.boundingBox;
1807
1837
  }
1808
1838
  };
1809
1839
 
1810
1840
  // src/shapes/rect-buffer.ts
1811
- import { BoundingBox as BoundingBox14 } from "rendx-bounding";
1841
+ import { BoundingBox as BoundingBox15 } from "rendx-bounding";
1812
1842
  import { createShape as createShape7 } from "rendx-shape";
1813
1843
  import { Path as Path9 } from "rendx-path";
1814
1844
  var RectBufferShape = class extends Shape {
@@ -1874,7 +1904,7 @@ var RectBufferShape = class extends Shape {
1874
1904
  x1 = Math.max(x1, x + width);
1875
1905
  y1 = Math.max(y1, y + height);
1876
1906
  }
1877
- this.boundingBox = BoundingBox14.fromPoints(x0, y0, x1, y1);
1907
+ this.boundingBox = BoundingBox15.fromPoints(x0, y0, x1, y1);
1878
1908
  return this.boundingBox;
1879
1909
  }
1880
1910
  };
@@ -1977,7 +2007,7 @@ var _Node = class _Node extends Graphics {
1977
2007
  if (wx > maxX) maxX = wx;
1978
2008
  if (wy < minY) minY = wy;
1979
2009
  if (wy > maxY) maxY = wy;
1980
- return BoundingBox15.fromPoints(minX, minY, maxX, maxY);
2010
+ return BoundingBox16.fromPoints(minX, minY, maxX, maxY);
1981
2011
  }
1982
2012
  /**
1983
2013
  * 命中检测:将屏幕坐标通过逆世界矩阵变换为本地坐标,然后检测是否命中
@@ -2139,7 +2169,7 @@ var Layer = class extends Group {
2139
2169
  if (node.type === 3) queue.push(node);
2140
2170
  });
2141
2171
  queue.sort((a, b) => a.ez - b.ez);
2142
- this.setDirty(false);
2172
+ this.dirty = false;
2143
2173
  __privateSet(this, _queue2, queue);
2144
2174
  }
2145
2175
  return __privateGet(this, _queue2);
@@ -2154,6 +2184,7 @@ var Layer = class extends Group {
2154
2184
  if (this.isEventLayer) return;
2155
2185
  this.update();
2156
2186
  const queue = this.getQueue();
2187
+ this.setDirty(false);
2157
2188
  this.renderer.draw(this.culling ? __privateMethod(this, _Layer_instances, cullViewport_fn).call(this, queue) : queue);
2158
2189
  }
2159
2190
  resize(size) {
@@ -2923,6 +2954,26 @@ var _App = class _App {
2923
2954
  plugin.resize?.(width, height);
2924
2955
  }
2925
2956
  }
2957
+ // ========================
2958
+ // Cursor
2959
+ // ========================
2960
+ /**
2961
+ * 设置容器的鼠标光标样式。
2962
+ * @param cursor - CSS cursor 值(如 'pointer'、'crosshair'、'grab')
2963
+ */
2964
+ setCursor(cursor) {
2965
+ if (__privateGet(this, _container)) {
2966
+ __privateGet(this, _container).style.cursor = cursor;
2967
+ }
2968
+ }
2969
+ /**
2970
+ * 重置鼠标光标为默认值。
2971
+ */
2972
+ resetCursor() {
2973
+ if (__privateGet(this, _container)) {
2974
+ __privateGet(this, _container).style.cursor = "";
2975
+ }
2976
+ }
2926
2977
  clear() {
2927
2978
  if (__privateGet(this, _rafId) !== null) {
2928
2979
  cancelAnimationFrame(__privateGet(this, _rafId));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rendx-engine",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "2D scene graph engine with animation, events, and plugin system",
5
5
  "license": "MIT",
6
6
  "author": "wei.liang (https://github.com/weiliang0121)",
@@ -36,8 +36,8 @@
36
36
  "rendx-canvas": "^0.1.1",
37
37
  "rendx-ease": "^0.1.1",
38
38
  "rendx-interpolate": "^0.1.1",
39
- "rendx-path": "^0.1.1",
40
- "rendx-shape": "^0.1.1",
39
+ "rendx-path": "^0.2.0",
40
+ "rendx-shape": "^0.1.2",
41
41
  "rendx-svg": "^0.1.1",
42
42
  "rendx-core": "^0.1.1"
43
43
  },