ice-render 1.0.1 → 1.0.4

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.
@@ -5,22 +5,26 @@ import ICERect from '../../graphic/shape/ICERect';
5
5
  * - 调整尺寸的操作手柄不能独立存在,只能依附在某个宿主对象上。
6
6
  * - 此手柄只能调整尺寸,不能实现翻转
7
7
  *
8
- * TODO: 补全 props 配置项
9
- * {
10
- * direction: 改变的方向,共有3个可选的值: x/y/both
11
- * position: 手柄在变换矩形4个边上的位置,共有8个:lt/t/rt/r/rb/b/lb/l
12
- * }
13
8
  */
14
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
+ */
15
19
  constructor(props: any);
16
20
  protected initEvents(): void;
17
21
  /**
18
- * 围绕几何中心点调整宽高。
19
22
  * @param evt
20
23
  */
21
24
  private resizeEvtHandler;
22
25
  /**
23
26
  * @overwrite
27
+ * @method moveGlobalPosition
24
28
  * ResizeControl 不能自由移动自己的位置,自能在X轴、Y轴,以及矩形的2条对角线上移动位置。
25
29
  *
26
30
  * 在全局空间(canvas)中移动指定的位移。
@@ -4,10 +4,6 @@ import ICECircle from '../../graphic/shape/ICECircle';
4
4
  *
5
5
  * - 旋转手柄不能独立存在,只能依附在某个宿主对象上。
6
6
  * - 此手柄仅用来修改组件的旋转角度。
7
- *
8
- * TODO: 补全 props 配置项
9
- * {
10
- * }
11
7
  */
