@inweb/markup 27.3.1 → 27.4.1
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.map +1 -1
- package/dist/markup.module.js.map +1 -1
- package/lib/markup/Konva/KonvaMarkup.d.ts +2 -2
- package/lib/markup/Konva/primitives/KonvaCloud.d.ts +4 -1
- package/lib/markup/primitives/IMarkupLine.d.ts +3 -3
- package/package.json +3 -3
- package/src/markup/Konva/KonvaMarkup.ts +3 -2
- package/src/markup/Konva/primitives/KonvaCloud.ts +4 -4
- package/src/markup/Konva/primitives/KonvaImage.ts +1 -1
- package/src/markup/primitives/IMarkupLine.ts +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IEventEmitter } from "@inweb/eventemitter2";
|
|
2
|
-
import { ChangeActiveDraggerEvent, IViewpoint } from "@inweb/viewer-core";
|
|
2
|
+
import { ChangeActiveDraggerEvent, ChangeMarkupColorEvent, IViewpoint } from "@inweb/viewer-core";
|
|
3
3
|
import { IMarkup, MarkupMode } from "../IMarkup";
|
|
4
4
|
import { IWorldTransform } from "../IWorldTransform";
|
|
5
5
|
import { IMarkupObject } from "../IMarkupObject";
|
|
@@ -37,7 +37,7 @@ export declare class KonvaMarkup implements IMarkup {
|
|
|
37
37
|
pan: () => void;
|
|
38
38
|
zoomAt: () => void;
|
|
39
39
|
changeCameraMode: () => void;
|
|
40
|
-
redirectToViewer: (event:
|
|
40
|
+
redirectToViewer: (event: ChangeMarkupColorEvent) => void;
|
|
41
41
|
syncOverlay(): void;
|
|
42
42
|
clearOverlay(): void;
|
|
43
43
|
getMarkupColor(): {
|
|
@@ -15,7 +15,10 @@ export declare class KonvaCloud implements IMarkupCloud {
|
|
|
15
15
|
getZIndex(): number;
|
|
16
16
|
setZIndex(zIndex: number): void;
|
|
17
17
|
delete(): void;
|
|
18
|
-
getPosition():
|
|
18
|
+
getPosition(): {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
19
22
|
setPosition(x: number, y: number): void;
|
|
20
23
|
getWidth(): number;
|
|
21
24
|
setWidth(w: number): void;
|
|
@@ -19,7 +19,7 @@ export interface IMarkupLine extends IMarkupObject, IMarkupColorable {
|
|
|
19
19
|
/**
|
|
20
20
|
* Sets the line width.
|
|
21
21
|
*/
|
|
22
|
-
setLineWidth(size: number):
|
|
22
|
+
setLineWidth(size: number): void;
|
|
23
23
|
/**
|
|
24
24
|
* Returns the line type. Can be `solid`, `dot` or `dash`.
|
|
25
25
|
*/
|
|
@@ -29,7 +29,7 @@ export interface IMarkupLine extends IMarkupObject, IMarkupColorable {
|
|
|
29
29
|
*
|
|
30
30
|
* @param type - Line type. Can be `solid`, `dot` or `dash`.
|
|
31
31
|
*/
|
|
32
|
-
setLineType(type: string):
|
|
32
|
+
setLineType(type: string): void;
|
|
33
33
|
/**
|
|
34
34
|
* Adds the specified points to the end of the line.
|
|
35
35
|
*
|
|
@@ -38,7 +38,7 @@ export interface IMarkupLine extends IMarkupObject, IMarkupColorable {
|
|
|
38
38
|
addPoints(points: [{
|
|
39
39
|
x: number;
|
|
40
40
|
y: number;
|
|
41
|
-
}]):
|
|
41
|
+
}]): void;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Defines the parameters for creating a {@link IMarkupLine | markup line}.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/markup",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.4.1",
|
|
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": "~27.
|
|
30
|
-
"@inweb/viewer-core": "~27.
|
|
29
|
+
"@inweb/eventemitter2": "~27.4.1",
|
|
30
|
+
"@inweb/viewer-core": "~27.4.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"konva": "^10.2.0"
|
|
@@ -25,6 +25,7 @@ import Konva from "konva";
|
|
|
25
25
|
import { IEventEmitter } from "@inweb/eventemitter2";
|
|
26
26
|
import {
|
|
27
27
|
ChangeActiveDraggerEvent,
|
|
28
|
+
ChangeMarkupColorEvent,
|
|
28
29
|
IArrow,
|
|
29
30
|
ICloud,
|
|
30
31
|
IEllipse,
|
|
@@ -214,7 +215,7 @@ export class KonvaMarkup implements IMarkup {
|
|
|
214
215
|
this.clearOverlay();
|
|
215
216
|
};
|
|
216
217
|
|
|
217
|
-
redirectToViewer = (event:
|
|
218
|
+
redirectToViewer = (event: ChangeMarkupColorEvent) => {
|
|
218
219
|
if (this._viewer) this._viewer.emit(event);
|
|
219
220
|
};
|
|
220
221
|
|
|
@@ -462,7 +463,7 @@ export class KonvaMarkup implements IMarkup {
|
|
|
462
463
|
});
|
|
463
464
|
}
|
|
464
465
|
|
|
465
|
-
private initializeKonva():
|
|
466
|
+
private initializeKonva(): void {
|
|
466
467
|
// first we need Konva core things: stage and layer
|
|
467
468
|
const stage = new Konva.Stage({
|
|
468
469
|
container: this._markupContainer,
|
|
@@ -96,13 +96,13 @@ export class KonvaCloud implements IMarkupCloud {
|
|
|
96
96
|
drawCloud(ARC_RADIUS / 2, ARC_LENGTH / 2);
|
|
97
97
|
else drawRectangle();
|
|
98
98
|
|
|
99
|
-
function calculateMidpoint(position) {
|
|
99
|
+
function calculateMidpoint(position: { x: number; y: number }): { x: number; y: number } {
|
|
100
100
|
const midX = position.x + width / 2;
|
|
101
101
|
const midY = position.y + height / 2;
|
|
102
102
|
return { x: midX, y: midY };
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function drawCloud(arcRadius, arcLength) {
|
|
105
|
+
function drawCloud(arcRadius: number, arcLength: number): void {
|
|
106
106
|
const midPoint = calculateMidpoint({ x: 0, y: 0 });
|
|
107
107
|
|
|
108
108
|
context.beginPath();
|
|
@@ -141,7 +141,7 @@ export class KonvaCloud implements IMarkupCloud {
|
|
|
141
141
|
context.fillStrokeShape(shape);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
function drawRectangle() {
|
|
144
|
+
function drawRectangle(): void {
|
|
145
145
|
context.beginPath();
|
|
146
146
|
context.lineTo(points[1].x, points[1].y);
|
|
147
147
|
context.lineTo(points[2].x, points[2].y);
|
|
@@ -265,7 +265,7 @@ export class KonvaCloud implements IMarkupCloud {
|
|
|
265
265
|
this._ref = null;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
getPosition() {
|
|
268
|
+
getPosition(): { x: number; y: number } {
|
|
269
269
|
return this._ref.position();
|
|
270
270
|
}
|
|
271
271
|
|
|
@@ -46,7 +46,7 @@ export interface IMarkupLine extends IMarkupObject, IMarkupColorable {
|
|
|
46
46
|
/**
|
|
47
47
|
* Sets the line width.
|
|
48
48
|
*/
|
|
49
|
-
setLineWidth(size: number);
|
|
49
|
+
setLineWidth(size: number): void;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Returns the line type. Can be `solid`, `dot` or `dash`.
|
|
@@ -58,14 +58,14 @@ export interface IMarkupLine extends IMarkupObject, IMarkupColorable {
|
|
|
58
58
|
*
|
|
59
59
|
* @param type - Line type. Can be `solid`, `dot` or `dash`.
|
|
60
60
|
*/
|
|
61
|
-
setLineType(type: string);
|
|
61
|
+
setLineType(type: string): void;
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* Adds the specified points to the end of the line.
|
|
65
65
|
*
|
|
66
66
|
* @param points - Array of 2D points.
|
|
67
67
|
*/
|
|
68
|
-
addPoints(points: [{ x: number; y: number }]);
|
|
68
|
+
addPoints(points: [{ x: number; y: number }]): void;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|