@labelbee/lb-annotation 1.5.4-alpha.6 → 1.5.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.
- package/dist/index.js +30 -11
- package/dist/types/core/toolOperation/ViewOperation.d.ts +1 -44
- package/dist/types/core/toolOperation/basicToolOperation.d.ts +4 -3
- package/dist/types/core/toolOperation/pointOperation.d.ts +1 -1
- package/dist/types/utils/tool/AxisUtils.d.ts +1 -1
- package/dist/types/utils/tool/CanvasUtils.d.ts +6 -0
- package/dist/types/utils/tool/CommonToolUtils.d.ts +1 -1
- package/dist/types/utils/tool/DrawUtils.d.ts +13 -5
- package/dist/types/utils/tool/PolygonUtils.d.ts +1 -0
- package/dist/types/utils/tool/RenderDomClass.d.ts +23 -0
- package/dist/types/utils/tool/RenderDomUtils.d.ts +1 -1
- package/dist/types/utils/tool/StyleUtils.d.ts +6 -0
- package/es/index.js +34 -15
- package/package.json +1 -1
|
@@ -2,50 +2,6 @@
|
|
|
2
2
|
* 查看模式 - 支持简单数据注入查看
|
|
3
3
|
*/
|
|
4
4
|
import { BasicToolOperation, IBasicToolOperationProps } from './basicToolOperation';
|
|
5
|
-
interface IBasicStyle {
|
|
6
|
-
stroke?: string;
|
|
7
|
-
fill?: string;
|
|
8
|
-
thickness?: number;
|
|
9
|
-
}
|
|
10
|
-
interface IGraphicsBasicConfig extends IBasicStyle {
|
|
11
|
-
hiddenText?: boolean;
|
|
12
|
-
isReference?: boolean;
|
|
13
|
-
}
|
|
14
|
-
interface IAnnotationData {
|
|
15
|
-
type: 'rect' | 'polygon' | 'line' | 'point' | 'text';
|
|
16
|
-
annotation: IBasicRect & IBasicPolygon & IBasicLine & IPoint & IBasicText;
|
|
17
|
-
}
|
|
18
|
-
interface IBasicRect extends IGraphicsBasicConfig {
|
|
19
|
-
id: string;
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
width: number;
|
|
23
|
-
height: number;
|
|
24
|
-
}
|
|
25
|
-
interface IBasicPolygon extends IGraphicsBasicConfig {
|
|
26
|
-
id: string;
|
|
27
|
-
pointList: IPoint[];
|
|
28
|
-
showDirection?: boolean;
|
|
29
|
-
specialPoint?: boolean;
|
|
30
|
-
specialEdge?: boolean;
|
|
31
|
-
}
|
|
32
|
-
declare type IBasicLine = IBasicPolygon;
|
|
33
|
-
interface IBasicText {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
text: string;
|
|
37
|
-
position: 'rt';
|
|
38
|
-
textMaxWidth?: number;
|
|
39
|
-
color?: string;
|
|
40
|
-
background?: string;
|
|
41
|
-
lineHeight?: number;
|
|
42
|
-
font?: string;
|
|
43
|
-
}
|
|
44
|
-
interface IPoint extends IGraphicsBasicConfig {
|
|
45
|
-
x: number;
|
|
46
|
-
y: number;
|
|
47
|
-
radius?: number;
|
|
48
|
-
}
|
|
49
5
|
declare type IViewOperationProps = {
|
|
50
6
|
style: IBasicStyle;
|
|
51
7
|
annotations: IAnnotationData[];
|
|
@@ -55,6 +11,7 @@ export default class ViewOperation extends BasicToolOperation {
|
|
|
55
11
|
annotations: IAnnotationData[];
|
|
56
12
|
private mouseHoverID?;
|
|
57
13
|
private loading;
|
|
14
|
+
private renderDomInstance;
|
|
58
15
|
constructor(props: IViewOperationProps);
|
|
59
16
|
setLoading(loading: boolean): void;
|
|
60
17
|
onMouseLeave(): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { CoordinateUtils } from '@/utils/tool/AxisUtils';
|
|
2
|
+
import { EToolName } from '@/constant/tool';
|
|
3
|
+
import { IPolygonConfig } from '@/types/tool/polygon';
|
|
1
4
|
import { EDragStatus, EGrowthMode, ELang } from '../../constant/annotation';
|
|
2
5
|
import ActionsHistory from '../../utils/ActionsHistory';
|
|
3
6
|
import DblClickEventListener from '../../utils/tool/DblClickEventListener';
|
|
4
7
|
import EventListener from './eventListener';
|
|
5
|
-
import { CoordinateUtils } from '@/utils/tool/AxisUtils';
|
|
6
|
-
import { EToolName } from '@/constant/tool';
|
|
7
|
-
import { IPolygonConfig } from '@/types/tool/polygon';
|
|
8
8
|
interface IBasicToolOperationProps {
|
|
9
9
|
container: HTMLElement;
|
|
10
10
|
size: ISize;
|
|
@@ -88,6 +88,7 @@ declare class BasicToolOperation extends EventListener {
|
|
|
88
88
|
setLang(lang: ELang): void;
|
|
89
89
|
setShowDefaultCursor(showDefaultCursor: boolean): void;
|
|
90
90
|
get forbidMouseOperation(): boolean;
|
|
91
|
+
get pixelRatio(): number;
|
|
91
92
|
init(): void;
|
|
92
93
|
destroy(): void;
|
|
93
94
|
createCanvas(size: ISize): void;
|
|
@@ -57,7 +57,7 @@ declare class PointOperation extends BasicToolOperation {
|
|
|
57
57
|
onDragMove(e: MouseEvent): void;
|
|
58
58
|
onKeyDown(e: KeyboardEvent): void;
|
|
59
59
|
createPoint(e: MouseEvent): void;
|
|
60
|
-
isInPoint(pos: ICoordinate, point: ICoordinate): boolean;
|
|
60
|
+
isInPoint(pos: ICoordinate, point: ICoordinate, zoom?: number): boolean;
|
|
61
61
|
getHoverId(): string | undefined;
|
|
62
62
|
rightMouseUp(): void;
|
|
63
63
|
onTabKeyDown(e: KeyboardEvent): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IPolygonPoint, IPolygonData, IPolygonConfig } from '../../types/tool/polygon';
|
|
2
1
|
import { EToolName, ELineTypes } from '@/constant/tool';
|
|
2
|
+
import { IPolygonPoint, IPolygonData, IPolygonConfig } from '../../types/tool/polygon';
|
|
3
3
|
export default class AxisUtils {
|
|
4
4
|
/**
|
|
5
5
|
* 获取原图坐标下,相对当前图片的偏移值
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ECheckModel, EToolName } from '@/constant/tool';
|
|
1
2
|
import { IPolygonPoint } from '../../types/tool/polygon';
|
|
2
3
|
import { ESortDirection } from '../../constant/annotation';
|
|
3
|
-
import { ECheckModel, EToolName } from '@/constant/tool';
|
|
4
4
|
import CheckOperation from '../../core/toolOperation/checkOperation';
|
|
5
5
|
import PolygonOperation from '../../core/toolOperation/polygonOperation';
|
|
6
6
|
import RectOperationAsNewName from '../../core/toolOperation/rectOperation';
|
|
@@ -31,10 +31,18 @@ export default class DrawUtils {
|
|
|
31
31
|
static drawRectWithFill(canvas: HTMLCanvasElement, rect: IRect, options?: Partial<{
|
|
32
32
|
color: string;
|
|
33
33
|
}>): void;
|
|
34
|
+
/**
|
|
35
|
+
* 通过 DOM 形式创建标签
|
|
36
|
+
* @param parent
|
|
37
|
+
* @param text
|
|
38
|
+
* @param id
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
static drawTagByDom(parent: HTMLElement, text: string, id: string): HTMLDivElement | undefined;
|
|
34
42
|
static drawTag(canvas: HTMLCanvasElement, tagList: {
|
|
35
43
|
keyName: string;
|
|
36
44
|
value: string[];
|
|
37
|
-
}[]):
|
|
45
|
+
}[]): HTMLDivElement | undefined;
|
|
38
46
|
/**
|
|
39
47
|
* 绘制点击线条
|
|
40
48
|
* @param canvas
|
|
@@ -47,9 +55,9 @@ export default class DrawUtils {
|
|
|
47
55
|
thickness: number;
|
|
48
56
|
lineCap: CanvasLineCap;
|
|
49
57
|
lineType: ELineTypes;
|
|
50
|
-
hoverEdgeIndex: number;
|
|
51
58
|
lineDash: number[];
|
|
52
|
-
|
|
59
|
+
hoverEdgeIndex: number;
|
|
60
|
+
}>): IPolygonPoint[] | undefined;
|
|
53
61
|
static drawCircle(canvas: HTMLCanvasElement, anchorPoint: IPoint, radius: number, options?: Partial<{
|
|
54
62
|
startAngleDeg: number;
|
|
55
63
|
endAngleDeg: number;
|
|
@@ -78,11 +86,11 @@ export default class DrawUtils {
|
|
|
78
86
|
isClose: boolean;
|
|
79
87
|
lineType: ELineTypes;
|
|
80
88
|
lineDash: number[];
|
|
81
|
-
}>):
|
|
89
|
+
}>): IPolygonPoint[];
|
|
82
90
|
static drawPolygonWithFill(canvas: HTMLCanvasElement, pointList: IPolygonPoint[], options?: Partial<{
|
|
83
91
|
color: string;
|
|
84
92
|
lineType: ELineTypes;
|
|
85
|
-
}>):
|
|
93
|
+
}>): IPolygonPoint[] | undefined;
|
|
86
94
|
static drawPolygonWithFillAndLine(canvas: HTMLCanvasElement, pointList: IPolygonPoint[], options?: Partial<{
|
|
87
95
|
strokeColor: string;
|
|
88
96
|
fillColor: string;
|
|
@@ -17,6 +17,7 @@ export default class PolygonUtils {
|
|
|
17
17
|
static createSmoothCurvePointsFromPointList(pointList: Array<{
|
|
18
18
|
x: number;
|
|
19
19
|
y: number;
|
|
20
|
+
[a: string]: any;
|
|
20
21
|
}>, numberOfSegments?: number): any[];
|
|
21
22
|
static createSmoothCurvePoints(points: any[], tension?: number, closed?: boolean, numberOfSegments?: number): any[];
|
|
22
23
|
/**
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 渲染 DOM 类
|
|
3
|
+
*/
|
|
4
|
+
interface IProps {
|
|
5
|
+
container: HTMLElement;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export default class RenderDomClass {
|
|
9
|
+
private _domMap;
|
|
10
|
+
private _container;
|
|
11
|
+
private _height;
|
|
12
|
+
constructor(props: IProps);
|
|
13
|
+
wheelChange(e: any): void;
|
|
14
|
+
/**
|
|
15
|
+
* 清除当前渲染的标签
|
|
16
|
+
*/
|
|
17
|
+
clearTag(id: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* 对比当前内容和后续内容的区别
|
|
20
|
+
*/
|
|
21
|
+
render(annotations: IBasicText[]): void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|