@inweb/markup 25.7.9 → 25.7.10
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 +12 -9
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +11 -8
- package/dist/markup.module.js.map +1 -1
- package/lib/markup/IMarkup.d.ts +7 -0
- package/lib/markup/Konva/KonvaMarkup.d.ts +2 -1
- package/package.json +3 -3
- package/src/markup/IMarkup.ts +8 -0
- package/src/markup/Konva/KonvaMarkup.ts +14 -10
package/lib/markup/IMarkup.d.ts
CHANGED
|
@@ -93,6 +93,13 @@ export interface IMarkup {
|
|
|
93
93
|
* Create a viewpoint.
|
|
94
94
|
*/
|
|
95
95
|
getViewpoint(): IViewpoint;
|
|
96
|
+
/**
|
|
97
|
+
* Enables mouse interactions to select or draw markups.
|
|
98
|
+
*
|
|
99
|
+
* @param mode - Edit mode. Matches the type of markup object being created or object
|
|
100
|
+
* selecting mode. To exit edit mode provide this to `false`.
|
|
101
|
+
*/
|
|
102
|
+
enableEditMode(mode: MarkupMode | false): this;
|
|
96
103
|
/**
|
|
97
104
|
* Create a Markup object.
|
|
98
105
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IEventEmitter } from "@inweb/eventemitter2";
|
|
2
2
|
import { ChangeActiveDraggerEvent, IViewpoint, PanEvent } from "@inweb/viewer-core";
|
|
3
|
-
import { IMarkup } from "../IMarkup";
|
|
3
|
+
import { IMarkup, MarkupMode } from "../IMarkup";
|
|
4
4
|
import { IWorldTransform } from "../IWorldTransform";
|
|
5
5
|
import { IMarkupObject } from "../IMarkupObject";
|
|
6
6
|
import { MarkupLineType } from "../IMarkupLine";
|
|
@@ -49,6 +49,7 @@ export declare class KonvaMarkup implements IMarkup {
|
|
|
49
49
|
colorizeSelectedMarkups(r: number, g: number, b: number): void;
|
|
50
50
|
setViewpoint(viewpoint: IViewpoint): void;
|
|
51
51
|
getViewpoint(): IViewpoint;
|
|
52
|
+
enableEditMode(mode: MarkupMode | false): this;
|
|
52
53
|
createObject(type: string, params: any): IMarkupObject;
|
|
53
54
|
getObjects(): IMarkupObject[];
|
|
54
55
|
getSelectedObjects(): IMarkupObject[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/markup",
|
|
3
|
-
"version": "25.7.
|
|
3
|
+
"version": "25.7.10",
|
|
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.7.
|
|
30
|
-
"@inweb/viewer-core": "~25.7.
|
|
29
|
+
"@inweb/eventemitter2": "~25.7.10",
|
|
30
|
+
"@inweb/viewer-core": "~25.7.10"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"canvas": "^2.11.2",
|
package/src/markup/IMarkup.ts
CHANGED
|
@@ -132,6 +132,14 @@ export interface IMarkup {
|
|
|
132
132
|
*/
|
|
133
133
|
getViewpoint(): IViewpoint;
|
|
134
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Enables mouse interactions to select or draw markups.
|
|
137
|
+
*
|
|
138
|
+
* @param mode - Edit mode. Matches the type of markup object being created or object
|
|
139
|
+
* selecting mode. To exit edit mode provide this to `false`.
|
|
140
|
+
*/
|
|
141
|
+
enableEditMode(mode: MarkupMode | false): this;
|
|
142
|
+
|
|
135
143
|
/**
|
|
136
144
|
* Create a Markup object.
|
|
137
145
|
*
|
|
@@ -25,7 +25,7 @@ import Konva from "konva";
|
|
|
25
25
|
import { IEventEmitter } from "@inweb/eventemitter2";
|
|
26
26
|
import { ChangeActiveDraggerEvent, IViewpoint, PanEvent } from "@inweb/viewer-core";
|
|
27
27
|
|
|
28
|
-
import { IMarkup } from "../IMarkup";
|
|
28
|
+
import { IMarkup, MarkupMode } from "../IMarkup";
|
|
29
29
|
import { IWorldTransform } from "../IWorldTransform";
|
|
30
30
|
import { IMarkupObject } from "../IMarkupObject";
|
|
31
31
|
import { IMarkupColorable } from "../IMarkupColorable";
|
|
@@ -84,7 +84,7 @@ export class KonvaMarkup implements IMarkup {
|
|
|
84
84
|
private _container: HTMLElement;
|
|
85
85
|
private _pointerEvents: string[];
|
|
86
86
|
private _markupIsActive = false;
|
|
87
|
-
private _markupMode:
|
|
87
|
+
private _markupMode: MarkupMode;
|
|
88
88
|
private _markupColor = new MarkupColor(255, 0, 0);
|
|
89
89
|
private _konvaStage: Konva.Stage;
|
|
90
90
|
private _konvaLayer: Konva.Layer;
|
|
@@ -187,14 +187,7 @@ export class KonvaMarkup implements IMarkup {
|
|
|
187
187
|
this.removeTextInput();
|
|
188
188
|
this.removeImageInput();
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
if (konvaShape) {
|
|
192
|
-
this._markupMode = draggerName;
|
|
193
|
-
this._markupIsActive = true;
|
|
194
|
-
} else {
|
|
195
|
-
this._markupIsActive = false;
|
|
196
|
-
this._konvaTransformer.nodes([]);
|
|
197
|
-
}
|
|
190
|
+
this.enableEditMode(draggerName as MarkupMode);
|
|
198
191
|
};
|
|
199
192
|
|
|
200
193
|
resizeContainer = (entries: ResizeObserverEntry[]) => {
|
|
@@ -290,6 +283,17 @@ export class KonvaMarkup implements IMarkup {
|
|
|
290
283
|
return viewpoint;
|
|
291
284
|
}
|
|
292
285
|
|
|
286
|
+
enableEditMode(mode: MarkupMode | false): this {
|
|
287
|
+
if (!mode || !MarkupMode2Konva[mode]) {
|
|
288
|
+
this.clearSelected();
|
|
289
|
+
this._markupIsActive = false;
|
|
290
|
+
} else {
|
|
291
|
+
this._markupMode = mode;
|
|
292
|
+
this._markupIsActive = true;
|
|
293
|
+
}
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
296
|
+
|
|
293
297
|
createObject(type: string, params: any): IMarkupObject {
|
|
294
298
|
let object = null;
|
|
295
299
|
let zIndex = this._zIndex;
|