ice-render 1.0.4 → 1.0.6

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 (145) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +229 -141
  3. package/dist/THIRD-PARTY-NOTICES.txt +32 -0
  4. package/dist/index.cjs +30 -0
  5. package/dist/index.mjs +30 -0
  6. package/dist/index.umd.js +6 -1
  7. package/dist/types/FrameManager.d.mts +26 -0
  8. package/dist/types/FrameManager.d.ts +26 -26
  9. package/dist/types/ICE.d.mts +369 -0
  10. package/dist/types/ICE.d.ts +369 -107
  11. package/dist/types/a11y/accessibility.d.mts +46 -0
  12. package/dist/types/a11y/accessibility.d.ts +46 -0
  13. package/dist/types/animation/AnimationManager.d.mts +96 -0
  14. package/dist/types/animation/AnimationManager.d.ts +96 -25
  15. package/dist/types/animation/Easing.d.mts +33 -0
  16. package/dist/types/animation/Easing.d.ts +33 -32
  17. package/dist/types/consts/BIG_ZINDEX_NUMBER.d.mts +14 -0
  18. package/dist/types/consts/BIG_ZINDEX_NUMBER.d.ts +14 -14
  19. package/dist/types/consts/COMPONENT_TYPE_MAPPING.d.mts +45 -0
  20. package/dist/types/consts/COMPONENT_TYPE_MAPPING.d.ts +45 -36
  21. package/dist/types/consts/DOM_EVENT_MAPPING_CONSTS.d.mts +37 -0
  22. package/dist/types/consts/DOM_EVENT_MAPPING_CONSTS.d.ts +37 -19
  23. package/dist/types/consts/ICE_EVENT_NAME_CONSTS.d.mts +27 -0
  24. package/dist/types/consts/ICE_EVENT_NAME_CONSTS.d.ts +27 -20
  25. package/dist/types/control-panel/AlignmentGuideManager.d.mts +92 -0
  26. package/dist/types/control-panel/AlignmentGuideManager.d.ts +92 -0
  27. package/dist/types/control-panel/ICEControlPanel.d.mts +37 -0
  28. package/dist/types/control-panel/ICEControlPanel.d.ts +37 -37
  29. package/dist/types/control-panel/ICEControlPanelManager.d.mts +25 -0
  30. package/dist/types/control-panel/ICEControlPanelManager.d.ts +25 -23
  31. package/dist/types/control-panel/link-controls/LineControlPanel.d.mts +39 -0
  32. package/dist/types/control-panel/link-controls/LineControlPanel.d.ts +39 -39
  33. package/dist/types/control-panel/transform-controls/ResizeControl.d.mts +38 -0
  34. package/dist/types/control-panel/transform-controls/ResizeControl.d.ts +38 -38
  35. package/dist/types/control-panel/transform-controls/RotateControl.d.mts +12 -0
  36. package/dist/types/control-panel/transform-controls/RotateControl.d.ts +12 -12
  37. package/dist/types/control-panel/transform-controls/TransformControlPanel.d.mts +83 -0
  38. package/dist/types/control-panel/transform-controls/TransformControlPanel.d.ts +83 -74
  39. package/dist/types/control-panel/transform-controls/constraints.d.mts +24 -0
  40. package/dist/types/control-panel/transform-controls/constraints.d.ts +24 -0
  41. package/dist/types/cross-platform/PolyfillPath2D.d.mts +31 -0
  42. package/dist/types/cross-platform/PolyfillPath2D.d.ts +31 -0
  43. package/dist/types/cross-platform/root.d.mts +7 -0
  44. package/dist/types/cross-platform/root.d.ts +7 -2
  45. package/dist/types/event/DOMEventDispatcher.d.mts +68 -0
  46. package/dist/types/event/DOMEventDispatcher.d.ts +68 -29
  47. package/dist/types/event/DOMEventInterceptor.d.mts +36 -0
  48. package/dist/types/event/DOMEventInterceptor.d.ts +36 -7
  49. package/dist/types/event/EventBus.d.mts +27 -0
  50. package/dist/types/event/EventBus.d.ts +27 -27
  51. package/dist/types/event/ICEEvent.d.mts +46 -0
  52. package/dist/types/event/ICEEvent.d.ts +46 -46
  53. package/dist/types/event/ICEEventTarget.d.mts +106 -0
  54. package/dist/types/event/ICEEventTarget.d.ts +106 -106
  55. package/dist/types/event/input-normalize.d.mts +75 -0
  56. package/dist/types/event/input-normalize.d.ts +75 -0
  57. package/dist/types/geometry/GeoLine.d.mts +24 -0
  58. package/dist/types/geometry/GeoLine.d.ts +24 -23
  59. package/dist/types/geometry/GeoPoint.d.mts +53 -0
  60. package/dist/types/geometry/GeoPoint.d.ts +53 -66
  61. package/dist/types/geometry/GeoUtil.d.mts +73 -0
  62. package/dist/types/geometry/GeoUtil.d.ts +73 -37
  63. package/dist/types/geometry/ICEBoundingBox.d.mts +81 -0
  64. package/dist/types/geometry/ICEBoundingBox.d.ts +81 -81
  65. package/dist/types/graphic/ICEComponent.d.mts +436 -0
  66. package/dist/types/graphic/ICEComponent.d.ts +436 -264
  67. package/dist/types/graphic/ICEDotPath.d.mts +99 -0
  68. package/dist/types/graphic/ICEDotPath.d.ts +99 -63
  69. package/dist/types/graphic/ICEImage.d.mts +17 -0
  70. package/dist/types/graphic/ICEImage.d.ts +17 -17
  71. package/dist/types/graphic/ICEPath.d.mts +39 -0
  72. package/dist/types/graphic/ICEPath.d.ts +39 -36
  73. package/dist/types/graphic/container/ICEGroup.d.mts +101 -0
  74. package/dist/types/graphic/container/ICEGroup.d.ts +101 -53
  75. package/dist/types/graphic/link/ICEBezier.d.mts +23 -0
  76. package/dist/types/graphic/link/ICEBezier.d.ts +23 -15
  77. package/dist/types/graphic/link/ICELinkHook.d.mts +52 -0
  78. package/dist/types/graphic/link/ICELinkHook.d.ts +52 -52
  79. package/dist/types/graphic/link/ICELinkSlot.d.mts +54 -0
  80. package/dist/types/graphic/link/ICELinkSlot.d.ts +54 -46
  81. package/dist/types/graphic/link/ICELinkSlotManager.d.mts +28 -0
  82. package/dist/types/graphic/link/ICELinkSlotManager.d.ts +28 -28
  83. package/dist/types/graphic/link/ICEPolyLine.d.mts +292 -0
  84. package/dist/types/graphic/link/ICEPolyLine.d.ts +292 -219
  85. package/dist/types/graphic/link/ICEVisioLink.d.mts +163 -0
  86. package/dist/types/graphic/link/ICEVisioLink.d.ts +163 -129
  87. package/dist/types/graphic/shape/ICECircle.d.mts +19 -0
  88. package/dist/types/graphic/shape/ICECircle.d.ts +19 -19
  89. package/dist/types/graphic/shape/ICEEllipse.d.mts +29 -0
  90. package/dist/types/graphic/shape/ICEEllipse.d.ts +29 -23
  91. package/dist/types/graphic/shape/ICEIsogon.d.mts +52 -0
  92. package/dist/types/graphic/shape/ICEIsogon.d.ts +52 -52
  93. package/dist/types/graphic/shape/ICERect.d.mts +10 -0
  94. package/dist/types/graphic/shape/ICERect.d.ts +10 -17
  95. package/dist/types/graphic/shape/ICERose.d.mts +41 -0
  96. package/dist/types/graphic/shape/ICERose.d.ts +41 -41
  97. package/dist/types/graphic/shape/ICEStar.d.mts +45 -0
  98. package/dist/types/graphic/shape/ICEStar.d.ts +45 -45
  99. package/dist/types/graphic/text/ICEText.d.mts +137 -0
  100. package/dist/types/graphic/text/ICEText.d.ts +137 -65
  101. package/dist/types/index.d.mts +55 -0
  102. package/dist/types/index.d.ts +55 -41
  103. package/dist/types/layout/ICEBorderLayout.d.mts +34 -0
  104. package/dist/types/layout/ICEBorderLayout.d.ts +34 -0
  105. package/dist/types/layout/ICEBoxLayout.d.mts +30 -0
  106. package/dist/types/layout/ICEBoxLayout.d.ts +30 -0
  107. package/dist/types/layout/ICECardLayout.d.mts +36 -0
  108. package/dist/types/layout/ICECardLayout.d.ts +36 -0
  109. package/dist/types/layout/ICEFlowLayout.d.mts +31 -0
  110. package/dist/types/layout/ICEFlowLayout.d.ts +31 -0
  111. package/dist/types/layout/ICEGridLayout.d.mts +33 -0
  112. package/dist/types/layout/ICEGridLayout.d.ts +33 -0
  113. package/dist/types/layout/ICELayeredLayout.d.mts +49 -0
  114. package/dist/types/layout/ICELayeredLayout.d.ts +49 -0
  115. package/dist/types/layout/ICELayoutManager.d.mts +33 -0
  116. package/dist/types/layout/ICELayoutManager.d.ts +33 -0
  117. package/dist/types/layout/ICEOverlayLayout.d.mts +25 -0
  118. package/dist/types/layout/ICEOverlayLayout.d.ts +25 -0
  119. package/dist/types/persistence/Deserializer.d.mts +43 -0
  120. package/dist/types/persistence/Deserializer.d.ts +43 -14
  121. package/dist/types/persistence/Serializer.d.mts +35 -0
  122. package/dist/types/persistence/Serializer.d.ts +35 -26
  123. package/dist/types/plugin/PluginHost.d.mts +86 -0
  124. package/dist/types/plugin/PluginHost.d.ts +86 -0
  125. package/dist/types/renderer/CanvasRenderer.d.mts +150 -0
  126. package/dist/types/renderer/CanvasRenderer.d.ts +150 -22
  127. package/dist/types/renderer/ObjectCache.d.mts +79 -0
  128. package/dist/types/renderer/ObjectCache.d.ts +79 -0
  129. package/dist/types/renderer/dirty-rect-util.d.mts +86 -0
  130. package/dist/types/renderer/dirty-rect-util.d.ts +86 -0
  131. package/dist/types/theme/ICETheme.d.mts +382 -0
  132. package/dist/types/theme/ICETheme.d.ts +382 -0
  133. package/dist/types/util/ImageCache.d.mts +19 -0
  134. package/dist/types/util/ImageCache.d.ts +19 -19
  135. package/dist/types/util/data-util.d.mts +43 -0
  136. package/dist/types/util/data-util.d.ts +43 -19
  137. package/dist/types/util/gl-matrix-skew.d.mts +14 -0
  138. package/dist/types/util/gl-matrix-skew.d.ts +14 -14
  139. package/dist/types/util/lang.d.mts +28 -0
  140. package/dist/types/util/lang.d.ts +28 -0
  141. package/dist/types/util/uuid.d.mts +1 -0
  142. package/dist/types/util/uuid.d.ts +1 -1
  143. package/package.json +118 -81
  144. package/dist/index.cjs.js +0 -25
  145. package/dist/index.js +0 -25
