ice-render 0.0.45 → 1.0.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.
@@ -1,4 +1,3 @@
1
- import ICEEvent from '../../event/ICEEvent';
2
1
  import ICECircle from '../shape/ICECircle';
3
2
  /**
4
3
  * @class ICELinkSlot
@@ -29,39 +28,16 @@ declare class ICELinkSlot extends ICECircle {
29
28
  * @param props
30
29
  */
31
30
  constructor(props?: any);
32
- protected initEvents(): void;
33
31
  /**
34
32
  * @overwrite
35
33
  * @method keyboardEvtHandler 键盘事件处理
36
- * !ICELinkSlot 不响应键盘事件。
34
+ * !ICELinkSlot 不响应键盘事件,覆盖成空实现。
37
35
  * @see {ICEComponent.keyboardEvtHandler}
38
36
  * @param evt
39
37
  * @returns
40
38
  */
41
39
  protected keyboardEvtHandler(evt: any): void;
42
- protected beforeRenderHandler(evt: ICEEvent): void;
43
- protected beforeRemoveHandler(evt: ICEEvent): void;
44
- /**
45
- * 只要鼠标弹起,连接插槽总是变成不可见状态。
46
- */
47
- protected globalMouseUpHandler(): void;
48
- /**
49
- * 监听 EventBus 上连接钩子鼠标按下事件
50
- * @param evt
51
- */
52
- protected hookMouseDownHandler(evt: ICEEvent): void;
53
- /**
54
- * 监听 EventBus 上连接钩子鼠标移动事件,判断钩子是否与插槽发生了碰撞。
55
- * FIXME:这里需要更好的碰撞检测算法,与所有插槽进行比对的方式效率太低。
56
- * @param evt
57
- */
58
- protected hookMouseMoveHandler(evt: ICEEvent): void;
59
- /**
60
- * 处理 EventBus 上连接钩子鼠标弹起事件
61
- * @param evt
62
- */
63
- protected hookMouseUpHandler(evt: ICEEvent): void;
64
- private isIntersectWithHook;
40
+ destory(): void;
65
41
  protected updatePosition(): void;
66
42
  set hostComponent(component: any);
67
43
  get hostComponent(): any;
@@ -1,3 +1,4 @@
1
+ import ICEEvent from '../../event/ICEEvent';
1
2
  import ICE from '../../ICE';
2
3
  /**
3
4
  * @class ICELinkSlotManager
@@ -16,6 +17,8 @@ export default class ICELinkSlotManager {
16
17
  start(): this;
17
18
  stop(): this;
18
19
  private hookMouseMoveHandler;
20
+ private hookMouseUpHandler;
21
+ protected globalMouseUpHandler(evt?: ICEEvent): void;
19
22
  /**
20
23
  * 创建连接插槽,插槽默认分布在组件最小边界盒子的4条边几何中点位置。
21
24
  * 有顺序,按照 TRBL 上右下左 创建,插槽的 ID 会被序列化。
@@ -1,6 +1,5 @@
1
1
  import ICEEvent from '../../event/ICEEvent';
2
2
  import ICEBoundingBox from '../../geometry/ICEBoundingBox';
3
- import ICEComponent from '../ICEComponent';
4
3
  import ICEDotPath from '../ICEDotPath';
5
4
  /**
6
5
  *
@@ -23,28 +22,19 @@ declare class ICEPolyLine extends ICEDotPath {
23
22
  * 仅供内部使用,业务代码不可依赖此属性
24
23
  */
25
24
  isLine: boolean;
26
- /**
27
- * 数据结构:
28
- * {
29
- * start:{componnet:ICEComponent,position:'T'},
30
- * end:{component:ICEComponent,position:'B'}
31
- * }
32
- * !注意:此结构与 state 上的 links 结构不同,state.links 只存 id,position 信息,而且会被序列化,此结构不会被序列化。
33
- */
34
- protected links: any;
35
25
  /**
36
26
  * @cfg
37
27
  * {
38
- * lineType: 'solid', //可能的取值:solid, dashed
39
- * arrow: 'none', //可能的取值:none, start, end ,both
40
- * arrowLength: 15, //箭头长度
41
- * arrowAngel: 30, //箭头角度
42
- * lineWidth:2, //线条宽度
43
- * closePath:false, //连线默认不闭合路径
44
- * points:[], //线条上所有点的坐标
45
- * links:{ //如果传递了连接关系参数,则在渲染器完成一轮渲染之后,会自动与指定的组件建立连接关系。
46
- * start:{id,position},
47
- * end:{id,position}
28
+ * lineType: 'solid', //可能的取值:solid, dashed
29
+ * arrow: 'none', //可能的取值:none, start, end ,both
30
+ * arrowLength: 15, //箭头长度
31
+ * arrowAngel: 30, //箭头角度
32
+ * lineWidth:2, //线条宽度
33
+ * closePath:false, //连线默认不闭合路径
34
+ * points:[], //线条上所有点的坐标
35
+ * links:{ //如果传递了连接关系参数,ICEPolyLine 会自动与指定的组件建立连接关系。
36
+ * start:{id:null,position:null},
37
+ * end:{id:null,position:null}
48
38
  * }
49
39
  * }
50
40
  *
@@ -65,9 +55,22 @@ declare class ICEPolyLine extends ICEDotPath {
65
55
  */
66
56
  protected initEvents(): void;
67
57
  protected afterAddHandler(evt?: ICEEvent): void;
