ice-render 0.0.7 → 0.0.10

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.
Files changed (58) hide show
  1. package/dist/index.cjs.js +1 -9961
  2. package/dist/index.js +1 -9924
  3. package/dist/index.umd.js +1 -9967
  4. package/dist/types/FrameManager.d.ts +24 -0
  5. package/dist/types/ICE.d.ts +86 -0
  6. package/dist/types/animation/AnimationManager.d.ts +25 -0
  7. package/dist/types/animation/Easing.d.ts +32 -0
  8. package/dist/types/consts/BIG_ZINDEX_NUMBER.d.ts +14 -0
  9. package/dist/types/consts/COMPONENT_TYPE_MAPPING.d.ts +37 -0
  10. package/dist/types/consts/ICE_EVENT_NAME_CONSTS.d.ts +20 -0
  11. package/dist/types/consts/MOUSE_EVENT_MAPPING_CONSTS.d.ts +13 -0
  12. package/dist/types/control-panel/DDManager.d.ts +24 -0
  13. package/dist/types/control-panel/ICEControlPanel.d.ts +30 -0
  14. package/dist/types/control-panel/ICEControlPanelManager.d.ts +24 -0
  15. package/dist/types/control-panel/link-controls/LineControlPanel.d.ts +39 -0
  16. package/dist/types/control-panel/transform-controls/ResizeControl.d.ts +34 -0
  17. package/dist/types/control-panel/transform-controls/RotateControl.d.ts +16 -0
  18. package/dist/types/control-panel/transform-controls/TransformControlPanel.d.ts +56 -0
  19. package/dist/types/cross-platform/root.d.ts +2 -0
  20. package/dist/types/event/DOMEventBridge.d.ts +27 -0
  21. package/dist/types/event/EventBus.d.ts +27 -0
  22. package/dist/types/event/ICEEvent.d.ts +46 -0
  23. package/dist/types/event/ICEEventTarget.d.ts +106 -0
  24. package/dist/types/event/KeyboardEventInterceptor.d.ts +0 -0
  25. package/dist/types/event/MouseEventInterceptor.d.ts +7 -0
  26. package/dist/types/event/TouchEventInterceptor.d.ts +0 -0
  27. package/dist/types/geometry/GeoLine.d.ts +23 -0
  28. package/dist/types/geometry/GeoPoint.d.ts +66 -0
  29. package/dist/types/geometry/GeoUtil.d.ts +25 -0
  30. package/dist/types/geometry/ICEBoundingBox.d.ts +81 -0
  31. package/dist/types/geometry/ICEMatrix.d.ts +22 -0
  32. package/dist/types/graphic/ICEComponent.d.ts +227 -0
  33. package/dist/types/graphic/ICEDotPath.d.ts +59 -0
  34. package/dist/types/graphic/ICEImage.d.ts +17 -0
  35. package/dist/types/graphic/ICEPath.d.ts +39 -0
  36. package/dist/types/graphic/container/ICEGroup.d.ts +34 -0
  37. package/dist/types/graphic/line/ICEBezier.d.ts +15 -0
  38. package/dist/types/graphic/line/ICEPolyLine.d.ts +189 -0
  39. package/dist/types/graphic/link/ICELinkHook.d.ts +43 -0
  40. package/dist/types/graphic/link/ICELinkSlot.d.ts +60 -0
  41. package/dist/types/graphic/link/ICELinkSlotManager.d.ts +24 -0
  42. package/dist/types/graphic/link/ICEVisioLink.d.ts +129 -0
  43. package/dist/types/graphic/shape/ICECircle.d.ts +19 -0
  44. package/dist/types/graphic/shape/ICEEllipse.d.ts +26 -0
  45. package/dist/types/graphic/shape/ICEIsogon.d.ts +51 -0
  46. package/dist/types/graphic/shape/ICERect.d.ts +17 -0
  47. package/dist/types/graphic/shape/ICERose.d.ts +38 -0
  48. package/dist/types/graphic/shape/ICEStar.d.ts +45 -0
  49. package/dist/types/graphic/text/ICEText.d.ts +42 -0
  50. package/dist/types/index.d.ts +41 -0
  51. package/dist/types/persistence/Deserializer.d.ts +13 -0
  52. package/dist/types/persistence/Serializer.d.ts +19 -0
  53. package/dist/types/renderer/CanvasRenderer.d.ts +24 -0
  54. package/dist/types/util/ImageCache.d.ts +17 -0
  55. package/dist/types/util/data-util.d.ts +19 -0
  56. package/dist/types/util/gl-matrix-skew.d.ts +14 -0
  57. package/dist/types/util/uuid.d.ts +1 -0
  58. package/package.json +5 -23