12
8
  export default class RotateControl extends ICECircle {
13
9
  constructor(props: any);
@@ -56,13 +56,6 @@ declare abstract class ICEEventTarget {
56
56
  * @returns
57
57
  */
58
58
  off(eventName: string, fn: Function, scope?: any): void;
59
- /**
60
- * @method once
61
- * 一次性事件,触发一次就自动删除自己。
62
- * @param eventName
63
- * @param fn
64
- */
65
- once(eventName: string, fn: Function, scope?: any): void;
66
59
  /**
67
60
  * @method dispatchEvent
68
61
  *
@@ -76,6 +69,13 @@ declare abstract class ICEEventTarget {
76
69
  * @returns
77
70
  */
78
71
  trigger(eventName: string, originalEvent?: any, param?: {}): boolean;
72
+ /**
73
+ * @method once
74
+ * 一次性事件,触发一次就自动删除自己。
75
+ * @param eventName
76
+ * @param fn
77
+ */
78
+ once(eventName: string, fn: Function, scope?: any): void;
79
79
  /**
80
80
  * @method suspend
81
81
  * 挂起事件。
@@ -233,11 +233,18 @@ declare abstract class ICEComponent extends ICEEventTarget {
233
233
  */
234
234
  globalToLocal(globalX: number, globalY: number): number[];
235
235
  /**
236
+ * @method getRotateAngle 获取组件的旋转角度。
236
237
  * 根据变换矩阵计算组件在全局空间(canvas)中的旋转角度。
238
+ * @param refresh 如果为 true ,则重新计算变换矩阵,否则使用缓存的变换矩阵。
237
239
  * @returns
238
240
  */
239
- getRotateAngle(): number;
240
- getLocalLeftTop(): {
241
+ getRotateAngle(refresh?: boolean): number;
242
+ /**
243
+ * @method getLocalLeftTop 得到组件在局部坐标系中的左上角坐标。
244
+ * @param refresh 如果为 true ,则重新计算变换矩阵,否则使用缓存的变换矩阵。
245
+ * @returns
246
+ */
247
+ getLocalLeftTop(refresh?: boolean): {
241
248
  left: number;
242
249
  top: number;
243
250
  width: number;
@@ -7,11 +7,8 @@
7
7
  */
8
8
  import ICEComponent from './ICEComponent';
9
9
  /**
10
- * @class ICEPath
11
- *
12
- * 路径
13
- *
14
10
  * @abstract
11
+ * @class ICEPath 路径
15
12
  * @author 大漠穷秋<damoqiongqiu@126.com>
16
13
  */
17
14
  declare abstract class ICEPath extends ICEComponent {
@@ -1,11 +1,10 @@
1
1
  import ICEComponent from '../ICEComponent';
2
2
  import ICERect from '../shape/ICERect';
3
3
  /**
4
- * @class ICEGroup
4
+ * @class ICEGroup 容器型组件
5
5
  *
6
- * 容器型组件
7
- *
8
- * ICEGroup 可以包含自身,利用此组件可以构造出树形的对象结构。
6
+ * - ICEGroup 可以带有子组件,所有容器型的组件都应该继承 ICEGroup
7
+ * - ICEGroup 可以包含自身,利用此组件可以构造出树形的组件结构。
9
8
  *
10
9
  * @author 大漠穷秋<damoqiongqiu@126.com>
11
10
  */
@@ -18,11 +18,12 @@ import ICECircle from '../shape/ICECircle';
18
18
  declare class ICELinkSlot extends ICECircle {
19
19
  private _hostComponent;
20
20
  /**
21
- * position 有4个取值,分别位于宿主边界盒子的4个边的几何中点上:
22
- * - T: 顶部
23
- * - R: 右侧
24
- * - B: 底部
25
- * - L: 左侧
21
+ * position 的取值:
22
+ * - T: 宿主边界盒子的顶边中点
23
+ * - R: 宿主边界盒子的右边中点
24
+ * - B: 宿主边界盒子的底边中点
25
+ * - L: 宿主边界盒子的左边中点
26
+ * - C: 宿主边界盒子的几何中心点
26
27
  *
27
28
  * 连接插槽自身不可拖拽、不可连接。
28
29
  * @param props
@@ -13,6 +13,7 @@ import ICE from '../../ICE';
13
13
  export default class ICELinkSlotManager {
14
14
  private slotRadius;
15
15
  private ice;
16
+ private collision;
16
17
  constructor(ice: ICE);
17
18
  start(): this;
18
19
  stop(): this;
@@ -20,8 +21,8 @@ export default class ICELinkSlotManager {
20
21
  private hookMouseUpHandler;
21
22
  protected globalMouseUpHandler(evt?: ICEEvent): void;
22
23
  /**
23
- * 创建连接插槽,插槽默认分布在组件最小边界盒子的4条边几何中点位置。
24
- * 有顺序,按照 TRBL 上右下左 创建,插槽的 ID 会被序列化。
24
+ * @method createLinkSlots
25
+ * 创建5个连接插槽,插槽默认分布在组件最小边界盒子的4条边中点和几何中心点。
25
26
  */
26
27
  protected createLinkSlots(): void;
27
28
  }
@@ -7,9 +7,9 @@
7
7
  */
8
8
  import ICEEllipse from './ICEEllipse';
9
9
  /**
10
- * @class ICECircle
10
+ * @class ICECircle 正圆形
11
11
  *
12
- * 正圆形,采用椭圆绘制方法,正圆形作为椭圆的特殊情况。
12
+ * 采用椭圆绘制方法,正圆形作为椭圆的特殊情况。
13
13
  *
14
14
  * @author 大漠穷秋<damoqiongqiu@126.com>
15
15
  */
@@ -1,9 +1,6 @@
1
1
  import ICEPath from '../ICEPath';
2
2
  /**
3
- * @class ICEEllipse
4
- *
5
- * 椭圆形。
6
- *
3
+ * @class ICEEllipse 椭圆形
7
4
  * @author 大漠穷秋<damoqiongqiu@126.com>
8
5
  */
9
6
  declare class ICEEllipse extends ICEPath {
@@ -1,9 +1,7 @@
1
1
  import ICEDotPath from '../ICEDotPath';
2
2
  /**
3
3
  *
4
- * @class ICEIsogon
5
- *
6
- * 正N边形
4
+ * @class ICEIsogon 正N边形
7
5
  *
8
6
  * @author 大漠穷秋<damoqiongqiu@126.com>
9
7
  */
@@ -1,9 +1,6 @@
1
1
  import ICEDotPath from '../ICEDotPath';
2
2
  /**
3
- * @class ICEStar
4
- *
5
- * 正 N 角星
6
- *
3
+ * @class ICEStar 正N角星
7
4
  * @author 大漠穷秋<damoqiongqiu@126.com>
8
5
  */
9
6
  declare class ICEStar extends ICEDotPath {
@@ -1,6 +1,7 @@
1
1
  import ICEComponent from '../ICEComponent';
2
2
  /**
3
3
  * TODO:draw text along Path2D
4
+ * @class ICEText 文本
4
5
  * @author 大漠穷秋<damoqiongqiu@126.com>
5
6
  */
6
7
  declare class ICEText extends ICEComponent {
@@ -1,9 +1,7 @@
1
1
  import ICEEventTarget from '../event/ICEEventTarget';
2
2
  import ICE from '../ICE';
3
3
  /**
4
- * @class CanvasRenderer
5
- *
6
- * Canvas 渲染器
4
+ * @class CanvasRenderer Canvas 渲染器
7
5
  *
8
6
  * - 一个 ICE 实例上,只能有一个渲染器实例。
9
7
  *
@@ -1,7 +1,9 @@
1
1
  import ICE from '../ICE';
2
2
  /**
3
- * @class ImageCache
4
- * 图片缓存类
3
+ * @class ImageCache 图片缓存器
4
+ *
5
+ * 以图片的 url 作为 key,图片对象作为 value,缓存图片。
6
+ *
5
7
  * @author 大漠穷秋<damoqiongqiu@126.com>
6
8
  */
7
9
  export default class ImageCache {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "大漠穷秋",
3
3
  "name": "ice-render",
4
- "version": "1.0.1",
4
+ "version": "1.0.4",
5
5
  "description": "A canvas engine for interactive graphics.",
6
6
  "repository": "https://gitee.com/ice-render/ice-render",
7
7
  "module": "dist/index.js",