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
|
@@ -1,54 +1,52 @@
|
|
|
1
|
-
import ICEDotPath from '../ICEDotPath';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @class ICEIsogon
|
|
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
|
-
* -
|
|
34
|
-
* -
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* setState
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
export default ICEIsogon;
|
|
1
|
+
import ICEDotPath from '../ICEDotPath';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @class ICEIsogon 正N边形
|
|
5
|
+
*
|
|
6
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
7
|
+
*/
|
|
8
|
+
declare class ICEIsogon extends ICEDotPath {
|
|
9
|
+
/**
|
|
10
|
+
* @method constructor
|
|
11
|
+
* radius, edges 会暴露给 AnimationManager ,可能会动态变化。
|
|
12
|
+
* @param props
|
|
13
|
+
*/
|
|
14
|
+
constructor(props?: any);
|
|
15
|
+
/**
|
|
16
|
+
* @overwrite
|
|
17
|
+
* @method __calcDots
|
|
18
|
+
*
|
|
19
|
+
* 计算路径上的关键点:
|
|
20
|
+
* - 默认的坐标原点是 (0,0) 位置。
|
|
21
|
+
* - 这些点没有经过 transform 矩阵变换。
|
|
22
|
+
*
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
protected __calcDots(): any;
|
|
26
|
+
/**
|
|
27
|
+
* @overwrite
|
|
28
|
+
* @method calcComponentParams
|
|
29
|
+
* - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
|
|
30
|
+
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
31
|
+
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
32
|
+
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
33
|
+
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
34
|
+
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
protected calcComponentParams(): {
|
|
38
|
+
width: any;
|
|
39
|
+
height: any;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @overwrite
|
|
43
|
+
* @method setState
|
|
44
|
+
* setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
|
|
45
|
+
*
|
|
46
|
+
* - 如果 setState 时指定了 radius 参数,则 width 会被重新计算,如果指定了 radius 参数则 height 会被重新计算。
|
|
47
|
+
* - 如果 setState 时仅仅指定 width 参数,则 radius 会被重新计算,如果仅仅指定了 height 参数,则 radius 会被重新计算。
|
|
48
|
+
* @param newState
|
|
49
|
+
*/
|
|
50
|
+
setState(newState: any): void;
|
|
51
|
+
}
|
|
52
|
+
export default ICEIsogon;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
1
|
+
import ICEPath from '../ICEPath';
|
|
2
|
+
/**
|
|
3
|
+
* @class ICERect 矩形
|
|
4
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
5
|
+
*/
|
|
6
|
+
declare class ICERect extends ICEPath {
|
|
7
|
+
constructor(props?: any);
|
|
8
|
+
protected createPathObject(): any;
|
|
9
|
+
}
|
|
10
|
+
export default ICERect;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import ICEDotPath from '../ICEDotPath.mjs';
|
|
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
|
+
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
20
|
+
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
21
|
+
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
22
|
+
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
23
|
+
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
protected calcComponentParams(): {
|
|
27
|
+
width: any;
|
|
28
|
+
height: any;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @overwrite
|
|
32
|
+
* @method setState
|
|
33
|
+
* setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
|
|
34
|
+
*
|
|
35
|
+
* - 如果 setState 时指定了 radius 参数,则 width 会被重新计算,如果指定了 radius 参数则 height 会被重新计算。
|
|
36
|
+
* - 如果 setState 时仅仅指定 width 参数,则 radius 会被重新计算,如果仅仅指定了 height 参数,则 radius 会被重新计算。
|
|
37
|
+
* @param newState
|
|
38
|
+
*/
|
|
39
|
+
setState(newState: any): void;
|
|
40
|
+
}
|
|
41
|
+
export default ICERose;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import ICEDotPath from '../ICEDotPath';
|
|
2
|
-
declare class ICERose extends ICEDotPath {
|
|
3
|
-
constructor(props?: any);
|
|
4
|
-
/**
|
|
5
|
-
* @overwrite
|
|
6
|
-
* @method
|
|
7
|
-
*
|
|
8
|
-
* 计算路径上的关键点:
|
|
9
|
-
* - 默认的坐标原点是 (0,0) 位置。
|
|
10
|
-
* - 这些点没有经过 transform 矩阵变换。
|
|
11
|
-
*
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
protected
|
|
15
|
-
/**
|
|
16
|
-
* @overwrite
|
|
17
|
-
* @method calcComponentParams
|
|
18
|
-
* - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
|
|
19
|
-
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
20
|
-
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
21
|
-
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
22
|
-
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
23
|
-
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
26
|
-
protected calcComponentParams(): {
|
|
27
|
-
width: any;
|
|
28
|
-
height: any;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* @overwrite
|
|
32
|
-
* @method setState
|
|
33
|
-
* setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
|
|
34
|
-
*
|
|
35
|
-
* - 如果 setState 时指定了 radius 参数,则 width 会被重新计算,如果指定了 radius 参数则 height 会被重新计算。
|
|
36
|
-
* - 如果 setState 时仅仅指定 width 参数,则 radius 会被重新计算,如果仅仅指定了 height 参数,则 radius 会被重新计算。
|
|
37
|
-
* @param newState
|
|
38
|
-
*/
|
|
39
|
-
setState(newState: any): void;
|
|
40
|
-
}
|
|
41
|
-
export default ICERose;
|
|
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
|
+
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
20
|
+
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
21
|
+
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
22
|
+
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
23
|
+
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
protected calcComponentParams(): {
|
|
27
|
+
width: any;
|
|
28
|
+
height: any;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @overwrite
|
|
32
|
+
* @method setState
|
|
33
|
+
* setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
|
|
34
|
+
*
|
|
35
|
+
* - 如果 setState 时指定了 radius 参数,则 width 会被重新计算,如果指定了 radius 参数则 height 会被重新计算。
|
|
36
|
+
* - 如果 setState 时仅仅指定 width 参数,则 radius 会被重新计算,如果仅仅指定了 height 参数,则 radius 会被重新计算。
|
|
37
|
+
* @param newState
|
|
38
|
+
*/
|
|
39
|
+
setState(newState: any): void;
|
|
40
|
+
}
|
|
41
|
+
export default ICERose;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import ICEDotPath from '../ICEDotPath.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* @class ICEStar 正N角星
|
|
4
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
5
|
+
*/
|
|
6
|
+
declare class ICEStar extends ICEDotPath {
|
|
7
|
+
constructor(props?: any);
|
|
8
|
+
/**
|
|
9
|
+
* @overwrite
|
|
10
|
+
* @method __calcDots
|
|
11
|
+
*
|
|
12
|
+
* 计算路径上的关键点:
|
|
13
|
+
* - 默认的坐标原点是 (0,0) 位置。
|
|
14
|
+
* - 这些点没有经过 transform 矩阵变换。
|
|
15
|
+
*
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
protected __calcDots(): any;
|
|
19
|
+
/**
|
|
20
|
+
* @overwrite
|
|
21
|
+
* @method calcComponentParams
|
|
22
|
+
* - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
|
|
23
|
+
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
24
|
+
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
25
|
+
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
26
|
+
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
27
|
+
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
protected calcComponentParams(): {
|
|
31
|
+
width: any;
|
|
32
|
+
height: any;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* @overwrite
|
|
36
|
+
* @method setState
|
|
37
|
+
* setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
|
|
38
|
+
*
|
|
39
|
+
* - 如果 setState 时指定了 radius 参数,则 width 会被重新计算,如果指定了 radius 参数则 height 会被重新计算。
|
|
40
|
+
* - 如果 setState 时仅仅指定 width 参数,则 radius 会被重新计算,如果仅仅指定了 height 参数,则 radius 会被重新计算。
|
|
41
|
+
* @param newState
|
|
42
|
+
*/
|
|
43
|
+
setState(newState: any): void;
|
|
44
|
+
}
|
|
45
|
+
export default ICEStar;
|
|
@@ -1,48 +1,45 @@
|
|
|
1
|
-
import ICEDotPath from '../ICEDotPath';
|
|
2
|
-
/**
|
|
3
|
-
* @class ICEStar
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* setState
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
setState(newState: any): void;
|
|
47
|
-
}
|
|
48
|
-
export default ICEStar;
|
|
1
|
+
import ICEDotPath from '../ICEDotPath';
|
|
2
|
+
/**
|
|
3
|
+
* @class ICEStar 正N角星
|
|
4
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
5
|
+
*/
|
|
6
|
+
declare class ICEStar extends ICEDotPath {
|
|
7
|
+
constructor(props?: any);
|
|
8
|
+
/**
|
|
9
|
+
* @overwrite
|
|
10
|
+
* @method __calcDots
|
|
11
|
+
*
|
|
12
|
+
* 计算路径上的关键点:
|
|
13
|
+
* - 默认的坐标原点是 (0,0) 位置。
|
|
14
|
+
* - 这些点没有经过 transform 矩阵变换。
|
|
15
|
+
*
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
protected __calcDots(): any;
|
|
19
|
+
/**
|
|
20
|
+
* @overwrite
|
|
21
|
+
* @method calcComponentParams
|
|
22
|
+
* - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
|
|
23
|
+
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
24
|
+
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
25
|
+
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
26
|
+
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
27
|
+
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
protected calcComponentParams(): {
|
|
31
|
+
width: any;
|
|
32
|
+
height: any;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* @overwrite
|
|
36
|
+
* @method setState
|
|
37
|
+
* setState 仅仅修改参数,不会立即导致重新渲染,需要等待 FrameManager 调度,最小延迟时间约为 1/60=16.67 ms 。
|
|
38
|
+
*
|
|
39
|
+
* - 如果 setState 时指定了 radius 参数,则 width 会被重新计算,如果指定了 radius 参数则 height 会被重新计算。
|
|
40
|
+
* - 如果 setState 时仅仅指定 width 参数,则 radius 会被重新计算,如果仅仅指定了 height 参数,则 radius 会被重新计算。
|
|
41
|
+
* @param newState
|
|
42
|
+
*/
|
|
43
|
+
setState(newState: any): void;
|
|
44
|
+
}
|
|
45
|
+
export default ICEStar;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import ICEComponent from '../ICEComponent.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* TODO:draw text along Path2D
|
|
4
|
+
* @class ICEText 文本
|
|
5
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
6
|
+
*/
|
|
7
|
+
declare class ICEText extends ICEComponent {
|
|
8
|
+
/**
|
|
9
|
+
* @cfg
|
|
10
|
+
* {
|
|
11
|
+
* text:'文本内容',
|
|
12
|
+
* left:0,
|
|
13
|
+
* top:0,
|
|
14
|
+
* style:{
|
|
15
|
+
* fontWeight:24,
|
|
16
|
+
* fontSize:48,
|
|
17
|
+
* fontFamily:'Arial',
|
|
18
|
+
* lineWidth:1,
|
|
19
|
+
* textBaseline:'bottom',
|
|
20
|
+
* paddingTop:0, //number 型,不可加单位
|
|
21
|
+
* paddingBottom:0, //number 型,不可加单位
|
|
22
|
+
* paddingLeft:0, //number 型,不可加单位
|
|
23
|
+
* paddingRight:0, //number 型,不可加单位
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
* @param props
|
|
27
|
+
*/
|
|
28
|
+
constructor(props?: any);
|
|
29
|
+
protected static arrangeParam(props: any): any;
|
|
30
|
+
/**
|
|
31
|
+
* @overwrite
|
|
32
|
+
* 双击进入内联编辑态。
|
|
33
|
+
*/
|
|
34
|
+
protected initEvents(): void;
|
|
35
|
+
/**
|
|
36
|
+
* 进入编辑前的 draggable 原值,退出编辑时恢复。
|
|
37
|
+
*/
|
|
38
|
+
private __originalDraggable;
|
|
39
|
+
/**
|
|
40
|
+
* 编辑态叠加的 HTML input(用于支持中文 IME 输入)。浏览器环境下存在;
|
|
41
|
+
* 无 document 的运行时(Node/小程序)为 null,降级为 canvas keydown 输入。
|
|
42
|
+
*/
|
|
43
|
+
private __editInput;
|
|
44
|
+
/**
|
|
45
|
+
* 进入内联编辑态:光标定位到文本末尾,隐藏变换面板、禁用拖拽(避免编辑时误拖动)。
|
|
46
|
+
*/
|
|
47
|
+
startEditing(): void;
|
|
48
|
+
/**
|
|
49
|
+
* 退出内联编辑态(提交文本)。退出后不自动恢复变换面板——用户若需再变换组件,重新点击组件即可。
|
|
50
|
+
*/
|
|
51
|
+
stopEditing(): void;
|
|
52
|
+
/**
|
|
53
|
+
* 创建透明的 HTML input 覆盖在文本上,捕获输入(含中文 IME)。
|
|
54
|
+
* input 文字设为透明(canvas 负责显示),只保留可见光标。
|
|
55
|
+
*/
|
|
56
|
+
private __mountEditInput;
|
|
57
|
+
/**
|
|
58
|
+
* 移除编辑态的 HTML input。
|
|
59
|
+
*/
|
|
60
|
+
private __unmountEditInput;
|
|
61
|
+
/**
|
|
62
|
+
* 全局 mousedown 处理器:点击的组件不是自身时,退出编辑(失焦退出)。
|
|
63
|
+
*/
|
|
64
|
+
private __globalMouseDownHandler;
|
|
65
|
+
/**
|
|
66
|
+
* 设置文本内容(会重新测量宽高)。
|
|
67
|
+
*/
|
|
68
|
+
setText(text: string): this;
|
|
69
|
+
getText(): string;
|
|
70
|
+
/**
|
|
71
|
+
* @overwrite
|
|
72
|
+
* 编辑态下接管键盘输入:字符插入 / Backspace / Delete / 方向键移动光标 / Enter 提交。
|
|
73
|
+
*/
|
|
74
|
+
protected keyboardEvtHandler(evt: any): void;
|
|
75
|
+
/**
|
|
76
|
+
* 在编辑态下渲染光标(垂直竖线),位置由 caretIndex + ctx.measureText 计算。
|
|
77
|
+
*/
|
|
78
|
+
private renderCaret;
|
|
79
|
+
/**
|
|
80
|
+
* @overwrite
|
|
81
|
+
* @method calcComponentParams
|
|
82
|
+
* - 计算组件最原始的宽高和位置,此时没有经过任何变换,也没有移动坐标原点。
|
|
83
|
+
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
84
|
+
* - 此方法不能依赖原点位置和 transform 矩阵。
|
|
85
|
+
* - 此方法会在 render() 中调用,所以不需要在构造函数中调用。
|
|
86
|
+
* - 此方法中不能使用 setState() ,如果需要修改状态,直接赋值,如:this.state.width = 100;
|
|
87
|
+
* - 子类可以覆盖此方法,实现自己的计算逻辑。
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
protected calcComponentParams(): {
|
|
91
|
+
width: any;
|
|
92
|
+
height: any;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* @method measureText
|
|
96
|
+
*
|
|
97
|
+
* - Canvas 中没有提供原生的计算文本高度的有效方法,文本宽高的计算需要使用特殊的方法,这里使用的方法来自 https://longviewcoder.com/2021/02/11/html5-canvas-text-line-height-measurement/
|
|
98
|
+
* - 计算原始的宽高、位置,此时没有经过任何变换,也没有移动坐标原点。
|
|
99
|
+
* - 在计算组件的原始尺寸时还没有确定原点坐标,所以只能基于组件本地坐标系的左上角 (0,0) 点进行计算。
|
|
100
|
+
*
|
|
101
|
+
* FIXME:这里有性能瓶颈,需要进一步优化
|
|
102
|
+
* FIXME:某些运行时环境可能不支持动态插入 HTML 标签,以上测量文本宽高的方法可能存在兼容性问题。
|
|
103
|
+
* FIXME:对文本位置的控制需要更精细的计算方法。
|
|
104
|
+
*/
|
|
105
|
+
private measureText;
|
|
106
|
+
/**
|
|
107
|
+
* 计算换行后的行数组;返回 null 表示「不换行,按 \n 拆」。
|
|
108
|
+
*/
|
|
109
|
+
private __computeWrappedLines;
|
|
110
|
+
/** 统一的测宽函数:优先 ctx.measureText;无 ctx 时按 fontSize 粗估。 */
|
|
111
|
+
private __measureFn;
|
|
112
|
+
/**
|
|
113
|
+
* 按 grapheme cluster 切分。
|
|
114
|
+
* 优先 Intl.Segmenter(Baseline 2024),能把 emoji / ZWJ 序列 / 组合字符合成一个单元;
|
|
115
|
+
* 不可用时退化为码点切分(至少不会把代理对拆开)。
|
|
116
|
+
*/
|
|
117
|
+
private __graphemes;
|
|
118
|
+
/** 贪心换行:逐 grapheme 累加,超过可用宽度即断行。保留段落自身的 \n。 */
|
|
119
|
+
private __wrapText;
|
|
120
|
+
/**
|
|
121
|
+
* 超过 maxLines 时截断末行并追加省略号;逐 grapheme 回退直到「内容+省略号」放得下。
|
|
122
|
+
*/
|
|
123
|
+
private __truncateLines;
|
|
124
|
+
/** 用 Canvas TextMetrics.actualBoundingBox* 测量文本真实宽高;不支持则返回 null 降级。 */
|
|
125
|
+
private __measureByCanvas;
|
|
126
|
+
private __applyMeasuredSize;
|
|
127
|
+
/** DOM 降级测量:line-height 归一为 1,减少 leading 干扰(旧环境/小程序)。 */
|
|
128
|
+
private __measureByDOM;
|
|
129
|
+
/**
|
|
130
|
+
* @method doRender
|
|
131
|
+
* @overwrite
|
|
132
|
+
* 文本是基于 baseline 绘制的,文本是从 y 坐标向屏幕上方绘制的,48 是文本高度,这里需要补偿文本高度。
|
|
133
|
+
* 同时把移动坐标轴原点的偏移量计算进去。
|
|
134
|
+
*/
|
|
135
|
+
protected doRender(): void;
|
|
136
|
+
}
|
|
137
|
+
export default ICEText;
|