@@ -0,0 +1,34 @@
1
+ import ICEComponent from '../ICEComponent';
2
+ import ICERect from '../shape/ICERect';
3
+ /**
4
+ * @class ICEGroup
5
+ *
6
+ * 容器型组件
7
+ *
8
+ * ICEGroup 可以包含自身,利用此组件可以构造出树形的对象结构。
9
+ *
10
+ * @author 大漠穷秋<damoqiongqiu@126.com>
11
+ */
12
+ declare class ICEGroup extends ICERect {
13
+ parentNode: any;
14
+ childNodes: any[];
15
+ constructor(props: any);
16
+ /**
17
+ * !注意:在调用 ICEGroup.addChild() 方法时, ICEGroup 自身可能还没有被添加到 ICE 实例中去。所以此时 child.root, child.ctx, child.evtBus 都可能为空。
18
+ * @param child
19
+ */
20
+ addChild(child: ICEComponent): void;
21
+ addChildren(arr: Array<ICEComponent>): void;
22
+ removeChild(child: ICEComponent): void;
23
+ removeChildren(arr: Array<ICEComponent>): void;
24
+ /**
25
+ * @overwrite
26
+ * @method destory
27
+ * 销毁组件
28
+ * - FIXME:立即停止组件上的所有动画效果
29
+ * - 需要清理绑定的事件
30
+ * - 带有子节点的组件需要先销毁子节点,然后再销毁自身。
31
+ */
32
+ destory(): void;
33
+ }
34
+ export default ICEGroup;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ /**
9
+ * @class ICEBezier 贝塞尔曲线
10
+ * @author 大漠穷秋<damoqiongqiu@126.com>
11
+ */
12
+ declare class ICEBezier {
13
+ constructor(props?: any);
14
+ }
15
+ export default ICEBezier;
@@ -0,0 +1,189 @@
1
+ import ICEEvent from '../../event/ICEEvent';
2
+ import ICEBoundingBox from '../../geometry/ICEBoundingBox';
3
+ import ICEComponent from '../ICEComponent';
4
+ import ICEDotPath from '../ICEDotPath';
5
+ /**
6
+ *
7
+ * @class ICEPolyLine
8
+ *
9
+ * 折线
10
+ *
11
+ * 基本特征:
12
+ *
13
+ * - ICEPolyLine 由多个点构成,如果折线上的所有点共线,则折线在外观上退化成直线。
14
+ * - ICEPolyLine 上至少存在 2 个点,否则无法画线。如果点数恰好为 2 ,折线退化成一条直线。
15
+ * - ICEPolyLine 以及所有子类不能进行 transform 操作。
16
+ * - ICEPolyLine 以及所有子类的 left/top 总是被设置为 startPoint 。
17
+ * - ICEPolyLine 以及所有子类的原点都在 startPoint 上,而不在几何中心点。
18
+ *
19
+ * @author 大漠穷秋<damoqiongqiu@126.com>
20
+ */
21
+ declare class ICEPolyLine extends ICEDotPath {
22
+ /**
23
+ * {
24
+ * start:{componnet:ICEComponent,position:'T'},
25
+ * end:{component:ICEComponent,position:'B'}
26
+ * }
27
+ */
28
+ protected links: any;
29
+ /**
30
+ * @cfg
31
+ * {
32
+ * lineType: 'solid', //solid, dashed
33
+ * lineWidth:2,
34
+ * arrowPosition: 'none', //none, start, end ,both
35
+ * arrowLength: 15, //箭头长度
36
+ * arrowAngel: 30, //箭头角度
37
+ * closePath:false, //连线默认不闭合路径
38
+ * points:[], //点的坐标
39
+ * links:{start:{id,position},end:{id,position}} //如果传递了连接关系参数,则在渲染器完成一轮渲染之后,自动建立连接关系。
40
+ * }
41
+ *
42
+ * @param props
43
+ */
44
+ constructor(props?: any);
45
+ /**
46
+ *
47
+ * 整理并校验构造参数。
48
+ *
49
+ * @static
50
+ * @param props
51
+ * @returns
52
+ */
53
+ static arrangeParam(props: any): any;
54
+ /**
55
+ * @overwrite
56
+ */
57
+ protected initEvents(): void;
58
+ protected afterAddHandler(evt?: ICEEvent): void;
59
+ protected makeConnection(): void;
60
+ setLink(terminal: string, component: ICEComponent, position: string): void;
61
+ removeLink(terminal: string, component: ICEComponent, position: string): void;
62
+ /**
63
+ * @method
64
+ * 连接的组件位置发生移动之后,重新计算连接线的起点和终点。
65
+ */
66
+ private followComponent;
67
+ /**
68
+ * ICEPolyLine 有自己的特殊处理,它的原点永远在 (0,0) 位置,而不在几何中点。
69
+ * @overwrite
70
+ * @returns
71
+ */
72
+ protected calcLocalOrigin(): number[];
73
+ /**
74
+ * @method calcDots
75
+ * ICEPolyLine 有自己特殊的计算方式:
76
+ * - 原点总是放在 startPoint 的位置。
77
+ * - 数值相对于组件本地坐标系进行计算。
78
+ * @overwrite
79
+ * @returns
80
+ */
81
+ protected calcDots(): any;
82
+ /**
83
+ * @method calcArrowPoints
84
+ * 计算箭头坐标
85
+ */
86
+ protected calcArrowPoints(): void;
87
+ protected doCalcArrowPoints(twoPoints: any): number[][];
88
+ /**
89
+ * @method addDot 增加一个点
90
+ *
91
+ * 动态向线条上增加一个点。
92
+ *
93
+ * @param point
94
+ * @param index
95
+ */
96
+ addDot(point: [number, number], index: number): void;
97
+ /**
98
+ * @method rmDot 删除一个点
99
+ *
100
+ * 从线条上删掉一个点,如果线条上的点数已经小于等于 2 ,则什么都不做。
101
+ *
102
+ * @param index
103
+ */
104
+ rmDot(index: number): boolean;
105
+ /**
106
+ * @method calcComponentParams
107
+ *
108
+ * - 计算原始的宽高、位置,此时没有经过任何变换,也没有移动坐标原点。
109
+ * - 由于点状路径可能是不规则的形状,所以宽高需要手动计算,特殊形状的子类需要覆盖此方法提供自己的实现。
110
+ * - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
111
+ *
112
+ * @overwrite
113
+ * @returns {ComponentParams}
114
+ */
115
+ calcComponentParams(): {
116
+ width: any;
117
+ height: any;
118
+ };
119
+ /**
120
+ * @method isDotsOnSameLine 是否所有点都在同一条直线上
121
+ *
122
+ * 进行共线判断,如果所有点都在同一条直线上,那么边界盒子的整体高度就等于线条的粗细。
123
+ *
124
+ * @returns
125
+ */
126
+ private isDotsOnSameLine;
127
+ /**
128
+ * @method calc4VertexPoints 计算4个顶点
129
+ *
130
+ * - 相对于组件本地的坐标系,原点位于左上角,没有经过矩阵变换。
131
+ * - 返回值用于计算组件的原始 width/height 。
132
+ *
133
+ * @returns {Array}
134
+ */
135
+ protected calc4VertexPoints(): any[][];
136
+ /**
137
+ * @method splitEndpointsTo4Points 将线条的起点和终点分成4个点,用于计算组件的原始 width/height
138
+ *
139
+ * 把直线的2个端点分裂成4个点,把线条的粗细参数(lineWidth)当成高度看待,方便计算最小包围盒。
140
+ *
141
+ * @returns
142
+ */
143
+ protected splitEndpointsTo4Points(): number[][];
144
+ /**
145
+ * @method getMinBoundingBox 获取最小包围盒
146
+ *
147
+ * 此盒子的变换矩阵与组件自身的变换矩阵完全相同。
148
+ *
149
+ * @returns
150
+ */
151
+ getMinBoundingBox(): ICEBoundingBox;
152
+ /**
153
+ * @method setState 更新组件状态
154
+ * setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
155
+ *
156
+ * ICEPolyLine 有自己特殊的处理方法:
157
+ *
158
+ * - ICEPolyLine 的 width/height 属性总是计算出来的,不能直接修改,不接受 width/height 配置项。
159
+ * - ICEPolyLine ICEPolyLine 不能进行 transform 操作,不接受 transform 配置项。
160
+ * - ICEPolyLine 可以直接修改 points 。
161
+ * - ICEPolyLine 的 left/top 数值可以直接修改,修改 left/top 时,会重新计算起点和终点坐标,保证 left/top 与 startPoint 始终保持在同一个点上。
162
+ *
163
+ * @overwrite
164
+ * @param newState 新的状态
165
+ */
166
+ setState(newState: any): void;
167
+ /**
168
+ * @method getRotateAngle 获取组件的旋转角度
169
+ * @returns {number}
170
+ */
171
+ getRotateAngle(): number;
172
+ /**
173
+ * @method containsPoint 判断点是否在线上
174
+ *
175
+ * 计算方法:如果给点的坐标点到线段两端的距离之和等于线段长度,则表示点位于线段上,允许一定的误差范围,用 delta 参数进行调节。
176
+ * 算法来源:http://www.jeffreythompson.org/collision-detection/line-point.php
177
+ *
178
+ * @param x
179
+ * @param y
180
+ * @returns {boolean}
181
+ */
182
+ containsPoint(x: number, y: number): boolean;
183
+ /**
184
+ * @method getLines 获取线段数组
185
+ * @returns {Array<any>}
186
+ */
187
+ private getLines;
188
+ }
189
+ export default ICEPolyLine;
@@ -0,0 +1,43 @@
1
+ import ICEEvent from '../../event/ICEEvent';
2
+ import ICECircle from '../shape/ICECircle';
3
+ /**
4
+ * @class ICELinkHook
5
+ *
6
+ * 连接钩子
7
+ *
8
+ * - ICELinkHook 与 ICELinkSlot 是一对组件,用来把两个组件连接起来
9
+ * - ICELinkHook 不能独立存在,它的实例放在 @see LineControlPanel 上
10
+ * - ICELinkHook 自身不进行任何 transform 。
11
+ *
12
+ * @see ICELinkSlot
13
+ * @author 大漠穷秋<damoqiongqiu@126.com>
14
+ */
15
+ export default class ICELinkHook extends ICECircle {
16
+ constructor(props?: any);
17
+ protected initEvents(): void;
18
+ /**
19
+ *
20
+ * 在 mousedown 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mousedown 事件说明组件已经渲染出来了。
21
+ * 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEDOWN 事件的组件都会收到消息。
22
+ *
23
+ * @param evt
24
+ */
25
+ protected mosueDownHandler(evt: ICEEvent): void;
26
+ /**
27
+ *
28
+ * 在 mousemove 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mousemove 事件说明组件已经渲染出来了。
29
+ * 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEMOVE 事件的组件都会收到消息。
30
+ *
31
+ * @param evt
32
+ */
33
+ protected mosueMoveHandler(evt: ICEEvent): void;
34
+ /**
35
+ *
36
+ * 在 mouseup 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mouseup 事件说明组件已经渲染出来了。
37
+ * 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEUP 事件的组件都会收到消息。
38
+ *
39
+ * @param evt
40
+ */
41
+ protected mosueUpHandler(evt: ICEEvent): void;
42
+ protected resizeEvtHandler(evt: any): void;
43
+ }
@@ -0,0 +1,60 @@
1
+ import ICEEvent from '../../event/ICEEvent';
2
+ import ICECircle from '../shape/ICECircle';
3
+ /**
4
+ * @class ICELinkSlot
5
+ *
6
+ * 连接插槽
7
+ *
8
+ * - ICELinkSlot 与 ICELinkHook 是一对组件,用来把两个组件连接起来。
9
+ * - 一个插槽上面可以连多个钩子,ICELinkSlot 与 ICELinkHook 之间是一对多的关系。
10
+ * - ICELinkSlot 不能独立存在,它必须附属在某个宿主组件上。逻辑附属,非真实的外观附属。
11
+ * - ICELinkSlot 总是绘制在全局 canvas 中,它不是任何组件的子节点。
12
+ * - ICELinkSlot 自身不进行任何 transform 。
13
+ * - ICELinkSlot 的实例是由 ICELinkSlotManager 统一动态创建的,如果组件的 linkable 状态为 tue ,ICELinkSlotManager 会动态在组件上创建连接插槽。
14
+ *
15
+ * @see ICELinkHook
16
+ * @see ICELinkSlotManager
17
+ * @author 大漠穷秋<damoqiongqiu@126.com>
18
+ */
19
+ declare class ICELinkSlot extends ICECircle {
20
+ private _hostComponent;
21
+ /**
22
+ * position 有4个取值,分别位于宿主边界盒子的4个边的几何中点上:
23
+ * - T: 顶部
24
+ * - R: 右侧
25
+ * - B: 底部
26
+ * - L: 左侧
27
+ *
28
+ * 连接插槽自身不可拖拽、不可连接。
29
+ * @param props
30
+ */
31
+ constructor(props?: any);
32
+ protected initEvents(): void;
33
+ protected beforeRenderHandler(evt: ICEEvent): void;
34
+ protected beforeRemoveHandler(evt: ICEEvent): void;
35
+ /**
36
+ * 只要鼠标弹起,连接插槽总是变成不可见状态。
37
+ */
38
+ protected globalMouseUpHandler(): void;
39
+ /**
40
+ * 监听 EventBus 上连接钩子鼠标按下事件
41
+ * @param evt
42
+ */
43
+ protected hookMouseDownHandler(evt: ICEEvent): void;
44
+ /**
45
+ * 监听 EventBus 上连接钩子鼠标移动事件,判断钩子是否与插槽发生了碰撞。
46
+ * FIXME:这里需要更好的碰撞检测算法,与所有插槽进行比对的方式效率太低。
47
+ * @param evt
48
+ */
49
+ protected hookMouseMoveHandler(evt: ICEEvent): void;
50
+ /**
51
+ * 处理 EventBus 上连接钩子鼠标弹起事件
52
+ * @param evt
53
+ */
54
+ protected hookMouseUpHandler(evt: ICEEvent): void;
55
+ private isIntersectWithHook;
56
+ protected updatePosition(): void;
57
+ set hostComponent(component: any);
58
+ get hostComponent(): any;
59
+ }
60
+ export default ICELinkSlot;
@@ -0,0 +1,24 @@
1
+ import ICE from '../../ICE';
2
+ /**
3
+ * @class ICELinkSlotManager
4
+ *
5
+ * - ICELinkSlotManager 连接插槽管理器,用于管理连接插槽,共4个,所有可连接的组件都复用这4个插槽的实例。
6
+ * - ICELinkSlotManager 的实例是在 ICE 初始化时创建的。
7
+ * - ICELinkSlotManager 是全局单例,同一个 ICE 实例上只能有一个 ICELinkSlotManager 实例。
8
+ *
9
+ * @see ICE
10
+ * @author 大漠穷秋<damoqiongqiu@126.com>
11
+ */
12
+ export default class ICELinkSlotManager {
13
+ private slotRadius;
14
+ private ice;
15
+ constructor(ice: ICE);
16
+ start(): this;
17
+ stop(): this;
18
+ private hookMouseMoveHandler;
19
+ /**
20
+ * 创建连接插槽,插槽默认分布在组件最小边界盒子的4条边几何中点位置。
21
+ * 有顺序,按照 TRBL 上右下左 创建,插槽的 ID 会被序列化。
22
+ */
23
+ protected createLinkSlots(): void;
24
+ }
@@ -0,0 +1,129 @@
1
+ import ICEPolyLine from '../line/ICEPolyLine';
2
+ /**
3
+ * ! FIXME: 删掉对 GeoPoint/GeoLine/GeoUtil 的依赖
4
+ * @class ICEVisioLink
5
+ *
6
+ * Visio 型的连接线
7
+ *
8
+ * 模拟 Microsoft Visio 中的折线算法,此实现从 diagramo 改进而来:http://diagramo.com/ 。
9
+ *
10
+ * 基本特性:
11
+ *
12
+ * - ICEVisioLink 只有 2 个端点,起点和终点。
13
+ * - 除起始点和终点坐标之外,其它点会自动插值计算。
14
+ * - ICEVisioLink 只能连接 2 个非线条类的组件。
15
+ * - 线条互相之间不能连接,在 ICE 引擎中,不能用线条连接线条。
16
+ * - 每一个可以被连接的组件上都有 4 个插槽(Slot),4 个插槽分布在组件最小边界盒子 4 条边的几何中点位置上。
17
+ * - ICEVisioLink 的端点在移动时会判断是否与某个插槽发生碰撞,如果与某个插槽发生碰撞, ICEVisioLink 会连接到插槽所在的组件上。
18
+ * - 同一个插槽(Slot)上可以连 N 根线,Slot 与 ICEVisioLink 之间的关系是 1->N 。
19
+ *
20
+ * @author 大漠穷秋<damoqiongqiu@126.com>
21
+ */
22
+ export default class ICEVisioLink extends ICEPolyLine {
23
+ /**
24
+ * FIXME:补全 props 配置项的描述
25
+ */
26
+ constructor(props?: any);
27
+ static arrangeParam(props: any): any;
28
+ /**
29
+ * ICEVisioLink 有自己特殊的计算方式。
30
+ *
31
+ * @overwrite
32
+ * @returns
33
+ */
34
+ protected calcDots(): any;
35
+ /**
36
+ * 在起点和终点之间插值。
37
+ *
38
+ * @returns
39
+ */
40
+ protected interpolate(): any[];
41
+ /**
42
+ * Tests if a vector of points is an orthogonal path (moving in multiples of 90 degrees).
43
+ *
44
+ *
45
+ * 正交判定。Visio 连接线上的每一段要么平行于 X 轴,要么平行于 Y 轴。
46
+ * @param {Array} v - an {Array} of {Point}s
47
+ * @return {Boolean} - true if path is valid, false otherwise
48
+ */
49
+ private orthogonalPath;
50
+ /**
51
+ * FIXME: 用更好的数学方法进行计算。
52
+ * Test to see if 2 {Line}s intersects. They are considered finite segments
53
+ * and not the infinite lines from geometry
54
+ * @param {Line} l1 - fist line/segment
55
+ * @param {Line} l2 - last line/segment
56
+ * @return {Boolean} true - if the lines intersect or false if not
57
+ */
58
+ private lineIntersectsLine;
59
+ /**
60
+ * Tests if a a polyline defined by a set of points intersects a rectangle
61
+ * @param {Array} points - and {Array} of {Point}s
62
+ * @param {Array} boundingRect - the boundingRect
63
+ * @param {Boolean} closedPolyline - incase polyline is closed figure then true, else false
64
+ * @return true - if line intersects the rectangle, false - if not
65
+ */
66
+ private polylineIntersectsRectangle;
67
+ /**
68
+ * Score a ortogonal path made out of Points
69
+ * Iterates over a set of points (minimum 3)
70
+ * For each 3 points (i, i+1, i+2) :
71
+ * - if the 3rd one is after the 2nd on the same line we add +1
72
+ * - if the 3rd is up or down related to the 2nd we do not do anything +0
73
+ * - if the 3rd goes back we imediatelly return -1
74
+ * @param {Array} v - an array of {Point}s
75
+ * @return {Number} - -1 if the path is wrong (goes back) or something >= 0 if is fine.The bigger the number the smooth the path is.
76
+ */
77
+ private scorePath;
78
+ /**
79
+ * Returns the sign of a number
80
+ * @param {Number} x - the number
81
+ * @returns {Number}
82
+ * @see <a href="http://en.wikipedia.org/wiki/Sign_function">http://en.wikipedia.org/wiki/Sign_function</a>
83
+ */
84
+ private signum;
85
+ /**
86
+ * Tests if a vector of points is a valid path (not going back)
87
+ * There are a few problems here. If you have p1, p2, p3 and p4 and p2 = p3 you need to ignore that
88
+ * @param {Array} v - an {Array} of {Point}s
89
+ * @return {Boolean} - true if path is valid, false otherwise
90
+ */
91
+ private forwardPath;
92
+ /**
93
+ * @method distance
94
+ * Calculate the distance between two points.
95
+ *
96
+ *
97
+ * 计算两点之间的距离。
98
+ * @param {Point} p1 - first {Point}
99
+ * @param {Point} p2 - second {Point}
100
+ * @return {Number} - the distance between those 2 points. It is always positive.
101
+ */
102
+ private distance;
103
+ /**
104
+ * Returns the max of a vector
105
+ * @param {Array} v - vector of {Number}s
106
+ * @return {Number} - the maximum number from the vector or NaN if vector is empty
107
+ */
108
+ private max;
109
+ /**
110
+ * Returns the min of a vector
111
+ * @param {Array} v - vector of {Number}s
112
+ * @return {Number} - the minimum number from the vector or NaN if vector is empty
113
+ * @author alex@scriptoid.com
114
+ */
115
+ private min;
116
+ /**
117
+ * ICEVisioLink 中的点都是自动计算出来的,手动添加点没有意义。
118
+ * @overwrite
119
+ * @param point
120
+ * @param index
121
+ */
122
+ addDot(point: [number, number], index: number): void;
123
+ /**
124
+ * ICEVisioLink 中的点都是自动计算出来的,手动删除点没有意义。
125
+ * @overwrite
126
+ * @param index
127
+ */
128
+ rmDot(index: number): boolean;
129
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import ICEEllipse from './ICEEllipse';
9
+ /**
10
+ * @class ICECircle
11
+ *
12
+ * 正圆形,采用椭圆绘制方法,正圆形作为椭圆的特殊情况。
13
+ *
14
+ * @author 大漠穷秋<damoqiongqiu@126.com>
15
+ */
16
+ declare class ICECircle extends ICEEllipse {
17
+ constructor(props?: any);
18
+ }
19
+ export default ICECircle;
@@ -0,0 +1,26 @@
1
+ import ICEPath from '../ICEPath';
2
+ /**
3
+ * @class ICEEllipse
4
+ *
5
+ * 椭圆形。
6
+ *
7
+ * @author 大漠穷秋<damoqiongqiu@126.com>
8
+ */
9
+ declare class ICEEllipse extends ICEPath {
10
+ constructor(props?: any);
11
+ /**
12
+ * 所有坐标点的坐标都是相对于父层组件,而不是全局坐标。
13
+ * @returns
14
+ */
15
+ protected createPathObject(): Path2D;
16
+ /**
17
+ * setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
18
+ *
19
+ * - 如果 setState 时指定了 radiusX 参数,则 width 会被重新计算,如果指定了 radiusY 参数则 height 会被重新计算。
20
+ * - 如果 setState 时仅仅指定 width 参数,则 radiusX 会被重新计算,如果仅仅指定了 height 参数,则 radiusY 会被重新计算。
21
+ * @overwrite
22
+ * @param newState
23
+ */
24
+ setState(newState: any): void;
25
+ }
26
+ export default ICEEllipse;
@@ -0,0 +1,51 @@
1
+ import ICEDotPath from '../ICEDotPath';
2
+ /**
3
+ *
4
+ * @class ICEIsogon
5
+ *
6
+ * 正N边形
7
+ *
8
+ * @author 大漠穷秋<damoqiongqiu@126.com>
9
+ */
10
+ declare class ICEIsogon extends ICEDotPath {
11
+ /**
12
+ * @method constructor
13
+ * radius, edges 会暴露给 AnimationManager ,可能会动态变化。
14
+ * @param props
15
+ */
16
+ constructor(props?: any);
17
+ /**
18
+ * @overwrite
19
+ * @method calcDots
20
+ *
21
+ * 计算路径上的关键点:
22
+ * - 默认的坐标原点是 (0,0) 位置。
23
+ * - 这些点没有经过 transform 矩阵变换。
24
+ *
25
+ * @returns
26
+ */
27
+ protected calcDots(): any;
28
+ /**
29
+ * @overwrite
30
+ * @method calcComponentParams
31
+ * 计算原始的宽高、位置,此时没有经过任何变换,也没有移动坐标原点。
32
+ * 由于点状路径可能是不规则的形状,所以宽高需要手动计算,特殊形状的子类需要覆盖此方法提供自己的实现。
33
+ * 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
34
+ * @returns
35
+ */
36
+ calcComponentParams(): {
37
+ width: any;
38
+ height: any;
39
+ };
40
+ /**
41
+ * @overwrite
42
+ * @method setState
43
+ * setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
44
+ *
45
+ * - 如果 setState 时指定了 radius 参数,则 width 会被重新计算,如果指定了 radius 参数则 height 会被重新计算。
46
+ * - 如果 setState 时仅仅指定 width 参数,则 radius 会被重新计算,如果仅仅指定了 height 参数,则 radius 会被重新计算。
47
+ * @param newState
48
+ */
49
+ setState(newState: any): void;
50
+ }
51
+ export default ICEIsogon;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2022 大漠穷秋.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import ICEPath from '../ICEPath';
9
+ /**
10
+ * @class ICERect 矩形
11
+ * @author 大漠穷秋<damoqiongqiu@126.com>
12
+ */
13
+ declare class ICERect extends ICEPath {
14
+ constructor(props?: any);
15
+ protected createPathObject(): Path2D;
16
+ }
17
+ export default ICERect;
@@ -0,0 +1,38 @@
1
+ import ICEDotPath from '../ICEDotPath';
2
+ declare class ICERose extends ICEDotPath {
3
+ constructor(props?: any);
4
+ /**
5
+ * @overwrite
6
+ * @method calcDots
7
+ *
8
+ * 计算路径上的关键点:
9
+ * - 默认的坐标原点是 (0,0) 位置。
10
+ * - 这些点没有经过 transform 矩阵变换。
11
+ *
12
+ * @returns
13
+ */
14
+ protected calcDots(): any;
15
+ /**
16
+ * @overwrite
17
+ * @method calcComponentParams
18
+ * 计算原始的宽高、位置,此时没有经过任何变换,也没有移动坐标原点。
19
+ * 由于点状路径可能是不规则的形状,所以宽高需要手动计算,特殊形状的子类需要覆盖此方法提供自己的实现。
20
+ * 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
21
+ * @returns
22
+ */
23
+ calcComponentParams(): {
24
+ width: any;
25
+ height: any;
26
+ };
27
+ /**
28
+ * @overwrite
29
+ * @method setState
30
+ * setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
31
+ *
32
+ * - 如果 setState 时指定了 radius 参数,则 width 会被重新计算,如果指定了 radius 参数则 height 会被重新计算。
33
+ * - 如果 setState 时仅仅指定 width 参数,则 radius 会被重新计算,如果仅仅指定了 height 参数,则 radius 会被重新计算。
34
+ * @param newState
35
+ */
36
+ setState(newState: any): void;
37
+ }
38
+ export default ICERose;