ice-render 1.0.4 → 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 -141
- 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 -26
- package/dist/types/ICE.d.mts +369 -0
- package/dist/types/ICE.d.ts +369 -107
- 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 -38
- package/dist/types/control-panel/transform-controls/RotateControl.d.mts +12 -0
- package/dist/types/control-panel/transform-controls/RotateControl.d.ts +12 -12
- 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 -36
- package/dist/types/graphic/container/ICEGroup.d.mts +101 -0
- package/dist/types/graphic/container/ICEGroup.d.ts +101 -53
- 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 -23
- package/dist/types/graphic/shape/ICEIsogon.d.mts +52 -0
- package/dist/types/graphic/shape/ICEIsogon.d.ts +52 -52
- 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 -45
- package/dist/types/graphic/text/ICEText.d.mts +137 -0
- package/dist/types/graphic/text/ICEText.d.ts +137 -65
- 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 -22
- 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 -19
- 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,53 +1,101 @@
|
|
|
1
|
-
import ICEComponent from '../ICEComponent';
|
|
2
|
-
import ICERect from '../shape/ICERect';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - ICEGroup
|
|
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
|
-
*
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
import ICEComponent from '../ICEComponent';
|
|
2
|
+
import ICERect from '../shape/ICERect';
|
|
3
|
+
import type ICELayoutManager from '../../layout/ICELayoutManager';
|
|
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;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 ICEPolyLine from './ICEPolyLine.mjs';
|
|
9
|
+
/**
|
|
10
|
+
* @class ICEBezier 贝塞尔曲线
|
|
11
|
+
*
|
|
12
|
+
* 复用 ICEPolyLine 的 curveType 曲线绘制能力:
|
|
13
|
+
* - curveType='quadratic'(默认):startPoint + controlPoint + endPoint 三点二次贝塞尔。
|
|
14
|
+
* - curveType='cubic':startPoint + controlPoint1 + controlPoint2 + endPoint 四点三次贝塞尔。
|
|
15
|
+
* - 也可直接传 points(3 点二次 / 4 点三次)进行完全控制。
|
|
16
|
+
*
|
|
17
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
18
|
+
*/
|
|
19
|
+
export default class ICEBezier extends ICEPolyLine {
|
|
20
|
+
constructor(props?: any);
|
|
21
|
+
protected static arrangeParam(props?: any): any;
|
|
22
|
+
private static buildDefaultPoints;
|
|
23
|
+
}
|
|
@@ -1,15 +1,23 @@
|
|
|
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
|
-
|
|
10
|
-
* @
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
import ICEPolyLine from './ICEPolyLine';
|
|
9
|
+
/**
|
|
10
|
+
* @class ICEBezier 贝塞尔曲线
|
|
11
|
+
*
|
|
12
|
+
* 复用 ICEPolyLine 的 curveType 曲线绘制能力:
|
|
13
|
+
* - curveType='quadratic'(默认):startPoint + controlPoint + endPoint 三点二次贝塞尔。
|
|
14
|
+
* - curveType='cubic':startPoint + controlPoint1 + controlPoint2 + endPoint 四点三次贝塞尔。
|
|
15
|
+
* - 也可直接传 points(3 点二次 / 4 点三次)进行完全控制。
|
|
16
|
+
*
|
|
17
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
18
|
+
*/
|
|
19
|
+
export default class ICEBezier extends ICEPolyLine {
|
|
20
|
+
constructor(props?: any);
|
|
21
|
+
protected static arrangeParam(props?: any): any;
|
|
22
|
+
private static buildDefaultPoints;
|
|
23
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import ICEEvent from '../../event/ICEEvent.mjs';
|
|
2
|
+
import ICECircle from '../shape/ICECircle.mjs';
|
|
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
|
+
* @overwrite
|
|
20
|
+
* @method keyboardEvtHandler 键盘事件处理
|
|
21
|
+
* !ICELinkHook 不响应键盘事件。
|
|
22
|
+
* @see {ICEComponent.keyboardEvtHandler}
|
|
23
|
+
* @param evt
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
protected keyboardEvtHandler(evt: any): void;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* 在 mousedown 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mousedown 事件说明组件已经渲染出来了。
|
|
30
|
+
* 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEDOWN 事件的组件都会收到消息。
|
|
31
|
+
*
|
|
32
|
+
* @param evt
|
|
33
|
+
*/
|
|
34
|
+
protected mosueDownHandler(evt: ICEEvent): void;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* 在 mousemove 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mousemove 事件说明组件已经渲染出来了。
|
|
38
|
+
* 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEMOVE 事件的组件都会收到消息。
|
|
39
|
+
*
|
|
40
|
+
* @param evt
|
|
41
|
+
*/
|
|
42
|
+
protected mosueMoveHandler(evt: ICEEvent): void;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* 在 mouseup 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mouseup 事件说明组件已经渲染出来了。
|
|
46
|
+
* 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEUP 事件的组件都会收到消息。
|
|
47
|
+
*
|
|
48
|
+
* @param evt
|
|
49
|
+
*/
|
|
50
|
+
protected mosueUpHandler(evt: ICEEvent): void;
|
|
51
|
+
protected resizeEvtHandler(evt: any): void;
|
|
52
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
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
|
-
* @overwrite
|
|
20
|
-
* @method keyboardEvtHandler 键盘事件处理
|
|
21
|
-
* !ICELinkHook 不响应键盘事件。
|
|
22
|
-
* @see {ICEComponent.keyboardEvtHandler}
|
|
23
|
-
* @param evt
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
26
|
-
protected keyboardEvtHandler(evt: any): void;
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
* 在 mousedown 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mousedown 事件说明组件已经渲染出来了。
|
|
30
|
-
* 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEDOWN 事件的组件都会收到消息。
|
|
31
|
-
*
|
|
32
|
-
* @param evt
|
|
33
|
-
*/
|
|
34
|
-
protected mosueDownHandler(evt: ICEEvent): void;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* 在 mousemove 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mousemove 事件说明组件已经渲染出来了。
|
|
38
|
-
* 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEMOVE 事件的组件都会收到消息。
|
|
39
|
-
*
|
|
40
|
-
* @param evt
|
|
41
|
-
*/
|
|
42
|
-
protected mosueMoveHandler(evt: ICEEvent): void;
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* 在 mouseup 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mouseup 事件说明组件已经渲染出来了。
|
|
46
|
-
* 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEUP 事件的组件都会收到消息。
|
|
47
|
-
*
|
|
48
|
-
* @param evt
|
|
49
|
-
*/
|
|
50
|
-
protected mosueUpHandler(evt: ICEEvent): void;
|
|
51
|
-
protected resizeEvtHandler(evt: any): void;
|
|
52
|
-
}
|
|
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
|
+
* @overwrite
|
|
20
|
+
* @method keyboardEvtHandler 键盘事件处理
|
|
21
|
+
* !ICELinkHook 不响应键盘事件。
|
|
22
|
+
* @see {ICEComponent.keyboardEvtHandler}
|
|
23
|
+
* @param evt
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
protected keyboardEvtHandler(evt: any): void;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* 在 mousedown 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mousedown 事件说明组件已经渲染出来了。
|
|
30
|
+
* 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEDOWN 事件的组件都会收到消息。
|
|
31
|
+
*
|
|
32
|
+
* @param evt
|
|
33
|
+
*/
|
|
34
|
+
protected mosueDownHandler(evt: ICEEvent): void;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* 在 mousemove 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mousemove 事件说明组件已经渲染出来了。
|
|
38
|
+
* 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEMOVE 事件的组件都会收到消息。
|
|
39
|
+
*
|
|
40
|
+
* @param evt
|
|
41
|
+
*/
|
|
42
|
+
protected mosueMoveHandler(evt: ICEEvent): void;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* 在 mouseup 事件处理器里面可以直接访问 this.evtBus ,因为能接收到 mouseup 事件说明组件已经渲染出来了。
|
|
46
|
+
* 在 this.evtBus 上触发事件,相当于全局广播,所有监听了 ICE_EVENT_NAME_CONSTS.HOOK_MOUSEUP 事件的组件都会收到消息。
|
|
47
|
+
*
|
|
48
|
+
* @param evt
|
|
49
|
+
*/
|
|
50
|
+
protected mosueUpHandler(evt: ICEEvent): void;
|
|
51
|
+
protected resizeEvtHandler(evt: any): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import ICECircle from '../shape/ICECircle.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* @class ICELinkSlot
|
|
4
|
+
*
|
|
5
|
+
* 连接插槽
|
|
6
|
+
*
|
|
7
|
+
* - ICELinkSlot 与 ICELinkHook 是一对组件,用来把两个组件连接起来。
|
|
8
|
+
* - 一个插槽上面可以连多个钩子,ICELinkSlot 与 ICELinkHook 之间是一对多的关系。
|
|
9
|
+
* - ICELinkSlot 不能独立存在,它必须附属在某个宿主组件上。逻辑附属,非真实的外观附属。
|
|
10
|
+
* - ICELinkSlot 总是绘制在全局 canvas 中,它不是任何组件的子节点。
|
|
11
|
+
* - ICELinkSlot 自身不进行任何 transform 。
|
|
12
|
+
* - ICELinkSlot 的实例是由 ICELinkSlotManager 统一动态创建的,如果组件的 linkable 状态为 tue ,ICELinkSlotManager 会动态在组件上创建连接插槽。
|
|
13
|
+
*
|
|
14
|
+
* @see ICELinkHook
|
|
15
|
+
* @see ICELinkSlotManager
|
|
16
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
17
|
+
*/
|
|
18
|
+
declare class ICELinkSlot extends ICECircle {
|
|
19
|
+
private _hostComponent;
|
|
20
|
+
/**
|
|
21
|
+
* position 的取值:
|
|
22
|
+
* - T: 宿主边界盒子的顶边中点
|
|
23
|
+
* - R: 宿主边界盒子的右边中点
|
|
24
|
+
* - B: 宿主边界盒子的底边中点
|
|
25
|
+
* - L: 宿主边界盒子的左边中点
|
|
26
|
+
* - C: 宿主边界盒子的几何中心点
|
|
27
|
+
*
|
|
28
|
+
* 连接插槽自身不可拖拽、不可连接。
|
|
29
|
+
* @param props
|
|
30
|
+
*/
|
|
31
|
+
constructor(props?: any);
|
|
32
|
+
/**
|
|
33
|
+
* @overwrite
|
|
34
|
+
* @method keyboardEvtHandler 键盘事件处理
|
|
35
|
+
* !ICELinkSlot 不响应键盘事件,覆盖成空实现。
|
|
36
|
+
* @see {ICEComponent.keyboardEvtHandler}
|
|
37
|
+
* @param evt
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
protected keyboardEvtHandler(evt: any): void;
|
|
41
|
+
destory(): void;
|
|
42
|
+
protected updatePosition(): void;
|
|
43
|
+
/**
|
|
44
|
+
* 宿主被移除时的处理。
|
|
45
|
+
*
|
|
46
|
+
* 与 TransformControlPanel 同一问题:旧实现用 `once(BEFORE_REMOVE, () => {...})`,
|
|
47
|
+
* `once` 内部包裹后的回调无法被 `off`,反复切换宿主会在宿主上累积无法回收的监听。
|
|
48
|
+
* 改为稳定引用 + `on`,由 setter 在切换时 `off`(`on` 对 (fn, scope) 幂等)。
|
|
49
|
+
*/
|
|
50
|
+
private __onHostRemoved;
|
|
51
|
+
set hostComponent(component: any);
|
|
52
|
+
get hostComponent(): any;
|
|
53
|
+
}
|
|
54
|
+
export default ICELinkSlot;
|
|
@@ -1,46 +1,54 @@
|
|
|
1
|
-
import ICECircle from '../shape/ICECircle';
|
|
2
|
-
/**
|
|
3
|
-
* @class ICELinkSlot
|
|
4
|
-
*
|
|
5
|
-
* 连接插槽
|
|
6
|
-
*
|
|
7
|
-
* - ICELinkSlot 与 ICELinkHook 是一对组件,用来把两个组件连接起来。
|
|
8
|
-
* - 一个插槽上面可以连多个钩子,ICELinkSlot 与 ICELinkHook 之间是一对多的关系。
|
|
9
|
-
* - ICELinkSlot 不能独立存在,它必须附属在某个宿主组件上。逻辑附属,非真实的外观附属。
|
|
10
|
-
* - ICELinkSlot 总是绘制在全局 canvas 中,它不是任何组件的子节点。
|
|
11
|
-
* - ICELinkSlot 自身不进行任何 transform 。
|
|
12
|
-
* - ICELinkSlot 的实例是由 ICELinkSlotManager 统一动态创建的,如果组件的 linkable 状态为 tue ,ICELinkSlotManager 会动态在组件上创建连接插槽。
|
|
13
|
-
*
|
|
14
|
-
* @see ICELinkHook
|
|
15
|
-
* @see ICELinkSlotManager
|
|
16
|
-
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
17
|
-
*/
|
|
18
|
-
declare class ICELinkSlot extends ICECircle {
|
|
19
|
-
private _hostComponent;
|
|
20
|
-
/**
|
|
21
|
-
* position 的取值:
|
|
22
|
-
* - T: 宿主边界盒子的顶边中点
|
|
23
|
-
* - R: 宿主边界盒子的右边中点
|
|
24
|
-
* - B: 宿主边界盒子的底边中点
|
|
25
|
-
* - L: 宿主边界盒子的左边中点
|
|
26
|
-
* - C: 宿主边界盒子的几何中心点
|
|
27
|
-
*
|
|
28
|
-
* 连接插槽自身不可拖拽、不可连接。
|
|
29
|
-
* @param props
|
|
30
|
-
*/
|
|
31
|
-
constructor(props?: any);
|
|
32
|
-
/**
|
|
33
|
-
* @overwrite
|
|
34
|
-
* @method keyboardEvtHandler 键盘事件处理
|
|
35
|
-
* !ICELinkSlot 不响应键盘事件,覆盖成空实现。
|
|
36
|
-
* @see {ICEComponent.keyboardEvtHandler}
|
|
37
|
-
* @param evt
|
|
38
|
-
* @returns
|
|
39
|
-
*/
|
|
40
|
-
protected keyboardEvtHandler(evt: any): void;
|
|
41
|
-
destory(): void;
|
|
42
|
-
protected updatePosition(): void;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
import ICECircle from '../shape/ICECircle';
|
|
2
|
+
/**
|
|
3
|
+
* @class ICELinkSlot
|
|
4
|
+
*
|
|
5
|
+
* 连接插槽
|
|
6
|
+
*
|
|
7
|
+
* - ICELinkSlot 与 ICELinkHook 是一对组件,用来把两个组件连接起来。
|
|
8
|
+
* - 一个插槽上面可以连多个钩子,ICELinkSlot 与 ICELinkHook 之间是一对多的关系。
|
|
9
|
+
* - ICELinkSlot 不能独立存在,它必须附属在某个宿主组件上。逻辑附属,非真实的外观附属。
|
|
10
|
+
* - ICELinkSlot 总是绘制在全局 canvas 中,它不是任何组件的子节点。
|
|
11
|
+
* - ICELinkSlot 自身不进行任何 transform 。
|
|
12
|
+
* - ICELinkSlot 的实例是由 ICELinkSlotManager 统一动态创建的,如果组件的 linkable 状态为 tue ,ICELinkSlotManager 会动态在组件上创建连接插槽。
|
|
13
|
+
*
|
|
14
|
+
* @see ICELinkHook
|
|
15
|
+
* @see ICELinkSlotManager
|
|
16
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
17
|
+
*/
|
|
18
|
+
declare class ICELinkSlot extends ICECircle {
|
|
19
|
+
private _hostComponent;
|
|
20
|
+
/**
|
|
21
|
+
* position 的取值:
|
|
22
|
+
* - T: 宿主边界盒子的顶边中点
|
|
23
|
+
* - R: 宿主边界盒子的右边中点
|
|
24
|
+
* - B: 宿主边界盒子的底边中点
|
|
25
|
+
* - L: 宿主边界盒子的左边中点
|
|
26
|
+
* - C: 宿主边界盒子的几何中心点
|
|
27
|
+
*
|
|
28
|
+
* 连接插槽自身不可拖拽、不可连接。
|
|
29
|
+
* @param props
|
|
30
|
+
*/
|
|
31
|
+
constructor(props?: any);
|
|
32
|
+
/**
|
|
33
|
+
* @overwrite
|
|
34
|
+
* @method keyboardEvtHandler 键盘事件处理
|
|
35
|
+
* !ICELinkSlot 不响应键盘事件,覆盖成空实现。
|
|
36
|
+
* @see {ICEComponent.keyboardEvtHandler}
|
|
37
|
+
* @param evt
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
protected keyboardEvtHandler(evt: any): void;
|
|
41
|
+
destory(): void;
|
|
42
|
+
protected updatePosition(): void;
|
|
43
|
+
/**
|
|
44
|
+
* 宿主被移除时的处理。
|
|
45
|
+
*
|
|
46
|
+
* 与 TransformControlPanel 同一问题:旧实现用 `once(BEFORE_REMOVE, () => {...})`,
|
|
47
|
+
* `once` 内部包裹后的回调无法被 `off`,反复切换宿主会在宿主上累积无法回收的监听。
|
|
48
|
+
* 改为稳定引用 + `on`,由 setter 在切换时 `off`(`on` 对 (fn, scope) 幂等)。
|
|
49
|
+
*/
|
|
50
|
+
private __onHostRemoved;
|
|
51
|
+
set hostComponent(component: any);
|
|
52
|
+
get hostComponent(): any;
|
|
53
|
+
}
|
|
54
|
+
export default ICELinkSlot;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import ICEEvent from '../../event/ICEEvent.mjs';
|
|
2
|
+
import ICE from '../../ICE.mjs';
|
|
3
|
+
/**
|
|
4
|
+
* @class ICELinkSlotManager
|
|
5
|
+
*
|
|
6
|
+
* - ICELinkSlotManager 连接插槽管理器,用于管理连接插槽,共4个,所有可连接的组件都复用这4个插槽的实例。
|
|
7
|
+
* - ICELinkSlotManager 的实例是在 ICE 初始化时创建的。
|
|
8
|
+
* - ICELinkSlotManager 是全局单例,同一个 ICE 实例上只能有一个 ICELinkSlotManager 实例。
|
|
9
|
+
*
|
|
10
|
+
* @see ICE
|
|
11
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
12
|
+
*/
|
|
13
|
+
export default class ICELinkSlotManager {
|
|
14
|
+
private slotRadius;
|
|
15
|
+
private ice;
|
|
16
|
+
private collision;
|
|
17
|
+
constructor(ice: ICE);
|
|
18
|
+
start(): this;
|
|
19
|
+
stop(): this;
|
|
20
|
+
private hookMouseMoveHandler;
|
|
21
|
+
private hookMouseUpHandler;
|
|
22
|
+
protected globalMouseUpHandler(evt?: ICEEvent): void;
|
|
23
|
+
/**
|
|
24
|
+
* @method createLinkSlots
|
|
25
|
+
* 创建5个连接插槽,插槽默认分布在组件最小边界盒子的4条边中点和几何中心点。
|
|
26
|
+
*/
|
|
27
|
+
protected createLinkSlots(): void;
|
|
28
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import ICEEvent from '../../event/ICEEvent';
|
|
2
|
-
import ICE from '../../ICE';
|
|
3
|
-
/**
|
|
4
|
-
* @class ICELinkSlotManager
|
|
5
|
-
*
|
|
6
|
-
* - ICELinkSlotManager 连接插槽管理器,用于管理连接插槽,共4个,所有可连接的组件都复用这4个插槽的实例。
|
|
7
|
-
* - ICELinkSlotManager 的实例是在 ICE 初始化时创建的。
|
|
8
|
-
* - ICELinkSlotManager 是全局单例,同一个 ICE 实例上只能有一个 ICELinkSlotManager 实例。
|
|
9
|
-
*
|
|
10
|
-
* @see ICE
|
|
11
|
-
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
12
|
-
*/
|
|
13
|
-
export default class ICELinkSlotManager {
|
|
14
|
-
private slotRadius;
|
|
15
|
-
private ice;
|
|
16
|
-
private collision;
|
|
17
|
-
constructor(ice: ICE);
|
|
18
|
-
start(): this;
|
|
19
|
-
stop(): this;
|
|
20
|
-
private hookMouseMoveHandler;
|
|
21
|
-
private hookMouseUpHandler;
|
|
22
|
-
protected globalMouseUpHandler(evt?: ICEEvent): void;
|
|
23
|
-
/**
|
|
24
|
-
* @method createLinkSlots
|
|
25
|
-
* 创建5个连接插槽,插槽默认分布在组件最小边界盒子的4条边中点和几何中心点。
|
|
26
|
-
*/
|
|
27
|
-
protected createLinkSlots(): void;
|
|
28
|
-
}
|
|
1
|
+
import ICEEvent from '../../event/ICEEvent';
|
|
2
|
+
import ICE from '../../ICE';
|
|
3
|
+
/**
|
|
4
|
+
* @class ICELinkSlotManager
|
|
5
|
+
*
|
|
6
|
+
* - ICELinkSlotManager 连接插槽管理器,用于管理连接插槽,共4个,所有可连接的组件都复用这4个插槽的实例。
|
|
7
|
+
* - ICELinkSlotManager 的实例是在 ICE 初始化时创建的。
|
|
8
|
+
* - ICELinkSlotManager 是全局单例,同一个 ICE 实例上只能有一个 ICELinkSlotManager 实例。
|
|
9
|
+
*
|
|
10
|
+
* @see ICE
|
|
11
|
+
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
12
|
+
*/
|
|
13
|
+
export default class ICELinkSlotManager {
|
|
14
|
+
private slotRadius;
|
|
15
|
+
private ice;
|
|
16
|
+
private collision;
|
|
17
|
+
constructor(ice: ICE);
|
|
18
|
+
start(): this;
|
|
19
|
+
stop(): this;
|
|
20
|
+
private hookMouseMoveHandler;
|
|
21
|
+
private hookMouseUpHandler;
|
|
22
|
+
protected globalMouseUpHandler(evt?: ICEEvent): void;
|
|
23
|
+
/**
|
|
24
|
+
* @method createLinkSlots
|
|
25
|
+
* 创建5个连接插槽,插槽默认分布在组件最小边界盒子的4条边中点和几何中心点。
|
|
26
|
+
*/
|
|
27
|
+
protected createLinkSlots(): void;
|
|
28
|
+
}
|