@@ -0,0 +1,92 @@
1
+ /**
2
+ * 对齐吸附管理器(smart guides + snapping)。
3
+ *
4
+ * 拖拽组件时,把「被拖组件的关键坐标」与「其他组件的关键坐标」做最近匹配,
5
+ * 命中阈值内自动吸附,并在工具层显示提示线。默认禁用,应用层显式 enable 后才生效。
6
+ *
7
+ * 性能设计(保证拖拽顺滑):
8
+ * 1. mousedown 时缓存所有目标组件的世界盒,拖拽过程复用(目标组件不移动,不重复 compose);
9
+ * 2. 提示线是两根复用的隐藏 ICERect,只改坐标 + display,不 addTool/removeTool,不重建渲染队列;
10
+ * 3. 滞回(hysteresis):已吸附的轴用更大的脱离阈值,避免阈值边界来回抖。
11
+ */
12
+ import ICE from '../ICE.mjs';
13
+ export interface SnapBox {
14
+ minX: number;
15
+ minY: number;
16
+ maxX: number;
17
+ maxY: number;
18
+ centerX: number;
19
+ centerY: number;
20
+ }
21
+ export interface SnapResult {
22
+ axis: 'x' | 'y';
23
+ type: 'edge' | 'center' | 'spacing';
24
+ /** 对齐目标坐标 - 源坐标,吸附时应加到 left/top。 */
25
+ delta: number;
26
+ /** 对齐线的世界坐标(X 对齐是 x 值,Y 对齐是 y 值)。 */
27
+ guideValue: number;
28
+ /** 提示线在另一轴上的起点/终点(世界坐标)。 */
29
+ guideStart: number;
30
+ guideEnd: number;
31
+ }
32
+ export interface SnapAxes {
33
+ x: SnapResult | null;
34
+ y: SnapResult | null;
35
+ }
36
+ export interface AlignmentGuideOptions {
37
+ /** 磁吸阈值(屏幕像素),默认 5。 */
38
+ threshold?: number;
39
+ /** 滞回余量(屏幕像素):已吸附轴脱离阈值 = threshold + hysteresis,默认 2。 */
40
+ hysteresis?: number;
41
+ /** 边缘对齐,默认 true。 */
42
+ edge?: boolean;
43
+ /** 中心对齐,默认 true。 */
44
+ center?: boolean;
45
+ /** 等间距对齐,默认 true。 */
46
+ spacing?: boolean;
47
+ /** 提示线完整样式(透传给 canvas ctx),默认 { fillStyle: '#EC4899' }。 */
48
+ guideStyle?: Record<string, any>;
49
+ /** 提示线 zIndex,默认在控制面板之上。 */
50
+ guideZIndex?: number;
51
+ /** 提示线宽(屏幕像素,按视口换算),默认 1。 */
52
+ guideWidth?: number;
53
+ }
54
+ /**
55
+ * 纯几何吸附计算:X/Y 两轴各自返回 |delta| 最小的命中候选。
56
+ * thresholdX / thresholdY 分别是两轴的世界坐标阈值(调用方按视口与滞回换算)。
57
+ */
58
+ export declare function computeSnap(source: SnapBox, targets: SnapBox[], thresholdX: number, thresholdY: number, options: Required<AlignmentGuideOptions>): SnapAxes;
59
+ declare class AlignmentGuideManager {
60
+ private ice;
61
+ private options;
62
+ private enabled;
63
+ private active;
64
+ private snapping;
65
+ private intentLeft;
66
+ private intentTop;
67
+ private cachedTargets;
68
+ private engagedX;
69
+ private engagedY;
70
+ private guideX;
71
+ private guideY;
72
+ constructor(ice: ICE);
73
+ enable(options?: AlignmentGuideOptions): this;
74
+ disable(): this;
75
+ isEnabled(): boolean;
76
+ setOptions(options: AlignmentGuideOptions): this;
77
+ private __onMouseDown;
78
+ private __onDrag;
79
+ private __onMouseUp;
80
+ private __detach;
81
+ private __boxOf;
82
+ private __computeTargets;
83
+ /**
84
+ * 判断组件是否可以参与对齐决策。
85
+ * 排除:连接线、控制面板、变换手柄、不可交互组件、不可拖动组件。
86
+ */
87
+ private __isAlignmentParticipant;
88
+ private __ensureGuides;
89
+ private __updateGuides;
90
+ private __hideGuides;
91
+ }
92
+ export default AlignmentGuideManager;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * 对齐吸附管理器(smart guides + snapping)。
3
+ *
4
+ * 拖拽组件时,把「被拖组件的关键坐标」与「其他组件的关键坐标」做最近匹配,
5
+ * 命中阈值内自动吸附,并在工具层显示提示线。默认禁用,应用层显式 enable 后才生效。
6
+ *
7
+ * 性能设计(保证拖拽顺滑):
8
+ * 1. mousedown 时缓存所有目标组件的世界盒,拖拽过程复用(目标组件不移动,不重复 compose);
9
+ * 2. 提示线是两根复用的隐藏 ICERect,只改坐标 + display,不 addTool/removeTool,不重建渲染队列;
10
+ * 3. 滞回(hysteresis):已吸附的轴用更大的脱离阈值,避免阈值边界来回抖。
11
+ */
12
+ import ICE from '../ICE';
13
+ export interface SnapBox {
14
+ minX: number;
15
+ minY: number;
16
+ maxX: number;
17
+ maxY: number;
18
+ centerX: number;
19
+ centerY: number;
20
+ }
21
+ export interface SnapResult {
22
+ axis: 'x' | 'y';
23
+ type: 'edge' | 'center' | 'spacing';
24
+ /** 对齐目标坐标 - 源坐标,吸附时应加到 left/top。 */
25
+ delta: number;
26
+ /** 对齐线的世界坐标(X 对齐是 x 值,Y 对齐是 y 值)。 */
27
+ guideValue: number;
28
+ /** 提示线在另一轴上的起点/终点(世界坐标)。 */
29
+ guideStart: number;
30
+ guideEnd: number;
31
+ }
32
+ export interface SnapAxes {
33
+ x: SnapResult | null;
34
+ y: SnapResult | null;
35
+ }
36
+ export interface AlignmentGuideOptions {
37
+ /** 磁吸阈值(屏幕像素),默认 5。 */
38
+ threshold?: number;
39
+ /** 滞回余量(屏幕像素):已吸附轴脱离阈值 = threshold + hysteresis,默认 2。 */
40
+ hysteresis?: number;
41
+ /** 边缘对齐,默认 true。 */
42
+ edge?: boolean;
43
+ /** 中心对齐,默认 true。 */
44
+ center?: boolean;
45
+ /** 等间距对齐,默认 true。 */
46
+ spacing?: boolean;
47
+ /** 提示线完整样式(透传给 canvas ctx),默认 { fillStyle: '#EC4899' }。 */
48
+ guideStyle?: Record<string, any>;
49
+ /** 提示线 zIndex,默认在控制面板之上。 */
50
+ guideZIndex?: number;
51
+ /** 提示线宽(屏幕像素,按视口换算),默认 1。 */
52
+ guideWidth?: number;
53
+ }
54
+ /**
55
+ * 纯几何吸附计算:X/Y 两轴各自返回 |delta| 最小的命中候选。
56
+ * thresholdX / thresholdY 分别是两轴的世界坐标阈值(调用方按视口与滞回换算)。
57
+ */
58
+ export declare function computeSnap(source: SnapBox, targets: SnapBox[], thresholdX: number, thresholdY: number, options: Required<AlignmentGuideOptions>): SnapAxes;
59
+ declare class AlignmentGuideManager {
60
+ private ice;
61
+ private options;
62
+ private enabled;
63
+ private active;
64
+ private snapping;
65
+ private intentLeft;
66
+ private intentTop;
67
+ private cachedTargets;
68
+ private engagedX;
69
+ private engagedY;
70
+ private guideX;
71
+ private guideY;
72
+ constructor(ice: ICE);
73
+ enable(options?: AlignmentGuideOptions): this;
74
+ disable(): this;
75
+ isEnabled(): boolean;
76
+ setOptions(options: AlignmentGuideOptions): this;
77
+ private __onMouseDown;
78
+ private __onDrag;
79
+ private __onMouseUp;
80
+ private __detach;
81
+ private __boxOf;
82
+ private __computeTargets;
83
+ /**
84
+ * 判断组件是否可以参与对齐决策。
85
+ * 排除:连接线、控制面板、变换手柄、不可交互组件、不可拖动组件。
86
+ */
87
+ private __isAlignmentParticipant;
88
+ private __ensureGuides;
89
+ private __updateGuides;
90
+ private __hideGuides;
91
+ }
92
+ export default AlignmentGuideManager;
@@ -0,0 +1,37 @@
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 ICEGroup from '../graphic/container/ICEGroup.mjs';
9
+ import ICEComponent from '../graphic/ICEComponent.mjs';
10
+ /**
11
+ * @class ICEControlPanel 控制面板
12
+ *
13
+ * - ICEControlPanel 用来辅助用户操作图形,控制面板可以控制图形的属性,比如组件的属性,线条的属性,文本的属性等等。
14
+ * - ICEControlPanel 本身总是直接画在 canvas 上,不是任何组件的孩子。
15
+ * - ICEControlPanel 本身不会被序列化。
16
+ * - ICEControlPanel 的 zIndex 总是大于其它组件,当 ICEControlPanel 显示时,总是会优先判定为被选中的组件,会导致对应的 _targetComponent 收不到鼠标和键盘事件,所以 ICEControlPanel 的实现类需要自己考虑是否需要进行事件转发。
17
+ * - 控制面板的所有实例都在 ICEControlPanelManager 中创建和管理。
18
+ *
19
+ * @see ICEControlPanelManager
20
+ * @author 大漠穷秋<damoqiongqiu@126.com>
21
+ */
22
+ export default abstract class ICEControlPanel extends ICEGroup {
23
+ /**
24
+ * 类型标识
25
+ * 用来解决 TypeScript 的 instanceof 兼容性问题, https://github.com/microsoft/TypeScript/issues/22585
26
+ * 仅供内部使用,业务代码不可依赖此属性
27
+ */
28
+ isControlPanel: boolean;
29
+ protected _targetComponent: ICEComponent;
30
+ constructor(props: any);
31
+ protected abstract initControls(): void;
32
+ protected abstract updateControlPositions(): void;
33
+ protected doRender(): void;
34
+ moveGlobalPosition(tx: number, ty: number, evt?: any): void;
35
+ abstract enable(): any;
36
+ abstract disable(): any;
37
+ }
@@ -1,37 +1,37 @@
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 ICEGroup from '../graphic/container/ICEGroup';
9
- import ICEComponent from '../graphic/ICEComponent';
10
- /**
11
- * @class ICEControlPanel 控制面板
12
- *
13
- * - ICEControlPanel 用来辅助用户操作图形,控制面板可以控制图形的属性,比如组件的属性,线条的属性,文本的属性等等。
14
- * - ICEControlPanel 本身总是直接画在 canvas 上,不是任何组件的孩子。
15
- * - ICEControlPanel 本身不会被序列化。
16
- * - ICEControlPanel 的 zIndex 总是大于其它组件,当 ICEControlPanel 显示时,总是会优先判定为被选中的组件,会导致对应的 _targetComponent 收不到鼠标和键盘事件,所以 ICEControlPanel 的实现类需要自己考虑是否需要进行事件转发。
17
- * - 控制面板的所有实例都在 ICEControlPanelManager 中创建和管理。
18
- *
19
- * @see ICEControlPanelManager
20
- * @author 大漠穷秋<damoqiongqiu@126.com>
21
- */
22
- export default abstract class ICEControlPanel extends ICEGroup {
23
- /**
24
- * 类型标识
25
- * 用来解决 TypeScript 的 instanceof 兼容性问题, https://github.com/microsoft/TypeScript/issues/22585
26
- * 仅供内部使用,业务代码不可依赖此属性
27
- */
28
- isControlPanel: boolean;
29
- protected _targetComponent: ICEComponent;
30
- constructor(props: any);
31
- protected abstract initControls(): void;
32
- protected abstract updateControlPositions(): void;
33
- protected doRender(): void;
34
- moveGlobalPosition(tx: number, ty: number, evt?: any): void;
35
- abstract enable(): any;
36
- abstract disable(): any;
37
- }
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 ICEGroup from '../graphic/container/ICEGroup';
9
+ import ICEComponent from '../graphic/ICEComponent';
10
+ /**
11
+ * @class ICEControlPanel 控制面板
12
+ *
13
+ * - ICEControlPanel 用来辅助用户操作图形,控制面板可以控制图形的属性,比如组件的属性,线条的属性,文本的属性等等。
14
+ * - ICEControlPanel 本身总是直接画在 canvas 上,不是任何组件的孩子。
15
+ * - ICEControlPanel 本身不会被序列化。
16
+ * - ICEControlPanel 的 zIndex 总是大于其它组件,当 ICEControlPanel 显示时,总是会优先判定为被选中的组件,会导致对应的 _targetComponent 收不到鼠标和键盘事件,所以 ICEControlPanel 的实现类需要自己考虑是否需要进行事件转发。
17
+ * - 控制面板的所有实例都在 ICEControlPanelManager 中创建和管理。
18
+ *
19
+ * @see ICEControlPanelManager
20
+ * @author 大漠穷秋<damoqiongqiu@126.com>
21
+ */
22
+ export default abstract class ICEControlPanel extends ICEGroup {
23
+ /**
24
+ * 类型标识
25
+ * 用来解决 TypeScript 的 instanceof 兼容性问题, https://github.com/microsoft/TypeScript/issues/22585
26
+ * 仅供内部使用,业务代码不可依赖此属性
27
+ */
28
+ isControlPanel: boolean;
29
+ protected _targetComponent: ICEComponent;
30
+ constructor(props: any);
31
+ protected abstract initControls(): void;
32
+ protected abstract updateControlPositions(): void;
33
+ protected doRender(): void;
34
+ moveGlobalPosition(tx: number, ty: number, evt?: any): void;
35
+ abstract enable(): any;
36
+ abstract disable(): any;
37
+ }
@@ -0,0 +1,25 @@
1
+ import ICE from '../ICE.mjs';
2
+ import LineControlPanel from './link-controls/LineControlPanel.mjs';
3
+ import TransformControlPanel from './transform-controls/TransformControlPanel.mjs';
4
+ /**
5
+ * @class ICEControlPanelManager
6
+ *
7
+ * 控制面板管理器
8
+ *
9
+ * - ICEControlPanelManager 负责管理所有类型的控制面板(ControlPanel)。
10
+ * - ICEControlPanelManager 是全局单例的,一个 ICE 实例上只能有一个实例。
11
+ * - ICEControlPanelManager 是纯逻辑组件,没有外观。
12
+ *
13
+ * @see ICE
14
+ * @author 大漠穷秋<damoqiongqiu@126.com>
15
+ */
16
+ declare class ICEControlPanelManager {
17
+ private ice;
18
+ transformControlPanel: TransformControlPanel;
19
+ lineControlPanel: LineControlPanel;
20
+ constructor(ice: ICE);
21
+ start(): this;
22
+ stop(): this;
23
+ private mouseDownHandler;
24
+ }
25
+ export default ICEControlPanelManager;
@@ -1,23 +1,25 @@
1
- import ICE from '../ICE';
2
- /**
3
- * @class ICEControlPanelManager
4
- *
5
- * 控制面板管理器
6
- *
7
- * - ICEControlPanelManager 负责管理所有类型的控制面板(ControlPanel)。
8
- * - ICEControlPanelManager 是全局单例的,一个 ICE 实例上只能有一个实例。
9
- * - ICEControlPanelManager 是纯逻辑组件,没有外观。
10
- *
11
- * @see ICE
12
- * @author 大漠穷秋<damoqiongqiu@126.com>
13
- */
14
- declare class ICEControlPanelManager {
15
- private ice;
16
- private transformControlPanel;
17
- private lineControlPanel;
18
- constructor(ice: ICE);
19
- start(): this;
20
- stop(): this;
21
- private mouseDownHandler;
22
- }
23
- export default ICEControlPanelManager;
1
+ import ICE from '../ICE';
2
+ import LineControlPanel from './link-controls/LineControlPanel';
3
+ import TransformControlPanel from './transform-controls/TransformControlPanel';
4
+ /**
5
+ * @class ICEControlPanelManager
6
+ *
7
+ * 控制面板管理器
8
+ *
9
+ * - ICEControlPanelManager 负责管理所有类型的控制面板(ControlPanel)。
10
+ * - ICEControlPanelManager 是全局单例的,一个 ICE 实例上只能有一个实例。
11
+ * - ICEControlPanelManager 是纯逻辑组件,没有外观。
12
+ *
13
+ * @see ICE
14
+ * @author 大漠穷秋<damoqiongqiu@126.com>
15
+ */
16
+ declare class ICEControlPanelManager {
17
+ private ice;
18
+ transformControlPanel: TransformControlPanel;
19
+ lineControlPanel: LineControlPanel;
20
+ constructor(ice: ICE);
21
+ start(): this;
22
+ stop(): this;
23
+ private mouseDownHandler;
24
+ }
25
+ export default ICEControlPanelManager;
@@ -0,0 +1,39 @@
1
+ import ICEComponent from '../../graphic/ICEComponent.mjs';
2
+ import ICEControlPanel from '../ICEControlPanel.mjs';
3
+ /**
4
+ *
5
+ * @class LineControlPanel
6
+ *
7
+ * 线条变换控制面板
8
+ *
9
+ * LineControlPanel 只作为空的逻辑容器存在,控制面板内部的操作手柄需要全屏幕自由移动位置,手柄位置不固定,对 LineControlPanel 本身的参数完全没有影响。
10
+ *
11
+ * LineControlPanel 功能:
12
+ *
13
+ * - 移动线条的位置
14
+ * - 调整线条起点和终点的位置
15
+ * - 将线条连接到其它组件上
16
+ *
17
+ * @author 大漠穷秋<damoqiongqiu@126.com>
18
+ */
19
+ export default class LineControlPanel extends ICEControlPanel {
20
+ private controlSize;
21
+ private startControl;
22
+ private endControl;
23
+ constructor(props: any);
24
+ protected initControls(): void;
25
+ protected initEvents(): void;
26
+ enable(): void;
27
+ disable(): void;
28
+ /**
29
+ * 设置所有手柄在父组件中的位置,相对于父组件的本地坐标系。
30
+ * LineControlPanel 不强制操作手柄的位置,操作手柄可以自由移动。
31
+ */
32
+ protected updateControlPositions(): void;
33
+ private resizeEvtHandler;
34
+ protected updatePosition(): void;
35
+ set targetComponent(component: ICEComponent);
36
+ get targetComponent(): ICEComponent;
37
+ showHooks(): void;
38
+ hideHooks(): void;
39
+ }
@@ -1,39 +1,39 @@
1
- import ICEComponent from '../../graphic/ICEComponent';
2
- import ICEControlPanel from '../ICEControlPanel';
3
- /**
4
- *
5
- * @class LineControlPanel
6
- *
7
- * 线条变换控制面板
8
- *
9
- * LineControlPanel 只作为空的逻辑容器存在,控制面板内部的操作手柄需要全屏幕自由移动位置,手柄位置不固定,对 LineControlPanel 本身的参数完全没有影响。
10
- *
11
- * LineControlPanel 功能:
12
- *
13
- * - 移动线条的位置
14
- * - 调整线条起点和终点的位置
15
- * - 将线条连接到其它组件上
16
- *
17
- * @author 大漠穷秋<damoqiongqiu@126.com>
18
- */
19
- export default class LineControlPanel extends ICEControlPanel {
20
- private controlSize;
21
- private startControl;
22
- private endControl;
23
- constructor(props: any);
24
- protected initControls(): void;
25
- protected initEvents(): void;
26
- enable(): void;
27
- disable(): void;
28
- /**
29
- * 设置所有手柄在父组件中的位置,相对于父组件的本地坐标系。
30
- * LineControlPanel 不强制操作手柄的位置,操作手柄可以自由移动。
31
- */
32
- protected updateControlPositions(): void;
33
- private resizeEvtHandler;
34
- protected updatePosition(): void;
35
- set targetComponent(component: ICEComponent);
36
- get targetComponent(): ICEComponent;
37
- showHooks(): void;
38
- hideHooks(): void;
39
- }
1
+ import ICEComponent from '../../graphic/ICEComponent';
2
+ import ICEControlPanel from '../ICEControlPanel';
3
+ /**
4
+ *
5
+ * @class LineControlPanel
6
+ *
7
+ * 线条变换控制面板
8
+ *
9
+ * LineControlPanel 只作为空的逻辑容器存在,控制面板内部的操作手柄需要全屏幕自由移动位置,手柄位置不固定,对 LineControlPanel 本身的参数完全没有影响。
10
+ *
11
+ * LineControlPanel 功能:
12
+ *
13
+ * - 移动线条的位置
14
+ * - 调整线条起点和终点的位置
15
+ * - 将线条连接到其它组件上
16
+ *
17
+ * @author 大漠穷秋<damoqiongqiu@126.com>
18
+ */
19
+ export default class LineControlPanel extends ICEControlPanel {
20
+ private controlSize;
21
+ private startControl;
22
+ private endControl;
23
+ constructor(props: any);
24
+ protected initControls(): void;
25
+ protected initEvents(): void;
26
+ enable(): void;
27
+ disable(): void;
28
+ /**
29
+ * 设置所有手柄在父组件中的位置,相对于父组件的本地坐标系。
30
+ * LineControlPanel 不强制操作手柄的位置,操作手柄可以自由移动。
31
+ */
32
+ protected updateControlPositions(): void;
33
+ private resizeEvtHandler;
34
+ protected updatePosition(): void;
35
+ set targetComponent(component: ICEComponent);
36
+ get targetComponent(): ICEComponent;
37
+ showHooks(): void;
38
+ hideHooks(): void;
39
+ }
@@ -0,0 +1,38 @@
1
+ import ICERect from '../../graphic/shape/ICERect.mjs';
2
+ /**
3
+ * @class ResizeControl 调整尺寸的操作手柄
4
+ *
5
+ * - 调整尺寸的操作手柄不能独立存在,只能依附在某个宿主对象上。
6
+ * - 此手柄只能调整尺寸,不能实现翻转
7
+ *
8
+ */
9
+ export default class ResizeControl extends ICERect {
10
+ /**
11
+ * props:
12
+ * {
13
+ * direction: 改变的方向,共有3个可选的值: x/y/both
14
+ * position: 手柄在变换矩形4个边上的位置,共有8个:lt/t/rt/r/rb/b/lb/l
15
+ * quadrant: 当前所在的象限
16
+ * }
17
+ * @param props
18
+ */
19
+ constructor(props: any);
20
+ protected initEvents(): void;
21
+ /**
22
+ * @param evt
23
+ */
24
+ private resizeEvtHandler;
25
+ /**
26
+ * @overwrite
27
+ * @method moveGlobalPosition
28
+ * ResizeControl 不能自由移动自己的位置,自能在X轴、Y轴,以及矩形的2条对角线上移动位置。
29
+ *
30
+ * 在全局空间(canvas)中移动指定的位移。
31
+ * 注意:此方法用于直接设置组件在全局空间中的位移,而不是相对于其它坐标系。
32
+ *
33
+ * @param tx
34
+ * @param ty
35
+ * @param evt
36
+ */
37
+ moveGlobalPosition(tx: number, ty: number, evt?: any): void;
38
+ }
@@ -1,38 +1,38 @@
1
- import ICERect from '../../graphic/shape/ICERect';
2
- /**
3
- * @class ResizeControl 调整尺寸的操作手柄
4
- *
5
- * - 调整尺寸的操作手柄不能独立存在,只能依附在某个宿主对象上。
6
- * - 此手柄只能调整尺寸,不能实现翻转
7
- *
8
- */
9
- export default class ResizeControl extends ICERect {
10
- /**
11
- * props:
12
- * {
13
- * direction: 改变的方向,共有3个可选的值: x/y/both
14
- * position: 手柄在变换矩形4个边上的位置,共有8个:lt/t/rt/r/rb/b/lb/l
15
- * quadrant: 当前所在的象限
16
- * }
17
- * @param props
18
- */
19
- constructor(props: any);
20
- protected initEvents(): void;
21
- /**
22
- * @param evt
23
- */
24
- private resizeEvtHandler;
25
- /**
26
- * @overwrite
27
- * @method moveGlobalPosition
28
- * ResizeControl 不能自由移动自己的位置,自能在X轴、Y轴,以及矩形的2条对角线上移动位置。
29
- *
30
- * 在全局空间(canvas)中移动指定的位移。
31
- * 注意:此方法用于直接设置组件在全局空间中的位移,而不是相对于其它坐标系。
32
- *
33
- * @param tx
34
- * @param ty
35
- * @param evt
36
- */
37
- moveGlobalPosition(tx: number, ty: number, evt?: any): void;
38
- }
1
+ import ICERect from '../../graphic/shape/ICERect';
2
+ /**
3
+ * @class ResizeControl 调整尺寸的操作手柄
4
+ *
5
+ * - 调整尺寸的操作手柄不能独立存在,只能依附在某个宿主对象上。
6
+ * - 此手柄只能调整尺寸,不能实现翻转
7
+ *
8
+ */
9
+ export default class ResizeControl extends ICERect {
10
+ /**
11
+ * props:
12
+ * {
13
+ * direction: 改变的方向,共有3个可选的值: x/y/both
14
+ * position: 手柄在变换矩形4个边上的位置,共有8个:lt/t/rt/r/rb/b/lb/l
15
+ * quadrant: 当前所在的象限
16
+ * }
17
+ * @param props
18
+ */
19
+ constructor(props: any);
20
+ protected initEvents(): void;
21
+ /**
22
+ * @param evt
23
+ */
24
+ private resizeEvtHandler;
25
+ /**
26
+ * @overwrite
27
+ * @method moveGlobalPosition
28
+ * ResizeControl 不能自由移动自己的位置,自能在X轴、Y轴,以及矩形的2条对角线上移动位置。
29
+ *
30
+ * 在全局空间(canvas)中移动指定的位移。
31
+ * 注意:此方法用于直接设置组件在全局空间中的位移,而不是相对于其它坐标系。
32
+ *
33
+ * @param tx
34
+ * @param ty
35
+ * @param evt
36
+ */
37
+ moveGlobalPosition(tx: number, ty: number, evt?: any): void;
38
+ }
@@ -0,0 +1,12 @@
1
+ import ICECircle from '../../graphic/shape/ICECircle.mjs';
2
+ /**
3
+ * @class RotateControl 旋转操作手柄
4
+ *
5
+ * - 旋转手柄不能独立存在,只能依附在某个宿主对象上。
6
+ * - 此手柄仅用来修改组件的旋转角度。
7
+ */
8
+ export default class RotateControl extends ICECircle {
9
+ constructor(props: any);
10
+ protected initEvents(): void;
11
+ private rotateEvtHandler;
12
+ }
@@ -1,12 +1,12 @@
1
- import ICECircle from '../../graphic/shape/ICECircle';
2
- /**
3
- * @class RotateControl 旋转操作手柄
4
- *
5
- * - 旋转手柄不能独立存在,只能依附在某个宿主对象上。
6
- * - 此手柄仅用来修改组件的旋转角度。
7
- */
8
- export default class RotateControl extends ICECircle {
9
- constructor(props: any);
10
- protected initEvents(): void;
11
- private rotateEvtHandler;
12
- }
1
+ import ICECircle from '../../graphic/shape/ICECircle';
2
+ /**
3
+ * @class RotateControl 旋转操作手柄
4
+ *
5
+ * - 旋转手柄不能独立存在,只能依附在某个宿主对象上。
6
+ * - 此手柄仅用来修改组件的旋转角度。
7
+ */
8
+ export default class RotateControl extends ICECircle {
9
+ constructor(props: any);
10
+ protected initEvents(): void;
11
+ private rotateEvtHandler;
12
+ }