ice-render 1.0.3 → 1.0.5
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/LICENSE +0 -0
- package/README.md +229 -139
- package/dist/THIRD-PARTY-NOTICES.txt +32 -0
- package/dist/index.cjs +30 -0
- package/dist/index.mjs +30 -0
- package/dist/index.umd.js +6 -1
- package/dist/types/FrameManager.d.mts +26 -0
- package/dist/types/FrameManager.d.ts +26 -24
- package/dist/types/ICE.d.mts +369 -0
- package/dist/types/ICE.d.ts +369 -109
- package/dist/types/a11y/accessibility.d.mts +46 -0
- package/dist/types/a11y/accessibility.d.ts +46 -0
- package/dist/types/animation/AnimationManager.d.mts +96 -0
- package/dist/types/animation/AnimationManager.d.ts +96 -25
- package/dist/types/animation/Easing.d.mts +33 -0
- package/dist/types/animation/Easing.d.ts +33 -32
- package/dist/types/consts/BIG_ZINDEX_NUMBER.d.mts +14 -0
- package/dist/types/consts/BIG_ZINDEX_NUMBER.d.ts +14 -14
- package/dist/types/consts/COMPONENT_TYPE_MAPPING.d.mts +45 -0
- package/dist/types/consts/COMPONENT_TYPE_MAPPING.d.ts +45 -36
- package/dist/types/consts/DOM_EVENT_MAPPING_CONSTS.d.mts +37 -0
- package/dist/types/consts/DOM_EVENT_MAPPING_CONSTS.d.ts +37 -19
- package/dist/types/consts/ICE_EVENT_NAME_CONSTS.d.mts +27 -0
- package/dist/types/consts/ICE_EVENT_NAME_CONSTS.d.ts +27 -20
- package/dist/types/control-panel/AlignmentGuideManager.d.mts +92 -0
- package/dist/types/control-panel/AlignmentGuideManager.d.ts +92 -0
- package/dist/types/control-panel/ICEControlPanel.d.mts +37 -0
- package/dist/types/control-panel/ICEControlPanel.d.ts +37 -37
- package/dist/types/control-panel/ICEControlPanelManager.d.mts +25 -0
- package/dist/types/control-panel/ICEControlPanelManager.d.ts +25 -23
- package/dist/types/control-panel/link-controls/LineControlPanel.d.mts +39 -0
- package/dist/types/control-panel/link-controls/LineControlPanel.d.ts +39 -39
- package/dist/types/control-panel/transform-controls/ResizeControl.d.mts +38 -0
- package/dist/types/control-panel/transform-controls/ResizeControl.d.ts +38 -34
- package/dist/types/control-panel/transform-controls/RotateControl.d.mts +12 -0
- package/dist/types/control-panel/transform-controls/RotateControl.d.ts +12 -16
- package/dist/types/control-panel/transform-controls/TransformControlPanel.d.mts +83 -0
- package/dist/types/control-panel/transform-controls/TransformControlPanel.d.ts +83 -74
- package/dist/types/control-panel/transform-controls/constraints.d.mts +24 -0
- package/dist/types/control-panel/transform-controls/constraints.d.ts +24 -0
- package/dist/types/cross-platform/PolyfillPath2D.d.mts +31 -0
- package/dist/types/cross-platform/PolyfillPath2D.d.ts +31 -0
- package/dist/types/cross-platform/root.d.mts +7 -0
- package/dist/types/cross-platform/root.d.ts +7 -2
- package/dist/types/event/DOMEventDispatcher.d.mts +68 -0
- package/dist/types/event/DOMEventDispatcher.d.ts +68 -29
- package/dist/types/event/DOMEventInterceptor.d.mts +36 -0
- package/dist/types/event/DOMEventInterceptor.d.ts +36 -7
- package/dist/types/event/EventBus.d.mts +27 -0
- package/dist/types/event/EventBus.d.ts +27 -27
- package/dist/types/event/ICEEvent.d.mts +46 -0
- package/dist/types/event/ICEEvent.d.ts +46 -46
- package/dist/types/event/ICEEventTarget.d.mts +106 -0
- package/dist/types/event/ICEEventTarget.d.ts +106 -106
- package/dist/types/event/input-normalize.d.mts +75 -0
- package/dist/types/event/input-normalize.d.ts +75 -0
- package/dist/types/geometry/GeoLine.d.mts +24 -0
- package/dist/types/geometry/GeoLine.d.ts +24 -23
- package/dist/types/geometry/GeoPoint.d.mts +53 -0
- package/dist/types/geometry/GeoPoint.d.ts +53 -66
- package/dist/types/geometry/GeoUtil.d.mts +73 -0
- package/dist/types/geometry/GeoUtil.d.ts +73 -37
- package/dist/types/geometry/ICEBoundingBox.d.mts +81 -0
- package/dist/types/geometry/ICEBoundingBox.d.ts +81 -81
- package/dist/types/graphic/ICEComponent.d.mts +436 -0
- package/dist/types/graphic/ICEComponent.d.ts +436 -264
- package/dist/types/graphic/ICEDotPath.d.mts +99 -0
- package/dist/types/graphic/ICEDotPath.d.ts +99 -63
- package/dist/types/graphic/ICEImage.d.mts +17 -0
- package/dist/types/graphic/ICEImage.d.ts +17 -17
- package/dist/types/graphic/ICEPath.d.mts +39 -0
- package/dist/types/graphic/ICEPath.d.ts +39 -39
- package/dist/types/graphic/container/ICEGroup.d.mts +101 -0
- package/dist/types/graphic/container/ICEGroup.d.ts +101 -54
- package/dist/types/graphic/link/ICEBezier.d.mts +23 -0
- package/dist/types/graphic/link/ICEBezier.d.ts +23 -15
- package/dist/types/graphic/link/ICELinkHook.d.mts +52 -0
- package/dist/types/graphic/link/ICELinkHook.d.ts +52 -52
- package/dist/types/graphic/link/ICELinkSlot.d.mts +54 -0
- package/dist/types/graphic/link/ICELinkSlot.d.ts +54 -46
- package/dist/types/graphic/link/ICELinkSlotManager.d.mts +28 -0
- package/dist/types/graphic/link/ICELinkSlotManager.d.ts +28 -28
- package/dist/types/graphic/link/ICEPolyLine.d.mts +292 -0
- package/dist/types/graphic/link/ICEPolyLine.d.ts +292 -219
- package/dist/types/graphic/link/ICEVisioLink.d.mts +163 -0
- package/dist/types/graphic/link/ICEVisioLink.d.ts +163 -129
- package/dist/types/graphic/shape/ICECircle.d.mts +19 -0
- package/dist/types/graphic/shape/ICECircle.d.ts +19 -19
- package/dist/types/graphic/shape/ICEEllipse.d.mts +29 -0
- package/dist/types/graphic/shape/ICEEllipse.d.ts +29 -26
- package/dist/types/graphic/shape/ICEIsogon.d.mts +52 -0
- package/dist/types/graphic/shape/ICEIsogon.d.ts +52 -54
- package/dist/types/graphic/shape/ICERect.d.mts +10 -0
- package/dist/types/graphic/shape/ICERect.d.ts +10 -17
- package/dist/types/graphic/shape/ICERose.d.mts +41 -0
- package/dist/types/graphic/shape/ICERose.d.ts +41 -41
- package/dist/types/graphic/shape/ICEStar.d.mts +45 -0
- package/dist/types/graphic/shape/ICEStar.d.ts +45 -48
- package/dist/types/graphic/text/ICEText.d.mts +137 -0
- package/dist/types/graphic/text/ICEText.d.ts +137 -64
- package/dist/types/index.d.mts +55 -0
- package/dist/types/index.d.ts +55 -41
- package/dist/types/layout/ICEBorderLayout.d.mts +34 -0
- package/dist/types/layout/ICEBorderLayout.d.ts +34 -0
- package/dist/types/layout/ICEBoxLayout.d.mts +30 -0
- package/dist/types/layout/ICEBoxLayout.d.ts +30 -0
- package/dist/types/layout/ICECardLayout.d.mts +36 -0
- package/dist/types/layout/ICECardLayout.d.ts +36 -0
- package/dist/types/layout/ICEFlowLayout.d.mts +31 -0
- package/dist/types/layout/ICEFlowLayout.d.ts +31 -0
- package/dist/types/layout/ICEGridLayout.d.mts +33 -0
- package/dist/types/layout/ICEGridLayout.d.ts +33 -0
- package/dist/types/layout/ICELayeredLayout.d.mts +49 -0
- package/dist/types/layout/ICELayeredLayout.d.ts +49 -0
- package/dist/types/layout/ICELayoutManager.d.mts +33 -0
- package/dist/types/layout/ICELayoutManager.d.ts +33 -0
- package/dist/types/layout/ICEOverlayLayout.d.mts +25 -0
- package/dist/types/layout/ICEOverlayLayout.d.ts +25 -0
- package/dist/types/persistence/Deserializer.d.mts +43 -0
- package/dist/types/persistence/Deserializer.d.ts +43 -14
- package/dist/types/persistence/Serializer.d.mts +35 -0
- package/dist/types/persistence/Serializer.d.ts +35 -26
- package/dist/types/plugin/PluginHost.d.mts +86 -0
- package/dist/types/plugin/PluginHost.d.ts +86 -0
- package/dist/types/renderer/CanvasRenderer.d.mts +150 -0
- package/dist/types/renderer/CanvasRenderer.d.ts +150 -24
- package/dist/types/renderer/ObjectCache.d.mts +79 -0
- package/dist/types/renderer/ObjectCache.d.ts +79 -0
- package/dist/types/renderer/dirty-rect-util.d.mts +86 -0
- package/dist/types/renderer/dirty-rect-util.d.ts +86 -0
- package/dist/types/theme/ICETheme.d.mts +382 -0
- package/dist/types/theme/ICETheme.d.ts +382 -0
- package/dist/types/util/ImageCache.d.mts +19 -0
- package/dist/types/util/ImageCache.d.ts +19 -17
- package/dist/types/util/data-util.d.mts +43 -0
- package/dist/types/util/data-util.d.ts +43 -19
- package/dist/types/util/gl-matrix-skew.d.mts +14 -0
- package/dist/types/util/gl-matrix-skew.d.ts +14 -14
- package/dist/types/util/lang.d.mts +28 -0
- package/dist/types/util/lang.d.ts +28 -0
- package/dist/types/util/uuid.d.mts +1 -0
- package/dist/types/util/uuid.d.ts +1 -1
- package/package.json +119 -81
- package/dist/index.cjs.js +0 -25
- package/dist/index.js +0 -25
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import ICEPath from './ICEPath.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* @class ICEDotPath
|
|
4
|
+
*
|
|
5
|
+
* 基于一系列点进行绘制的路径。
|
|
6
|
+
*
|
|
7
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
8
|
+
*/
|
|
9
|
+
export default abstract class ICEDotPath extends ICEPath {
|
|
10
|
+
/**
|
|
11
|
+
* @cfg
|
|
12
|
+
* {
|
|
13
|
+
* dots: [], //点状路径的点集
|
|
14
|
+
* closePath:true, //是否闭合
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* @param props
|
|
18
|
+
*/
|
|
19
|
+
constructor(props: any);
|
|
20
|
+
/**
|
|
21
|
+
* @overwrite
|
|
22
|
+
* @method calcComponentParams
|
|
23
|
+
* - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
|
|
24
|
+
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
25
|
+
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
26
|
+
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
27
|
+
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
28
|
+
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
protected calcComponentParams(): {
|
|
32
|
+
width: any;
|
|
33
|
+
height: any;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 精确命中判定:点是否位于点集构成的多边形内部(射线法)。
|
|
37
|
+
* dots 在 calcLocalOrigin() 之后是「以 origin 为原点」的本地坐标,与 containsLocalPoint 的参数空间一致。
|
|
38
|
+
* @overwrite
|
|
39
|
+
*/
|
|
40
|
+
protected containsLocalPoint(localX: number, localY: number): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 点状路径在重新计算本地原点坐标之后,需要移动内部所有点的位置。
|
|
43
|
+
*
|
|
44
|
+
* 关键:这里**只补「目标平移量 − 已应用平移量」的差额**。
|
|
45
|
+
* 旧实现每次都无条件平移 -origin,导致每 compose 一次 dots 就再偏移一个原点
|
|
46
|
+
* (实测连续三次 compose,dots 依次偏移 1/2/3 个原点),因此调用方必须严格保证
|
|
47
|
+
* 「compose 之前先重算 dots(calcDots)」——这正是局部重绘 / 包围盒刷新等路径
|
|
48
|
+
* 必须显式配对调用 `calcComponentParams()` 的原因,也是「跳过重量测」优化无法落地的原因。
|
|
49
|
+
* 记录已应用量之后,重复 compose 变成幂等操作(差额为 0)。
|
|
50
|
+
*
|
|
51
|
+
* @overwrite
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
protected calcLocalOrigin(): any;
|
|
55
|
+
/**
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
protected createPathObject(): any;
|
|
59
|
+
/**
|
|
60
|
+
* dots 上已应用的平移量(当前 dots 相对「绝对本地坐标」的偏移),供 calcLocalOrigin() 做幂等补偿。
|
|
61
|
+
* 见 calcLocalOrigin() 的说明。
|
|
62
|
+
*/
|
|
63
|
+
protected __dotsShiftX: number;
|
|
64
|
+
protected __dotsShiftY: number;
|
|
65
|
+
/**
|
|
66
|
+
* dots 重建的**唯一入口**:先把「已应用平移量」归零(__calcDots() 产出的是**绝对**本地坐标),
|
|
67
|
+
* 再交给子类实现。
|
|
68
|
+
*
|
|
69
|
+
* 子类请覆盖 `__calcDots()`,**不要**覆盖本方法——否则幂等补偿会失效。
|
|
70
|
+
*
|
|
71
|
+
* 计算路径上的关键点:
|
|
72
|
+
* - 默认的坐标原点是 (0,0) 位置。
|
|
73
|
+
* - 这些点没有经过 transform 矩阵变换。
|
|
74
|
+
* - this.calcComponentParams() 会依赖此方法来计算位置和尺寸,此时还没有确定原点坐标,所以 __calcDots() 内部不能依赖原点坐标,只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
protected calcDots(): any;
|
|
78
|
+
/**
|
|
79
|
+
* 子类实现:按**绝对**本地坐标(未减去原点)填充 `state.dots`。
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
protected __calcDots(): any;
|
|
83
|
+
/**
|
|
84
|
+
* 确保 dots 已计算:反序列化时 dots 属缓存值不会被序列化,反序列化后 dots 为空,
|
|
85
|
+
* 在 render 之前若访问 dots(如 getMinBoundingBox → calc4VertexPoints)会取到空数组导致报错。
|
|
86
|
+
* 这里在 dots 缺失时惰性触发 calcDots 补齐。
|
|
87
|
+
*/
|
|
88
|
+
protected ensureDots(): void;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* 计算4个顶点:
|
|
92
|
+
* - 相对于组件本地的坐标系,原点位于左上角,没有经过矩阵变换。
|
|
93
|
+
* - 返回值用于计算组件的原始 width/height 。
|
|
94
|
+
*
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
protected calc4VertexPoints(): any[][];
|
|
98
|
+
protected getTransformedDots(): any[];
|
|
99
|
+
}
|
|
@@ -1,63 +1,99 @@
|
|
|
1
|
-
import ICEPath from './ICEPath';
|
|
2
|
-
/**
|
|
3
|
-
* @class ICEDotPath
|
|
4
|
-
*
|
|
5
|
-
* 基于一系列点进行绘制的路径。
|
|
6
|
-
*
|
|
7
|
-
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
8
|
-
*/
|
|
9
|
-
export default abstract class ICEDotPath extends ICEPath {
|
|
10
|
-
/**
|
|
11
|
-
* @cfg
|
|
12
|
-
* {
|
|
13
|
-
* dots: [], //点状路径的点集
|
|
14
|
-
* closePath:true, //是否闭合
|
|
15
|
-
* }
|
|
16
|
-
*
|
|
17
|
-
* @param props
|
|
18
|
-
*/
|
|
19
|
-
constructor(props: any);
|
|
20
|
-
/**
|
|
21
|
-
* @overwrite
|
|
22
|
-
* @method calcComponentParams
|
|
23
|
-
* - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
|
|
24
|
-
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
25
|
-
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
26
|
-
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
27
|
-
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
28
|
-
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
protected calcComponentParams(): {
|
|
32
|
-
width: any;
|
|
33
|
-
height: any;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @
|
|
39
|
-
*/
|
|
40
|
-
protected
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
import ICEPath from './ICEPath';
|
|
2
|
+
/**
|
|
3
|
+
* @class ICEDotPath
|
|
4
|
+
*
|
|
5
|
+
* 基于一系列点进行绘制的路径。
|
|
6
|
+
*
|
|
7
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
8
|
+
*/
|
|
9
|
+
export default abstract class ICEDotPath extends ICEPath {
|
|
10
|
+
/**
|
|
11
|
+
* @cfg
|
|
12
|
+
* {
|
|
13
|
+
* dots: [], //点状路径的点集
|
|
14
|
+
* closePath:true, //是否闭合
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* @param props
|
|
18
|
+
*/
|
|
19
|
+
constructor(props: any);
|
|
20
|
+
/**
|
|
21
|
+
* @overwrite
|
|
22
|
+
* @method calcComponentParams
|
|
23
|
+
* - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
|
|
24
|
+
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
25
|
+
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
26
|
+
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
27
|
+
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
28
|
+
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
protected calcComponentParams(): {
|
|
32
|
+
width: any;
|
|
33
|
+
height: any;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 精确命中判定:点是否位于点集构成的多边形内部(射线法)。
|
|
37
|
+
* dots 在 calcLocalOrigin() 之后是「以 origin 为原点」的本地坐标,与 containsLocalPoint 的参数空间一致。
|
|
38
|
+
* @overwrite
|
|
39
|
+
*/
|
|
40
|
+
protected containsLocalPoint(localX: number, localY: number): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 点状路径在重新计算本地原点坐标之后,需要移动内部所有点的位置。
|
|
43
|
+
*
|
|
44
|
+
* 关键:这里**只补「目标平移量 − 已应用平移量」的差额**。
|
|
45
|
+
* 旧实现每次都无条件平移 -origin,导致每 compose 一次 dots 就再偏移一个原点
|
|
46
|
+
* (实测连续三次 compose,dots 依次偏移 1/2/3 个原点),因此调用方必须严格保证
|
|
47
|
+
* 「compose 之前先重算 dots(calcDots)」——这正是局部重绘 / 包围盒刷新等路径
|
|
48
|
+
* 必须显式配对调用 `calcComponentParams()` 的原因,也是「跳过重量测」优化无法落地的原因。
|
|
49
|
+
* 记录已应用量之后,重复 compose 变成幂等操作(差额为 0)。
|
|
50
|
+
*
|
|
51
|
+
* @overwrite
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
protected calcLocalOrigin(): any;
|
|
55
|
+
/**
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
protected createPathObject(): any;
|
|
59
|
+
/**
|
|
60
|
+
* dots 上已应用的平移量(当前 dots 相对「绝对本地坐标」的偏移),供 calcLocalOrigin() 做幂等补偿。
|
|
61
|
+
* 见 calcLocalOrigin() 的说明。
|
|
62
|
+
*/
|
|
63
|
+
protected __dotsShiftX: number;
|
|
64
|
+
protected __dotsShiftY: number;
|
|
65
|
+
/**
|
|
66
|
+
* dots 重建的**唯一入口**:先把「已应用平移量」归零(__calcDots() 产出的是**绝对**本地坐标),
|
|
67
|
+
* 再交给子类实现。
|
|
68
|
+
*
|
|
69
|
+
* 子类请覆盖 `__calcDots()`,**不要**覆盖本方法——否则幂等补偿会失效。
|
|
70
|
+
*
|
|
71
|
+
* 计算路径上的关键点:
|
|
72
|
+
* - 默认的坐标原点是 (0,0) 位置。
|
|
73
|
+
* - 这些点没有经过 transform 矩阵变换。
|
|
74
|
+
* - this.calcComponentParams() 会依赖此方法来计算位置和尺寸,此时还没有确定原点坐标,所以 __calcDots() 内部不能依赖原点坐标,只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
protected calcDots(): any;
|
|
78
|
+
/**
|
|
79
|
+
* 子类实现:按**绝对**本地坐标(未减去原点)填充 `state.dots`。
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
protected __calcDots(): any;
|
|
83
|
+
/**
|
|
84
|
+
* 确保 dots 已计算:反序列化时 dots 属缓存值不会被序列化,反序列化后 dots 为空,
|
|
85
|
+
* 在 render 之前若访问 dots(如 getMinBoundingBox → calc4VertexPoints)会取到空数组导致报错。
|
|
86
|
+
* 这里在 dots 缺失时惰性触发 calcDots 补齐。
|
|
87
|
+
*/
|
|
88
|
+
protected ensureDots(): void;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* 计算4个顶点:
|
|
92
|
+
* - 相对于组件本地的坐标系,原点位于左上角,没有经过矩阵变换。
|
|
93
|
+
* - 返回值用于计算组件的原始 width/height 。
|
|
94
|
+
*
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
protected calc4VertexPoints(): any[][];
|
|
98
|
+
protected getTransformedDots(): any[];
|
|
99
|
+
}
|
|
@@ -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 ICEComponent from './ICEComponent.mjs';
|
|
9
|
+
/**
|
|
10
|
+
* @class ICEImage
|
|
11
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
12
|
+
*/
|
|
13
|
+
declare class ICEImage extends ICEComponent {
|
|
14
|
+
constructor(props?: any);
|
|
15
|
+
protected doRender(): void;
|
|
16
|
+
}
|
|
17
|
+
export default ICEImage;
|
|
@@ -1,17 +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 ICEComponent from './ICEComponent';
|
|
9
|
-
/**
|
|
10
|
-
* @class ICEImage
|
|
11
|
-
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
12
|
-
*/
|
|
13
|
-
declare class ICEImage extends ICEComponent {
|
|
14
|
-
constructor(props?: any);
|
|
15
|
-
protected doRender(): void;
|
|
16
|
-
}
|
|
17
|
-
export default ICEImage;
|
|
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 ICEComponent from './ICEComponent';
|
|
9
|
+
/**
|
|
10
|
+
* @class ICEImage
|
|
11
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
12
|
+
*/
|
|
13
|
+
declare class ICEImage extends ICEComponent {
|
|
14
|
+
constructor(props?: any);
|
|
15
|
+
protected doRender(): void;
|
|
16
|
+
}
|
|
17
|
+
export default ICEImage;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import ICEComponent from './ICEComponent.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* @abstract
|
|
4
|
+
* @class ICEPath 路径
|
|
5
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
6
|
+
*/
|
|
7
|
+
declare abstract class ICEPath extends ICEComponent {
|
|
8
|
+
path2D: any;
|
|
9
|
+
/**
|
|
10
|
+
* @cfg
|
|
11
|
+
* {
|
|
12
|
+
* dots:[] //可选参数,路径上的点。
|
|
13
|
+
* }
|
|
14
|
+
* @param props
|
|
15
|
+
*/
|
|
16
|
+
constructor(props?: any);
|
|
17
|
+
/**
|
|
18
|
+
* @method doRender
|
|
19
|
+
* @overwrite
|
|
20
|
+
*/
|
|
21
|
+
protected doRender(): void;
|
|
22
|
+
private __flowRegistered;
|
|
23
|
+
/**
|
|
24
|
+
* 蚂蚁线流动依赖持续重绘:注册一个 loop 动画,让 AnimationManager 每帧 setState 触发 dirty。
|
|
25
|
+
* 真正的流动位置由 doRender 里的 Date.now() 计算,动画本身只负责"每帧重绘"。
|
|
26
|
+
*/
|
|
27
|
+
private __ensureFlowAnimation;
|
|
28
|
+
/**
|
|
29
|
+
* 把 polyfill 记录的命令重放到 ctx 当前路径(beginPath + 命令序列 + closePath)。
|
|
30
|
+
*/
|
|
31
|
+
private replayPath;
|
|
32
|
+
/**
|
|
33
|
+
* @method createPathObject
|
|
34
|
+
* 创建路径对象(原生 Path2D 或 PolyfillPath2D),子类需要提供具体实现,此方法仅创建对象实例,不会立即绘制到画布上,绘制过程由 Renderer 进行调度。
|
|
35
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Path2D/Path2D
|
|
36
|
+
*/
|
|
37
|
+
protected abstract createPathObject(): any;
|
|
38
|
+
}
|
|
39
|
+
export default ICEPath;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @method createPathObject
|
|
34
|
-
*
|
|
35
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Path2D/Path2D
|
|
36
|
-
*/
|
|
37
|
-
protected abstract createPathObject():
|
|
38
|
-
}
|
|
39
|
-
export default ICEPath;
|
|
1
|
+
import ICEComponent from './ICEComponent';
|
|
2
|
+
/**
|
|
3
|
+
* @abstract
|
|
4
|
+
* @class ICEPath 路径
|
|
5
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
6
|
+
*/
|
|
7
|
+
declare abstract class ICEPath extends ICEComponent {
|
|
8
|
+
path2D: any;
|
|
9
|
+
/**
|
|
10
|
+
* @cfg
|
|
11
|
+
* {
|
|
12
|
+
* dots:[] //可选参数,路径上的点。
|
|
13
|
+
* }
|
|
14
|
+
* @param props
|
|
15
|
+
*/
|
|
16
|
+
constructor(props?: any);
|
|
17
|
+
/**
|
|
18
|
+
* @method doRender
|
|
19
|
+
* @overwrite
|
|
20
|
+
*/
|
|
21
|
+
protected doRender(): void;
|
|
22
|
+
private __flowRegistered;
|
|
23
|
+
/**
|
|
24
|
+
* 蚂蚁线流动依赖持续重绘:注册一个 loop 动画,让 AnimationManager 每帧 setState 触发 dirty。
|
|
25
|
+
* 真正的流动位置由 doRender 里的 Date.now() 计算,动画本身只负责"每帧重绘"。
|
|
26
|
+
*/
|
|
27
|
+
private __ensureFlowAnimation;
|
|
28
|
+
/**
|
|
29
|
+
* 把 polyfill 记录的命令重放到 ctx 当前路径(beginPath + 命令序列 + closePath)。
|
|
30
|
+
*/
|
|
31
|
+
private replayPath;
|
|
32
|
+
/**
|
|
33
|
+
* @method createPathObject
|
|
34
|
+
* 创建路径对象(原生 Path2D 或 PolyfillPath2D),子类需要提供具体实现,此方法仅创建对象实例,不会立即绘制到画布上,绘制过程由 Renderer 进行调度。
|
|
35
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Path2D/Path2D
|
|
36
|
+
*/
|
|
37
|
+
protected abstract createPathObject(): any;
|
|
38
|
+
}
|
|
39
|
+
export default ICEPath;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import ICEComponent from '../ICEComponent.mjs';
|
|
2
|
+
import ICERect from '../shape/ICERect.mjs';
|
|
3
|
+
import type ICELayoutManager from '../../layout/ICELayoutManager.mjs';
|
|
4
|
+
/**
|
|
5
|
+
* @class ICEGroup 容器型组件
|
|
6
|
+
*
|
|
7
|
+
* - ICEGroup 可以带有子组件,所有容器型的组件都应该继承 ICEGroup
|
|
8
|
+
* - ICEGroup 可以包含自身,利用此组件可以构造出树形的组件结构。
|
|
9
|
+
*
|
|
10
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
11
|
+
*/
|
|
12
|
+
declare class ICEGroup extends ICERect {
|
|
13
|
+
parentNode: any;
|
|
14
|
+
childNodes: any[];
|
|
15
|
+
private __childSet;
|
|
16
|
+
layoutManager: ICELayoutManager;
|
|
17
|
+
private __layoutExplicit;
|
|
18
|
+
/** 挂起的重排请求(一帧内合并;`doRender` 时消费)。 */
|
|
19
|
+
private __layoutRequested;
|
|
20
|
+
/** 正在执行布局:期间子项的位置/尺寸变化不再反向请求重排,避免自激循环。 */
|
|
21
|
+
private __layingOut;
|
|
22
|
+
constructor(props: any);
|
|
23
|
+
/**
|
|
24
|
+
* 设置布局策略(对齐 Swing 的 container.setLayout)。
|
|
25
|
+
* 设置后立即执行一次布局,并把布局传播给「未显式设置布局」的容器型子组件(子容器默认继承父层布局)。
|
|
26
|
+
*/
|
|
27
|
+
setLayout(manager: ICELayoutManager): void;
|
|
28
|
+
/**
|
|
29
|
+
* 递归禁用所有后代组件的手动变换(transformable=false)。
|
|
30
|
+
* 一旦设定了具体 layout,子组件位置由布局代码决定,用户不可再手动变换。
|
|
31
|
+
*/
|
|
32
|
+
private __disableTransformRecursively;
|
|
33
|
+
/**
|
|
34
|
+
* 把布局策略传播给「未显式设置布局」的容器型后代:
|
|
35
|
+
* - 直接/间接子容器若没有显式布局,则继承当前布局并递归向下传播;
|
|
36
|
+
* - 遇到显式设置了布局的子容器则跳过(它的后代由它自己 setLayout 时传播)。
|
|
37
|
+
*/
|
|
38
|
+
private __propagateLayout;
|
|
39
|
+
/**
|
|
40
|
+
* 批量挂载/删除期间抑制逐次布局(避免 O(n²)),结束后统一排一次。
|
|
41
|
+
*/
|
|
42
|
+
private __inBatch;
|
|
43
|
+
/**
|
|
44
|
+
* 执行布局:先测量子组件,再交给布局策略排布。
|
|
45
|
+
*
|
|
46
|
+
* 测量这一步是必要的:布局策略读的是 `child.state.width/height`,而它们要等首次渲染
|
|
47
|
+
* 才算出来(文本更是要量测字形)。旧实现不做测量,于是「首次布局拿到的全是 0/哨兵值」。
|
|
48
|
+
*/
|
|
49
|
+
doLayout(): void;
|
|
50
|
+
/**
|
|
51
|
+
* 请求重排:**下一帧执行**,一帧内多次请求只排一次。
|
|
52
|
+
*
|
|
53
|
+
* 触发来源是「子项改了 width/height」—— 布局结果依赖子项尺寸,尺寸变了必须重排,
|
|
54
|
+
* 否则会出现「改了某个子项的大小,兄弟节点还停在老位置」。
|
|
55
|
+
* 旧实现只在 `setLayout()` / `addChild()` 时排一次,子项尺寸变化完全不会触发重排。
|
|
56
|
+
*
|
|
57
|
+
* 合并到下一帧是因为:逐个 setState 立刻重排会退化成 O(n²)(布局本身又要 setState 子项位置)。
|
|
58
|
+
*/
|
|
59
|
+
requestLayout(): void;
|
|
60
|
+
/** 容器内容的首选尺寸(转发布局策略;未设置布局时返回 [0,0])。 */
|
|
61
|
+
getPreferredSize(): [number, number];
|
|
62
|
+
protected doRender(): void;
|
|
63
|
+
protected initEvents(): void;
|
|
64
|
+
/**
|
|
65
|
+
* @method afterAddHandler 当 ICEGroup 被添加到 ICE 实例中后触发的事件
|
|
66
|
+
* !注意:在调用 ICEGroup.addChild() 方法时, ICEGroup 自身可能还没有被添加到 ICE 实例中去。所以此时 child.ctx, child.evtBus 都可能为空。
|
|
67
|
+
* !所以这里需要用事件来同步一次子节点的事件。
|
|
68
|
+
*/
|
|
69
|
+
protected afterAddHandler(): void;
|
|
70
|
+
protected syncChildEvents(child: any): void;
|
|
71
|
+
/**
|
|
72
|
+
* @method addChild 添加子节点
|
|
73
|
+
*
|
|
74
|
+
* 添加子节点有两种情况:
|
|
75
|
+
* - 情况一:ICEGroup 自身已经被添加到了 ICE 实例中,此时可以直接调用 this.syncChildEvents(child); 来触发子节点上的事件。
|
|
76
|
+
* - 情况二:ICEGroup 自身还没有被添加到 ICE 实例中,此时需要用 ICE_EVENT_NAME_CONSTS.AFTER_ADD 事件来触发子节点上的事件。
|
|
77
|
+
* !注意:在调用 ICEGroup.addChild() 方法时, ICEGroup 自身可能还没有被添加到 ICE 实例中去。所以此时 child.ctx, child.evtBus 都可能为空。
|
|
78
|
+
* @param child
|
|
79
|
+
*/
|
|
80
|
+
addChild(child: ICEComponent, markDirty?: boolean): void;
|
|
81
|
+
addChildren(arr: Array<ICEComponent>): void;
|
|
82
|
+
removeChild(child: ICEComponent, markDirty?: boolean): void;
|
|
83
|
+
removeChildren(arr: Array<ICEComponent>): void;
|
|
84
|
+
/**
|
|
85
|
+
* @overwrite
|
|
86
|
+
* @method setState
|
|
87
|
+
* setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
|
|
88
|
+
* @param newState
|
|
89
|
+
*/
|
|
90
|
+
setState(newState: any): void;
|
|
91
|
+
/**
|
|
92
|
+
* @overwrite
|
|
93
|
+
* @method destory
|
|
94
|
+
* 销毁组件
|
|
95
|
+
* - FIXME:立即停止组件上的所有动画效果
|
|
96
|
+
* - 需要清理绑定的事件
|
|
97
|
+
* - 带有子节点的组件需要先销毁子节点,然后再销毁自身。
|
|
98
|
+
*/
|
|
99
|
+
destory(): void;
|
|
100
|
+
}
|
|
101
|
+
export default ICEGroup;
|