68
- protected makeConnection(): void;
69
- setLink(terminal: string, component: ICEComponent, position: string): void;
70
- removeLink(terminal: string, component: ICEComponent, position: string): void;
58
+ /**
59
+ * @method syncConnections 同步连接关系
60
+ *
61
+ * - 根据 this.state.links 的数据结构,建立或者删除连接关系。
62
+ * - 此方法会在 setState() 中被调用,所以此方法内部不能调用 setState(),否则会死循环。如果需要修改 state ,直接赋值。
63
+ *
64
+ */
65
+ protected syncConnections(): void;
66
+ protected createLink(id: string, position: string): void;
67
+ /**
68
+ * @method removeLink 删除连接关系
69
+ * @param terminal 可以为 start 或者 end ,如果只提供了 terminal 参数,则删除此端点上的所有连接关系。
70
+ * @param id 连接终点的组件 id
71
+ * @param position 连接终点的组件的位置,可以为 TRBL
72
+ */
73
+ protected removeLink(terminal: string, id?: string, position?: string): void;
71
74
  /**
72
75
  * @method getLinkFromId
73
76
  * 获取起点组件 id ,如果没有建立连接,则返回 null
@@ -124,14 +127,15 @@ declare class ICEPolyLine extends ICEDotPath {
124
127
  */
125
128
  rmDot(index: number): boolean;
126
129
  /**
130
+ * @overwrite
127
131
  * @method calcComponentParams
128
- *
129
- * - 计算原始的宽高、位置,此时没有经过任何变换,也没有移动坐标原点。
130
- * - 由于点状路径可能是不规则的形状,所以宽高需要手动计算,特殊形状的子类需要覆盖此方法提供自己的实现。
132
+ * - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
131
133
  * - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
132
- *
133
- * @overwrite
134
- * @returns {ComponentParams}
134
+ * - 此方法不能依赖原点位置和 transform 矩阵。
135
+ * - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
136
+ * - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
137
+ * - 子类可以覆盖此方法,实现自己的计算逻辑。
138
+ * @returns
135
139
  */
136
140
  protected calcComponentParams(): {
137
141
  width: any;
@@ -28,9 +28,12 @@ declare class ICEIsogon extends ICEDotPath {
28
28
  /**
29
29
  * @overwrite
30
30
  * @method calcComponentParams
31
- * 计算原始的宽高、位置,此时没有经过任何变换,也没有移动坐标原点。
32
- * 由于点状路径可能是不规则的形状,所以宽高需要手动计算,特殊形状的子类需要覆盖此方法提供自己的实现。
33
- * 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
31
+ * - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
32
+ * - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
33
+ * - 此方法不能依赖原点位置和 transform 矩阵。
34
+ * - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
35
+ * - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
36
+ * - 子类可以覆盖此方法,实现自己的计算逻辑。
34
37
  * @returns
35
38
  */
36
39
  protected calcComponentParams(): {
@@ -15,9 +15,12 @@ declare class ICERose extends ICEDotPath {
15
15
  /**
16
16
  * @overwrite
17
17
  * @method calcComponentParams
18
- * 计算原始的宽高、位置,此时没有经过任何变换,也没有移动坐标原点。
19
- * 由于点状路径可能是不规则的形状,所以宽高需要手动计算,特殊形状的子类需要覆盖此方法提供自己的实现。
20
- * 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
18
+ * - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
19
+ * - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
20
+ * - 此方法不能依赖原点位置和 transform 矩阵。
21
+ * - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
22
+ * - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
23
+ * - 子类可以覆盖此方法,实现自己的计算逻辑。
21
24
  * @returns
22
25
  */
23
26
  protected calcComponentParams(): {
@@ -22,9 +22,12 @@ declare class ICEStar extends ICEDotPath {
22
22
  /**
23
23
  * @overwrite
24
24
  * @method calcComponentParams
25
- * 计算原始的宽高、位置,此时没有经过任何变换,也没有移动坐标原点。
26
- * 由于点状路径可能是不规则的形状,所以宽高需要手动计算,特殊形状的子类需要覆盖此方法提供自己的实现。
27
- * 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
25
+ * - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
26
+ * - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
27
+ * - 此方法不能依赖原点位置和 transform 矩阵。
28
+ * - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
29
+ * - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
30
+ * - 子类可以覆盖此方法,实现自己的计算逻辑。
28
31
  * @returns
29
32
  */
30
33
  protected calcComponentParams(): {
@@ -28,9 +28,13 @@ declare class ICEText extends ICEComponent {
28
28
  protected static arrangeParam(props: any): any;
29
29
  /**
30
30
  * @overwrite
31
- * 计算原始的宽高、位置,此时没有经过任何变换,也没有移动坐标原点。
32
- * 此方法不能依赖原点位置和 transform 矩阵。
33
- * 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
31
+ * @method calcComponentParams
32
+ * - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
33
+ * - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
34
+ * - 此方法不能依赖原点位置和 transform 矩阵。
35
+ * - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
36
+ * - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
37
+ * - 子类可以覆盖此方法,实现自己的计算逻辑。
34
38
  * @returns
35
39
  */
36
40
  protected calcComponentParams(): {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "大漠穷秋",
3
3
  "name": "ice-render",
4
- "version": "0.0.45",
4
+ "version": "1.0.1",
5
5
  "description": "A canvas engine for interactive graphics.",
6
6
  "repository": "https://gitee.com/ice-render/ice-render",
7
7
  "module": "dist/index.js",