@inweb/markup 25.8.20 → 25.8.21
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/markup.js +35 -34
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +22 -22
- package/dist/markup.module.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/markup/IMarkup.d.ts +27 -16
- package/lib/markup/IMarkupArrow.d.ts +8 -16
- package/lib/markup/IMarkupCloud.d.ts +9 -18
- package/lib/markup/IMarkupColorable.d.ts +5 -4
- package/lib/markup/IMarkupEllipse.d.ts +9 -18
- package/lib/markup/IMarkupImage.d.ts +14 -17
- package/lib/markup/IMarkupLine.d.ts +44 -11
- package/lib/markup/IMarkupObject.d.ts +25 -15
- package/lib/markup/IMarkupRectangle.d.ts +9 -18
- package/lib/markup/IMarkupText.d.ts +7 -14
- package/lib/markup/IWorldTransform.d.ts +1 -1
- package/lib/markup/Konva/KonvaLine.d.ts +2 -11
- package/lib/markup/Konva/KonvaMarkup.d.ts +2 -2
- package/lib/markup/Konva/MarkupColor.d.ts +19 -18
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/markup/IMarkup.ts +28 -16
- package/src/markup/IMarkupArrow.ts +8 -16
- package/src/markup/IMarkupCloud.ts +9 -18
- package/src/markup/IMarkupColorable.ts +5 -4
- package/src/markup/IMarkupEllipse.ts +9 -18
- package/src/markup/IMarkupImage.ts +14 -17
- package/src/markup/IMarkupLine.ts +46 -11
- package/src/markup/IMarkupObject.ts +25 -15
- package/src/markup/IMarkupRectangle.ts +9 -18
- package/src/markup/IMarkupText.ts +7 -14
- package/src/markup/IWorldTransform.ts +1 -1
- package/src/markup/Konva/KonvaArrow.ts +1 -1
- package/src/markup/Konva/KonvaCloud.ts +1 -1
- package/src/markup/Konva/KonvaEllipse.ts +1 -1
- package/src/markup/Konva/KonvaImage.ts +1 -1
- package/src/markup/Konva/KonvaLine.ts +3 -12
- package/src/markup/Konva/KonvaMarkup.ts +15 -15
- package/src/markup/Konva/KonvaText.ts +1 -1
- package/src/markup/Konva/MarkupColor.ts +22 -23
|
@@ -11,7 +11,7 @@ export declare class KonvaMarkup implements IMarkup {
|
|
|
11
11
|
private _viewer;
|
|
12
12
|
private _worldTransformer;
|
|
13
13
|
private _container;
|
|
14
|
-
private
|
|
14
|
+
private _containerEvents;
|
|
15
15
|
private _markupIsActive;
|
|
16
16
|
private _markupMode;
|
|
17
17
|
private _markupColor;
|
|
@@ -31,7 +31,7 @@ export declare class KonvaMarkup implements IMarkup {
|
|
|
31
31
|
lineWidth: number;
|
|
32
32
|
lineType: MarkupLineType;
|
|
33
33
|
fontSize: number;
|
|
34
|
-
initialize(container: HTMLElement,
|
|
34
|
+
initialize(container: HTMLElement, containerEvents?: string[], viewer?: IEventEmitter, worldTransformer?: IWorldTransform): void;
|
|
35
35
|
dispose(): void;
|
|
36
36
|
changeActiveDragger: (event: ChangeActiveDraggerEvent) => void;
|
|
37
37
|
resizeContainer: (entries: ResizeObserverEntry[]) => void;
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Defines the markup color helper object.
|
|
3
3
|
*/
|
|
4
4
|
export declare class MarkupColor {
|
|
5
5
|
R: number;
|
|
6
6
|
G: number;
|
|
7
7
|
B: number;
|
|
8
|
-
|
|
8
|
+
HEX: string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Creates an instance of the color.
|
|
11
|
+
*
|
|
12
|
+
* @param r - The `red` component of the color, as a number between 0 and 255.
|
|
13
|
+
* @param g - The `green` component of the color, as a number between 0 and 255.
|
|
14
|
+
* @param b - The `blue` component of the color, as a number between 0 and 255.
|
|
15
|
+
*/
|
|
16
|
+
constructor(r: number, g: number, b: number);
|
|
17
|
+
/**
|
|
18
|
+
* Returns the color as a string in hexadecimal color syntax `#RGB` using its primary color
|
|
19
|
+
* components (red, green, blue) written as hexadecimal numbers.
|
|
11
20
|
*/
|
|
12
|
-
|
|
21
|
+
asHex(): string;
|
|
13
22
|
/**
|
|
14
|
-
*
|
|
23
|
+
* Returns the color as an {r, g, b} object.
|
|
15
24
|
*/
|
|
16
|
-
|
|
25
|
+
asRGB(): {
|
|
17
26
|
r: number;
|
|
18
27
|
g: number;
|
|
19
28
|
b: number;
|
|
20
29
|
};
|
|
21
30
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* @param r - Red color in [0,255] range
|
|
25
|
-
* @param g - Green color in [0,255] range
|
|
26
|
-
* @param b - Blue color in [0,255] range
|
|
27
|
-
*/
|
|
28
|
-
constructor(r: number, g: number, b: number);
|
|
29
|
-
/**
|
|
30
|
-
* Set Color for current instance
|
|
31
|
+
* Sets the color.
|
|
31
32
|
*
|
|
32
|
-
* @param r -
|
|
33
|
-
* @param g -
|
|
34
|
-
* @param b -
|
|
33
|
+
* @param r - The `red` component of the color, as a number between 0 and 255.
|
|
34
|
+
* @param g - The `green` component of the color, as a number between 0 and 255.
|
|
35
|
+
* @param b - The `blue` component of the color, as a number between 0 and 255.
|
|
35
36
|
*/
|
|
36
37
|
setColor(r: number, g: number, b: number): void;
|
|
37
38
|
private rgbToHex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/markup",
|
|
3
|
-
"version": "25.8.
|
|
3
|
+
"version": "25.8.21",
|
|
4
4
|
"description": "JavaScript 2D markups",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"docs": "typedoc"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@inweb/eventemitter2": "~25.8.
|
|
30
|
-
"@inweb/viewer-core": "~25.8.
|
|
29
|
+
"@inweb/eventemitter2": "~25.8.21",
|
|
30
|
+
"@inweb/viewer-core": "~25.8.21"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"konva": "^9.2.0"
|
package/src/index.ts
CHANGED
|
@@ -27,7 +27,7 @@ export { IMarkupCloud } from "./markup/IMarkupCloud";
|
|
|
27
27
|
export { IMarkupColorable } from "./markup/IMarkupColorable";
|
|
28
28
|
export { IMarkupEllipse } from "./markup/IMarkupEllipse";
|
|
29
29
|
export { IMarkupImage } from "./markup/IMarkupImage";
|
|
30
|
-
export { IMarkupLine, MarkupLineType } from "./markup/IMarkupLine";
|
|
30
|
+
export { IMarkupLine, IMarkupLineParams, MarkupLineType } from "./markup/IMarkupLine";
|
|
31
31
|
export { IMarkupObject } from "./markup/IMarkupObject";
|
|
32
32
|
export { IMarkupRectangle } from "./markup/IMarkupRectangle";
|
|
33
33
|
export { IMarkupText } from "./markup/IMarkupText";
|
package/src/markup/IMarkup.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { IEventEmitter } from "@inweb/eventemitter2";
|
|
|
25
25
|
import { IViewpoint } from "@inweb/viewer-core";
|
|
26
26
|
import { IWorldTransform } from "./IWorldTransform";
|
|
27
27
|
import { IMarkupObject } from "./IMarkupObject";
|
|
28
|
+
import { IMarkupLineParams } from "./IMarkupLine";
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Defines the markup edit mode. Matches the type of markup object being created.
|
|
@@ -50,7 +51,7 @@ export interface IMarkup {
|
|
|
50
51
|
lineType: string;
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
|
-
* Font size of new markup text
|
|
54
|
+
* Font size of new markup text.
|
|
54
55
|
*
|
|
55
56
|
* @default 34
|
|
56
57
|
*/
|
|
@@ -62,8 +63,11 @@ export interface IMarkup {
|
|
|
62
63
|
* @param container - Container element used to operate on. This is usually a `<canvas>` or
|
|
63
64
|
* `<div>` on top of which the markup is drawn. If the `container` is a `<canvas>` element,
|
|
64
65
|
* its content will be combined with the markup in the viewpoint snapshot.
|
|
65
|
-
* @param
|
|
66
|
-
*
|
|
66
|
+
* @param containerEvents - List of container events, such as mouse events or
|
|
67
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Pointer_events#event_types_and_global_event_handlers | pointer events}
|
|
68
|
+
* or
|
|
69
|
+
* {@link https://developer.mozilla.org/docs/Web/API/TouchEvent#touch_event_types | touch events}
|
|
70
|
+
* that the markup should redirect to the `viewer`.
|
|
67
71
|
* @param viewer - `Viewer` instance that receives pointing device events.
|
|
68
72
|
* @param worldTransformer - Transformer of screen space into the `viewer` world space and
|
|
69
73
|
* vice versa. If a transformer is defined, markup objects will be stored at the viewpoint
|
|
@@ -71,7 +75,7 @@ export interface IMarkup {
|
|
|
71
75
|
*/
|
|
72
76
|
initialize(
|
|
73
77
|
container: HTMLElement,
|
|
74
|
-
|
|
78
|
+
containerEvents?: string[],
|
|
75
79
|
viewer?: IEventEmitter,
|
|
76
80
|
worldTransformer?: IWorldTransform
|
|
77
81
|
): void;
|
|
@@ -94,9 +98,9 @@ export interface IMarkup {
|
|
|
94
98
|
/**
|
|
95
99
|
* Sets the color of new markup objects.
|
|
96
100
|
*
|
|
97
|
-
* @param r - `
|
|
98
|
-
* @param g - `
|
|
99
|
-
* @param b - `
|
|
101
|
+
* @param r - The `red` component of the color, as a number between 0 and 255.
|
|
102
|
+
* @param g - The `green` component of the color, as a number between 0 and 255.
|
|
103
|
+
* @param b - The `blue` component of the color, as a number between 0 and 255.
|
|
100
104
|
*/
|
|
101
105
|
setMarkupColor(r: number, g: number, b: number): void;
|
|
102
106
|
|
|
@@ -108,18 +112,18 @@ export interface IMarkup {
|
|
|
108
112
|
/**
|
|
109
113
|
* Colors all markup objects with the specified color.
|
|
110
114
|
*
|
|
111
|
-
* @param r - `
|
|
112
|
-
* @param g - `
|
|
113
|
-
* @param b - `
|
|
115
|
+
* @param r - The `red` component of the color, as a number between 0 and 255.
|
|
116
|
+
* @param g - The `green` component of the color, as a number between 0 and 255.
|
|
117
|
+
* @param b - The `blue` component of the color, as a number between 0 and 255.
|
|
114
118
|
*/
|
|
115
119
|
colorizeAllMarkup(r: number, g: number, b: number): void;
|
|
116
120
|
|
|
117
121
|
/**
|
|
118
|
-
* Colors selected markup objects with the specified color.
|
|
122
|
+
* Colors the selected markup objects with the specified color.
|
|
119
123
|
*
|
|
120
|
-
* @param r - `
|
|
121
|
-
* @param g - `
|
|
122
|
-
* @param b - `
|
|
124
|
+
* @param r - The `red` component of the color, as a number between 0 and 255.
|
|
125
|
+
* @param g - The `green` component of the color, as a number between 0 and 255.
|
|
126
|
+
* @param b - The `blue` component of the color, as a number between 0 and 255.
|
|
123
127
|
*/
|
|
124
128
|
colorizeSelectedMarkups(r: number, g: number, b: number): void;
|
|
125
129
|
|
|
@@ -148,7 +152,15 @@ export interface IMarkup {
|
|
|
148
152
|
*
|
|
149
153
|
* @param type - Markup object type. Can be `Line`, `Text`, `Rectangle`, `Ellipse`, `Arrow`,
|
|
150
154
|
* `Image` or `Cloud`.
|
|
151
|
-
* @param params -
|
|
155
|
+
* @param params - Parameters for creating a markup object. Must match the object type:
|
|
156
|
+
*
|
|
157
|
+
* - `Line` - {@link IMarkupLineParams}
|
|
158
|
+
* - `Text` - {@link IMarkupTextParams}
|
|
159
|
+
* - `Rectangle` - {@link IMarkupRectangleParams}
|
|
160
|
+
* - `Ellipse` - {@link IMarkupEllipseParams}
|
|
161
|
+
* - `Arrow` - {@link IMarkupArrowParams}
|
|
162
|
+
* - `Image` - {@link IMarkupImageParams}
|
|
163
|
+
* - `Cloud` - {@link IMarkupCloudParams}
|
|
152
164
|
*/
|
|
153
165
|
createObject(type: string, params: any): IMarkupObject;
|
|
154
166
|
|
|
@@ -163,7 +175,7 @@ export interface IMarkup {
|
|
|
163
175
|
getSelectedObjects(): IMarkupObject[];
|
|
164
176
|
|
|
165
177
|
/**
|
|
166
|
-
* Selects specified markup objects.
|
|
178
|
+
* Selects the specified markup objects.
|
|
167
179
|
*
|
|
168
180
|
* @param objects - The list of markup objects.
|
|
169
181
|
*/
|
|
@@ -25,46 +25,38 @@ import { IMarkupObject } from "./IMarkupObject";
|
|
|
25
25
|
import { IMarkupColorable } from "./IMarkupColorable";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Arrow
|
|
28
|
+
* 2D markup Arrow object interface.
|
|
29
29
|
*/
|
|
30
30
|
export interface IMarkupArrow extends IMarkupObject, IMarkupColorable {
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @returns {{ x: number; y: number }} array of points
|
|
32
|
+
* Returns the coordinales of the start and end points of arrow.
|
|
35
33
|
*/
|
|
36
34
|
getPoints(): { x: number; y: number }[];
|
|
37
35
|
|
|
38
36
|
/**
|
|
39
|
-
*
|
|
37
|
+
* Sets the coordinales of the start and end points of the arrow.
|
|
40
38
|
*
|
|
41
|
-
* @param {{ x: number; y: number }} points -
|
|
39
|
+
* @param {{ x: number; y: number }} points - Array of points.
|
|
42
40
|
*/
|
|
43
41
|
setPoints(points: { x: number; y: number }[]);
|
|
44
42
|
|
|
45
43
|
/**
|
|
46
|
-
*
|
|
44
|
+
* Returns the coordinales of the start point of arrow.
|
|
47
45
|
*/
|
|
48
46
|
getStartPoint(): { x: number; y: number };
|
|
49
47
|
|
|
50
48
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @param x - value of X coordinate
|
|
54
|
-
* @param y - value of Y coordinate
|
|
49
|
+
* Sets the coordinales of the start point of the arrow.
|
|
55
50
|
*/
|
|
56
51
|
setStartPoint(x: number, y: number);
|
|
57
52
|
|
|
58
53
|
/**
|
|
59
|
-
*
|
|
54
|
+
* Returns the coordinales of the end point of arrow.
|
|
60
55
|
*/
|
|
61
56
|
getEndPoint(): { x: number; y: number };
|
|
62
57
|
|
|
63
58
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @param x - value of X coordinate
|
|
67
|
-
* @param y - value of Y coordinate
|
|
59
|
+
* Sets the coordinales of the end point of the arrow.
|
|
68
60
|
*/
|
|
69
61
|
setEndPoint(x: number, y: number);
|
|
70
62
|
}
|
|
@@ -25,55 +25,46 @@ import { IMarkupObject } from "./IMarkupObject";
|
|
|
25
25
|
import { IMarkupColorable } from "./IMarkupColorable";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Cloud
|
|
28
|
+
* 2D markup Cloud object interface.
|
|
29
29
|
*/
|
|
30
30
|
export interface IMarkupCloud extends IMarkupObject, IMarkupColorable {
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Returns the coordinates of the top-left point (position) of the cloud.
|
|
33
33
|
*/
|
|
34
34
|
getPosition(): { x: number; y: number };
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @param x - value of X coordinate
|
|
40
|
-
* @param y - value of Y coordinate
|
|
37
|
+
* Sets the coordinates of the top-left point (position) of the cloud.
|
|
41
38
|
*/
|
|
42
39
|
setPosition(x: number, y: number);
|
|
43
40
|
|
|
44
41
|
/**
|
|
45
|
-
*
|
|
42
|
+
* Returns the width of the cloud.
|
|
46
43
|
*/
|
|
47
44
|
getWidth(): number;
|
|
48
45
|
|
|
49
46
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* @param w - value of width. Default value is 200
|
|
47
|
+
* Sets the width of the cloud.
|
|
53
48
|
*/
|
|
54
49
|
setWidth(w: number);
|
|
55
50
|
|
|
56
51
|
/**
|
|
57
|
-
*
|
|
52
|
+
* Returns the height of the cloud.
|
|
58
53
|
*/
|
|
59
54
|
getHeigth(): number;
|
|
60
55
|
|
|
61
56
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* @param h - value of height. Default value is 200
|
|
57
|
+
* Sets the height of the cloud.
|
|
65
58
|
*/
|
|
66
59
|
setHeight(h: number);
|
|
67
60
|
|
|
68
61
|
/**
|
|
69
|
-
*
|
|
62
|
+
* Returns the line width of the cloud.
|
|
70
63
|
*/
|
|
71
64
|
getLineWidth(): number;
|
|
72
65
|
|
|
73
66
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* @param size - value of width. Defailt value is 4
|
|
67
|
+
* Sets the line width of the cloud.
|
|
77
68
|
*/
|
|
78
69
|
setLineWidth(size: number);
|
|
79
70
|
}
|
|
@@ -22,18 +22,19 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 2D markup colorable object interface.
|
|
26
26
|
*/
|
|
27
27
|
export interface IMarkupColorable {
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Returns the foreground color of an object's line or text as a string in hexadecimal color
|
|
30
|
+
* syntax `#RGB` using its primary color components (red, green, blue) written as hexadecimal numbers.
|
|
30
31
|
*/
|
|
31
32
|
getColor(): string;
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
|
-
*
|
|
35
|
+
* Sets the foreground color of an object's line or text.
|
|
35
36
|
*
|
|
36
|
-
* @param hex -
|
|
37
|
+
* @param hex - Color in hexadecimal color syntax `#RGB`.
|
|
37
38
|
*/
|
|
38
39
|
setColor(hex: string): void;
|
|
39
40
|
}
|
|
@@ -25,55 +25,46 @@ import { IMarkupObject } from "./IMarkupObject";
|
|
|
25
25
|
import { IMarkupColorable } from "./IMarkupColorable";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Ellipse
|
|
28
|
+
* 2D markup Ellipse object interface.
|
|
29
29
|
*/
|
|
30
30
|
export interface IMarkupEllipse extends IMarkupObject, IMarkupColorable {
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Returns the coordinates of the center point (position) of the ellipse.
|
|
33
33
|
*/
|
|
34
34
|
getPosition(): { x: number; y: number };
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @param x - value of X coordinate
|
|
40
|
-
* @param y - value of Y coordinate
|
|
37
|
+
* Sets the coordinates of the top-left point (position) of the ellipse.
|
|
41
38
|
*/
|
|
42
39
|
setPosition(x: number, y: number);
|
|
43
40
|
|
|
44
41
|
/**
|
|
45
|
-
*
|
|
42
|
+
* Returns the X radius of the ellipse.
|
|
46
43
|
*/
|
|
47
44
|
getRadiusX(): number;
|
|
48
45
|
|
|
49
46
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* @param r - value of X radius of the Ellipse
|
|
47
|
+
* Sets the X radius of the ellipse.
|
|
53
48
|
*/
|
|
54
49
|
setRadiusX(r: number);
|
|
55
50
|
|
|
56
51
|
/**
|
|
57
|
-
*
|
|
52
|
+
* Returns the Y radius of the ellipse.
|
|
58
53
|
*/
|
|
59
54
|
getRadiusY(): number;
|
|
60
55
|
|
|
61
56
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* @param r - value of Y radius of the Ellipse
|
|
57
|
+
* Sets the X radius of the ellipse.
|
|
65
58
|
*/
|
|
66
59
|
setRadiusY(r: number);
|
|
67
60
|
|
|
68
61
|
/**
|
|
69
|
-
*
|
|
62
|
+
* Returns the line width of the ellipse.
|
|
70
63
|
*/
|
|
71
64
|
getLineWidth(): number;
|
|
72
65
|
|
|
73
66
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* @param size - value of width
|
|
67
|
+
* Sets the line width of the ellipse.
|
|
77
68
|
*/
|
|
78
69
|
setLineWidth(size: number);
|
|
79
70
|
}
|
|
@@ -24,55 +24,52 @@
|
|
|
24
24
|
import { IMarkupObject } from "./IMarkupObject";
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Image
|
|
27
|
+
* 2D markup Image object interface.
|
|
28
28
|
*/
|
|
29
29
|
export interface IMarkupImage extends IMarkupObject {
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Returns the coordinates of the top-left point (position) of the image.
|
|
32
32
|
*/
|
|
33
33
|
getPosition(): { x: number; y: number };
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @param x - value of X coordinate
|
|
39
|
-
* @param y - value of Y coordinate
|
|
36
|
+
* Sets the coordinates of the top-left point (position) of the image.
|
|
40
37
|
*/
|
|
41
38
|
setPosition(x: number, y: number);
|
|
42
39
|
|
|
43
40
|
/**
|
|
44
|
-
*
|
|
41
|
+
* Returns the image source as a base64-encoded
|
|
42
|
+
* {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}.
|
|
45
43
|
*/
|
|
46
44
|
getSrc(): string;
|
|
47
45
|
|
|
48
46
|
/**
|
|
49
|
-
*
|
|
47
|
+
* Sets the image source. External image URL is not supported, only base64-encoded
|
|
48
|
+
* {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URLs}.
|
|
50
49
|
*
|
|
51
|
-
* @param src -
|
|
50
|
+
* @param src - Image source as base64-encoded string.
|
|
52
51
|
*/
|
|
53
52
|
setSrc(src: string);
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
|
-
*
|
|
55
|
+
* Returns the width of the image. The original image is scaled to this width.
|
|
57
56
|
*/
|
|
58
57
|
getWidth(): number;
|
|
59
58
|
|
|
60
59
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* @param w - value of width. Height will be automatically updated according to ratio of the Image
|
|
60
|
+
* Sets the width of the image. The image height will be automatically updated to match its
|
|
61
|
+
* aspect ratio.
|
|
64
62
|
*/
|
|
65
63
|
setWidth(w: number);
|
|
66
64
|
|
|
67
65
|
/**
|
|
68
|
-
*
|
|
66
|
+
* Returns the height of the image. The original image is scaled to this height.
|
|
69
67
|
*/
|
|
70
68
|
getHeight(): number;
|
|
71
69
|
|
|
72
70
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* @param h - value of height. Width will be automatically updated according to ratio of the Image
|
|
71
|
+
* Sets the height of the image. The image width will be automatically updated to match its
|
|
72
|
+
* aspect ratio.
|
|
76
73
|
*/
|
|
77
74
|
setHeight(h: number);
|
|
78
75
|
}
|
|
@@ -30,42 +30,77 @@ import { IMarkupColorable } from "./IMarkupColorable";
|
|
|
30
30
|
export type MarkupLineType = "solid" | "dot" | "dash";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Line
|
|
33
|
+
* 2D markup Line object interface.
|
|
34
34
|
*/
|
|
35
35
|
export interface IMarkupLine extends IMarkupObject, IMarkupColorable {
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Returns the coordinates of the line points as a flat array [x1, y1, x2, y2, ...].
|
|
38
38
|
*/
|
|
39
39
|
getPoints(): number[];
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Returns the line width.
|
|
43
43
|
*/
|
|
44
44
|
getLineWidth(): number;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* @param size - value of width
|
|
47
|
+
* Sets the line width.
|
|
50
48
|
*/
|
|
51
49
|
setLineWidth(size: number);
|
|
52
50
|
|
|
53
51
|
/**
|
|
54
|
-
*
|
|
52
|
+
* Returns the line type. Can be `solid`, `dot` or `dash`.
|
|
55
53
|
*/
|
|
56
54
|
getLineType(): string;
|
|
57
55
|
|
|
58
56
|
/**
|
|
59
|
-
*
|
|
57
|
+
* Sets the line type.
|
|
60
58
|
*
|
|
61
|
-
* @param type
|
|
59
|
+
* @param type - Line type. Can be `solid`, `dot` or `dash`.
|
|
62
60
|
*/
|
|
63
61
|
setLineType(type: string);
|
|
64
62
|
|
|
65
63
|
/**
|
|
66
|
-
*
|
|
64
|
+
* Adds the specified points to the end of the line.
|
|
67
65
|
*
|
|
68
|
-
* @param
|
|
66
|
+
* @param points - Array of 2D points.
|
|
69
67
|
*/
|
|
70
68
|
addPoints(points: [{ x: number; y: number }]);
|
|
71
69
|
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Defines the parameters for creating a {@link IMarkupLine | markup line}.
|
|
73
|
+
*/
|
|
74
|
+
export interface IMarkupLineParams {
|
|
75
|
+
/**
|
|
76
|
+
* Array of line points.
|
|
77
|
+
*/
|
|
78
|
+
points?: { x: number; y: number }[];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Line type. Can be `solid`, `dot` or `dash`.
|
|
82
|
+
*
|
|
83
|
+
* @default "solid"
|
|
84
|
+
*/
|
|
85
|
+
type?: MarkupLineType;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Line width.
|
|
89
|
+
*
|
|
90
|
+
* @default 4
|
|
91
|
+
*/
|
|
92
|
+
width?: number;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Line color as a string in hexadecimal color syntax `#RGB` color using its primary color
|
|
96
|
+
* components (red, green, blue) written as hexadecimal numbers.
|
|
97
|
+
*
|
|
98
|
+
* @default "#ff0000"
|
|
99
|
+
*/
|
|
100
|
+
color?: string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Internal markup object identifier.
|
|
104
|
+
*/
|
|
105
|
+
id?: string;
|
|
106
|
+
}
|
|
@@ -22,57 +22,67 @@
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 2D markup object interface.
|
|
26
26
|
*/
|
|
27
27
|
export interface IMarkupObject {
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Returns a reference to a core markup library object (Konva, VisualizeJS, etc.).
|
|
30
30
|
*/
|
|
31
31
|
ref(): any;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Returns the internal identifier of the object. Not unique.
|
|
35
35
|
*/
|
|
36
36
|
id(): string;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @param value true / false
|
|
39
|
+
* Enables or disables the ability to select and edit an object using the mouse.
|
|
42
40
|
*/
|
|
43
|
-
enableMouseEditing(value: boolean);
|
|
41
|
+
enableMouseEditing(value: boolean): void;
|
|
44
42
|
|
|
45
43
|
/**
|
|
46
|
-
*
|
|
44
|
+
* Returns the type of the object.
|
|
47
45
|
*/
|
|
48
46
|
type(): string;
|
|
49
47
|
|
|
50
48
|
/**
|
|
51
|
-
*
|
|
49
|
+
* Returns the rotation angle of the object, in degress.
|
|
52
50
|
*/
|
|
53
51
|
getRotation(): number;
|
|
54
52
|
|
|
55
53
|
/**
|
|
56
|
-
*
|
|
54
|
+
* Sets the rotation angle of the object.
|
|
57
55
|
*
|
|
58
|
-
* @param degrees
|
|
56
|
+
* @param degrees - Number of degress to rotate.
|
|
59
57
|
*/
|
|
60
58
|
setRotation(degrees: number): void;
|
|
61
59
|
|
|
62
60
|
/**
|
|
63
|
-
*
|
|
61
|
+
* Returns the Z-index of a object relative to sibling objects that are in the same group.
|
|
62
|
+
*
|
|
63
|
+
* Z-Index is not absolute (like in CSS). It is relative to parent object group only:
|
|
64
|
+
*
|
|
65
|
+
* - `images` - are olways at the bottom
|
|
66
|
+
* - `texts` - are olways on top
|
|
67
|
+
* - `others` - are always between images and texts
|
|
64
68
|
*/
|
|
65
69
|
getZIndex(): number;
|
|
66
70
|
|
|
67
71
|
/**
|
|
68
|
-
*
|
|
72
|
+
* Sets the Z-index of a object relative to sibling objects that are in the same group.
|
|
73
|
+
*
|
|
74
|
+
* Z-Index is not absolute (like in CSS). It is relative to parent object group only:
|
|
75
|
+
*
|
|
76
|
+
* - `images` - are olways at the bottom
|
|
77
|
+
* - `texts` - are olways on top
|
|
78
|
+
* - `others` - are always between images and texts
|
|
69
79
|
*
|
|
70
|
-
* @param zIndex integer value of Z-Index
|
|
80
|
+
* @param zIndex - An integer value of Z-Index.
|
|
71
81
|
*/
|
|
72
82
|
setZIndex(zIndex: number): void;
|
|
73
83
|
|
|
74
84
|
/**
|
|
75
|
-
*
|
|
85
|
+
* Deletes the current object.
|
|
76
86
|
*/
|
|
77
87
|
delete(): void;
|
|
78
88
|
}
|