zkqh-canvas-select-one 2.32.3 → 2.32.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/lib/index.d.ts CHANGED
@@ -8,8 +8,9 @@ import Grid from "./shape/Grid";
8
8
  import Brush from "./shape/Brush";
9
9
  import Eraser from "./shape/Eraser";
10
10
  import Ellipse from "./shape/Ellipse";
11
+ import Text from "./shape/Text";
11
12
  export type Point = [number, number];
12
- export type AllShape = Rect | Polygon | Dot | Line | Circle | Grid | Brush | Eraser | Ellipse;
13
+ export type AllShape = Rect | Polygon | Dot | Line | Circle | Grid | Brush | Eraser | Ellipse | Text;
13
14
  declare enum Shape {
14
15
  None = 0,
15
16
  Rect = 1,
@@ -20,7 +21,8 @@ declare enum Shape {
20
21
  Grid = 6,
21
22
  Brush = 7,
22
23
  Eraser = 8,
23
- Ellipse = 9
24
+ Ellipse = 9,
25
+ Text = 10
24
26
  }
25
27
  export default class CanvasSelect extends EventBus {
26
28
  /** 当前版本 */
@@ -352,6 +354,20 @@ export default class CanvasSelect extends EventBus {
352
354
  * @param shape 标注实例
353
355
  */
354
356
  drawEllipse(shape: Ellipse): void;
357
+ /**
358
+ * 绘制文本
359
+ * @param shape 标注实例
360
+ */
361
+ drawText(shape: Text): void;
362
+ /**
363
+ * 绘制圆角矩形
364
+ * @param x x坐标
365
+ * @param y y坐标
366
+ * @param width 宽度
367
+ * @param height 高度
368
+ * @param radius 圆角半径
369
+ */
370
+ drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): void;
355
371
  /**
356
372
  * 绘制折线
357
373
  * @param shape 标注实例
@@ -385,7 +401,7 @@ export default class CanvasSelect extends EventBus {
385
401
  * 绘制控制点列表
386
402
  * @param shape 标注实例
387
403
  */
388
- drawCtrlList(shape: Rect | Polygon | Line | Circle | Ellipse): void;
404
+ drawCtrlList(shape: Rect | Polygon | Line | Circle | Ellipse | Text): void;
389
405
  /**
390
406
  * 绘制label
391
407
  * @param point 位置
@@ -0,0 +1,43 @@
1
+ import Shape from './Shape';
2
+ export default class Text extends Shape {
3
+ type: number;
4
+ /** 文本内容 */
5
+ text: string;
6
+ /** 字体大小 */
7
+ fontSize: number;
8
+ /** 字体族 */
9
+ fontFamily: string;
10
+ /** 文本颜色 */
11
+ textColor: string;
12
+ /** 背景颜色 */
13
+ backgroundColor: string;
14
+ /** 边框颜色 */
15
+ borderColor: string;
16
+ /** 边框宽度 */
17
+ borderWidth: number;
18
+ /** 圆角半径 */
19
+ borderRadius: number;
20
+ /** 内边距 */
21
+ padding: number;
22
+ /** 文本对齐方式 */
23
+ textAlign: CanvasTextAlign;
24
+ /** 文本基线 */
25
+ textBaseline: CanvasTextBaseline;
26
+ constructor(item: any, index: number, base: any);
27
+ /**
28
+ * 获取控制点数据
29
+ */
30
+ get ctrlsData(): any[][];
31
+ /**
32
+ * 获取文本框的宽度
33
+ */
34
+ get width(): number;
35
+ /**
36
+ * 获取文本框的高度
37
+ */
38
+ get height(): number;
39
+ /**
40
+ * 获取文本框的中心点
41
+ */
42
+ get center(): [number, number];
43
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zkqh-canvas-select-one",
3
- "version": "2.32.3",
4
- "description": "一个用于图片标注的javascript库,基于canvas,简单轻量,支持矩形、多边形、点、折线、圆形、网格、画笔、橡皮擦",
3
+ "version": "2.32.5",
4
+ "description": "一个用于图片标注的javascript库,基于canvas,简单轻量,支持矩形、多边形、点、折线、圆形、网格、画笔、橡皮擦、文本",
5
5
  "main": "lib/canvas-select.min.js",
6
6
  "module": "lib/canvas-select.esm.js",
7
7
  "types": "lib/index.d.ts",
@@ -32,7 +32,9 @@
32
32
  "网格",
33
33
  "画笔",
34
34
  "橡皮擦",
35
- "电子围栏"
35
+ "电子围栏",
36
+ "文本",
37
+ "文字"
36
38
  ],
37
39
  "author": "heylight",
38
40
  "license": "MIT",