ice-render 1.4.0 → 1.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.
@@ -10,14 +10,6 @@ import EventBus from '../event/EventBus.mjs';
10
10
  import ICEEventTarget from '../event/ICEEventTarget.mjs';
11
11
  import ICEBoundingBox from '../geometry/ICEBoundingBox.mjs';
12
12
  import ICE from '../ICE.mjs';
13
- /**
14
- * @class ICEComponent
15
- *
16
- * 最顶级的抽象类,Canvas 内部所有可见的组件都是它的子类。
17
- *
18
- * @abstract
19
- * @author 大漠穷秋<damoqiongqiu@126.com>
20
- */
21
13
  declare abstract class ICEComponent extends ICEEventTarget {
22
14
  ice: ICE;
23
15
  root: any;
@@ -10,14 +10,6 @@ import EventBus from '../event/EventBus';
10
10
  import ICEEventTarget from '../event/ICEEventTarget';
11
11
  import ICEBoundingBox from '../geometry/ICEBoundingBox';
12
12
  import ICE from '../ICE';
13
- /**
14
- * @class ICEComponent
15
- *
16
- * 最顶级的抽象类,Canvas 内部所有可见的组件都是它的子类。
17
- *
18
- * @abstract
19
- * @author 大漠穷秋<damoqiongqiu@126.com>
20
- */
21
13
  declare abstract class ICEComponent extends ICEEventTarget {
22
14
  ice: ICE;
23
15
  root: any;
@@ -79,6 +79,16 @@ declare class ICEGroup extends ICERect {
79
79
  */
80
80
  addChild(child: ICEComponent, markDirty?: boolean): void;
81
81
  addChildren(arr: Array<ICEComponent>): void;
82
+ /**
83
+ * 把某个组件迁移到本容器下(**不销毁**它)。
84
+ *
85
+ * 为什么需要单独的 API:`removeChild()` 末尾会调用 `child.destory()`(清事件、清子节点),
86
+ * 所以「先 removeChild 再 addChild」式的重父级会把组件连同内部子树一起毁掉
87
+ * (BPMN 池/泳道里嵌节点时就踩到这个坑:标题、角标全没了)。
88
+ * 本方法只从旧父级的 childNodes / 去重集合里摘除,再挂到本容器,组件本体与子树保持完好。
89
+ * **坐标不换算**:调用方若要保持世界位置,请自行换算 left/top。
90
+ */
91
+ adoptChild(child: ICEComponent, markDirty?: boolean): void;
82
92
  removeChild(child: ICEComponent, markDirty?: boolean): void;
83
93
  removeChildren(arr: Array<ICEComponent>): void;
84
94
  /**
@@ -79,6 +79,16 @@ declare class ICEGroup extends ICERect {
79
79
  */
80
80
  addChild(child: ICEComponent, markDirty?: boolean): void;
81
81
  addChildren(arr: Array<ICEComponent>): void;
82
+ /**
83
+ * 把某个组件迁移到本容器下(**不销毁**它)。
84
+ *
85
+ * 为什么需要单独的 API:`removeChild()` 末尾会调用 `child.destory()`(清事件、清子节点),
86
+ * 所以「先 removeChild 再 addChild」式的重父级会把组件连同内部子树一起毁掉
87
+ * (BPMN 池/泳道里嵌节点时就踩到这个坑:标题、角标全没了)。
88
+ * 本方法只从旧父级的 childNodes / 去重集合里摘除,再挂到本容器,组件本体与子树保持完好。
89
+ * **坐标不换算**:调用方若要保持世界位置,请自行换算 left/top。
90
+ */
91
+ adoptChild(child: ICEComponent, markDirty?: boolean): void;
82
92
  removeChild(child: ICEComponent, markDirty?: boolean): void;
83
93
  removeChildren(arr: Array<ICEComponent>): void;
84
94
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "大漠穷秋",
3
3
  "name": "ice-render",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "description": "A canvas engine for interactive graphics.",
6
6
  "repository": {
7
7
  "type": "git",