@itwin/core-markup 4.0.0-dev.8 → 4.0.0-dev.81
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/CHANGELOG.md +41 -1
- package/lib/cjs/Markup.d.ts +323 -310
- package/lib/cjs/Markup.d.ts.map +1 -1
- package/lib/cjs/Markup.js +451 -420
- package/lib/cjs/Markup.js.map +1 -1
- package/lib/cjs/MarkupTool.d.ts +38 -38
- package/lib/cjs/MarkupTool.js +88 -88
- package/lib/cjs/MarkupTool.js.map +1 -1
- package/lib/cjs/RedlineTool.d.ts +145 -145
- package/lib/cjs/RedlineTool.d.ts.map +1 -1
- package/lib/cjs/RedlineTool.js +498 -512
- package/lib/cjs/RedlineTool.js.map +1 -1
- package/lib/cjs/SelectTool.d.ts +126 -126
- package/lib/cjs/SelectTool.js +741 -741
- package/lib/cjs/SelectTool.js.map +1 -1
- package/lib/cjs/SvgJsExt.d.ts +85 -85
- package/lib/cjs/SvgJsExt.js +185 -185
- package/lib/cjs/TextEdit.d.ts +43 -43
- package/lib/cjs/TextEdit.js +196 -196
- package/lib/cjs/TextEdit.js.map +1 -1
- package/lib/cjs/Undo.d.ts +46 -46
- package/lib/cjs/Undo.js +168 -168
- package/lib/cjs/core-markup.d.ts +18 -18
- package/lib/cjs/core-markup.js +38 -34
- package/lib/cjs/core-markup.js.map +1 -1
- package/lib/esm/Markup.d.ts +323 -310
- package/lib/esm/Markup.d.ts.map +1 -1
- package/lib/esm/Markup.js +447 -415
- package/lib/esm/Markup.js.map +1 -1
- package/lib/esm/MarkupTool.d.ts +38 -38
- package/lib/esm/MarkupTool.js +85 -84
- package/lib/esm/MarkupTool.js.map +1 -1
- package/lib/esm/RedlineTool.d.ts +145 -145
- package/lib/esm/RedlineTool.d.ts.map +1 -1
- package/lib/esm/RedlineTool.js +494 -498
- package/lib/esm/RedlineTool.js.map +1 -1
- package/lib/esm/SelectTool.d.ts +126 -126
- package/lib/esm/SelectTool.js +735 -734
- package/lib/esm/SelectTool.js.map +1 -1
- package/lib/esm/SvgJsExt.d.ts +85 -85
- package/lib/esm/SvgJsExt.js +180 -180
- package/lib/esm/TextEdit.d.ts +43 -43
- package/lib/esm/TextEdit.js +193 -191
- package/lib/esm/TextEdit.js.map +1 -1
- package/lib/esm/Undo.d.ts +46 -46
- package/lib/esm/Undo.js +164 -164
- package/lib/esm/core-markup.d.ts +18 -18
- package/lib/esm/core-markup.js +22 -22
- package/package.json +19 -19
package/lib/esm/Markup.d.ts
CHANGED
|
@@ -1,311 +1,324 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module MarkupApp
|
|
3
|
-
*/
|
|
4
|
-
import { Point3d, XAndY } from "@itwin/core-geometry";
|
|
5
|
-
import { ScreenViewport } from "@itwin/core-frontend";
|
|
6
|
-
import { G, Matrix, Svg } from "@svgdotjs/svg.js";
|
|
7
|
-
import { MarkupSelected } from "./SelectTool";
|
|
8
|
-
import { UndoManager } from "./Undo";
|
|
9
|
-
/** The width and height of a Markup image, in pixels.
|
|
10
|
-
* @public */
|
|
11
|
-
export interface WidthAndHeight {
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
}
|
|
15
|
-
/** The size and SVG string for a Markup
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export interface MarkupSvgData {
|
|
19
|
-
/** The size of the image, in pixels. This also indicates the aspect ratio of the SVG data. */
|
|
20
|
-
rect: WidthAndHeight;
|
|
21
|
-
/** a string holding the svg data for the markup. Will be undefined if [[MarkupApp.stop]] is called without an active Markup */
|
|
22
|
-
svg?: string;
|
|
23
|
-
}
|
|
24
|
-
/** Markup data returned by [[MarkupApp.stop]]
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
export interface MarkupData extends MarkupSvgData {
|
|
28
|
-
/** a base64 encoded string with the image of the view that was marked up. See [[MarkupApp.props.result]] for options. */
|
|
29
|
-
image?: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The main object for the Markup package. It is a singleton that stores the state of the Markup application.
|
|
33
|
-
* It has only static members and methods. Applications may customize and control the behavior of the Markup by
|
|
34
|
-
* setting members of [[MarkupApp.props]]. When [[MarkupApp.start]] is first called, it registers a set of "Markup.xxx"
|
|
35
|
-
* tools that may be invoked from UI controls.
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
export declare class MarkupApp {
|
|
39
|
-
/** the current Markup being created */
|
|
40
|
-
static markup?: Markup;
|
|
41
|
-
/** The namespace for the Markup tools */
|
|
42
|
-
static namespace?: string;
|
|
43
|
-
/** By setting members of this object, applications can control the appearance and behavior of various parts of MarkupApp. */
|
|
44
|
-
static props: {
|
|
45
|
-
/** the UI controls displayed on Elements by the Select Tool to allow users to modify them. */
|
|
46
|
-
handles: {
|
|
47
|
-
/** The diameter of the circles for the handles. */
|
|
48
|
-
size: number;
|
|
49
|
-
/** The attributes of the stretch handles */
|
|
50
|
-
stretch: {
|
|
51
|
-
"fill-opacity": number;
|
|
52
|
-
stroke: string;
|
|
53
|
-
fill: string;
|
|
54
|
-
};
|
|
55
|
-
/** The attributes of the line that connects the top-center stretch handle to the rotate handle. */
|
|
56
|
-
rotateLine: {
|
|
57
|
-
stroke: string;
|
|
58
|
-
"fill-opacity": number;
|
|
59
|
-
};
|
|
60
|
-
/** The attributes of the rotate handle. */
|
|
61
|
-
rotate: {
|
|
62
|
-
cursor: string;
|
|
63
|
-
"fill-opacity": number;
|
|
64
|
-
stroke: string;
|
|
65
|
-
fill: string;
|
|
66
|
-
};
|
|
67
|
-
/** The attributes of box around the element. */
|
|
68
|
-
moveOutline: {
|
|
69
|
-
cursor: string;
|
|
70
|
-
"stroke-dasharray": string;
|
|
71
|
-
fill: string;
|
|
72
|
-
"stroke-opacity": number;
|
|
73
|
-
stroke: string;
|
|
74
|
-
};
|
|
75
|
-
/** The attributes of box that provides the move cursor. */
|
|
76
|
-
move: {
|
|
77
|
-
cursor: string;
|
|
78
|
-
opacity: number;
|
|
79
|
-
"stroke-width": number;
|
|
80
|
-
stroke: string;
|
|
81
|
-
};
|
|
82
|
-
/** The attributes of handles on the vertices of lines. */
|
|
83
|
-
vertex: {
|
|
84
|
-
cursor: string;
|
|
85
|
-
"fill-opacity": number;
|
|
86
|
-
stroke: string;
|
|
87
|
-
fill: string;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
/** properties for providing feedback about selected elements. */
|
|
91
|
-
hilite: {
|
|
92
|
-
/** the color of selected elements */
|
|
93
|
-
color: string;
|
|
94
|
-
/** the color of an element as the cursor passes over it */
|
|
95
|
-
flash: string;
|
|
96
|
-
};
|
|
97
|
-
/** optionally, show a drop-shadow behind all markup elements. */
|
|
98
|
-
dropShadow: {
|
|
99
|
-
/** if false, no drop shadow */
|
|
100
|
-
enable: boolean;
|
|
101
|
-
/** the attributes of the drop shadow. See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow */
|
|
102
|
-
attr: {
|
|
103
|
-
stdDeviation: number;
|
|
104
|
-
dx: number;
|
|
105
|
-
dy: number;
|
|
106
|
-
"flood-color": string;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
/** The "active placement" parameters. New elements are created with these parameters, so UI controls should set them. */
|
|
110
|
-
active: {
|
|
111
|
-
/** the CSS style properties of new text elements. */
|
|
112
|
-
text: {
|
|
113
|
-
"font-family": string;
|
|
114
|
-
"font-size": string;
|
|
115
|
-
stroke: string;
|
|
116
|
-
fill: string;
|
|
117
|
-
};
|
|
118
|
-
/** the CSS style properties of new elements. */
|
|
119
|
-
element: {
|
|
120
|
-
stroke: string;
|
|
121
|
-
"stroke-opacity": number;
|
|
122
|
-
"stroke-width": number;
|
|
123
|
-
"stroke-dasharray": number;
|
|
124
|
-
"stroke-linecap": string;
|
|
125
|
-
"stroke-linejoin": string;
|
|
126
|
-
fill: string;
|
|
127
|
-
"fill-opacity": number;
|
|
128
|
-
};
|
|
129
|
-
arrow: {
|
|
130
|
-
length: number;
|
|
131
|
-
width: number;
|
|
132
|
-
};
|
|
133
|
-
cloud: {
|
|
134
|
-
path: string;
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
/** Values for placing and editing Text. */
|
|
138
|
-
text: {
|
|
139
|
-
/** A default string for the Markup.Text.Place command. Applications can turn this off, or supply the user's initials, for example. */
|
|
140
|
-
startValue: string;
|
|
141
|
-
/** Parameters for the size and appearance of the text editor */
|
|
142
|
-
edit: {
|
|
143
|
-
background: string;
|
|
144
|
-
/** Starting size, will be updated if user stretches the box */
|
|
145
|
-
size: {
|
|
146
|
-
width: string;
|
|
147
|
-
height: string;
|
|
148
|
-
};
|
|
149
|
-
/** font size of the text editor */
|
|
150
|
-
fontSize: string;
|
|
151
|
-
/** A background box drawn around text so user can tell what's being selected */
|
|
152
|
-
textBox: {
|
|
153
|
-
fill: string;
|
|
154
|
-
"fill-opacity": number;
|
|
155
|
-
"stroke-opacity": number;
|
|
156
|
-
stroke: string;
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
/** Used to draw the border outline around the view while it is being marked up so the user can tell Markup is active */
|
|
161
|
-
borderOutline: {
|
|
162
|
-
stroke: string;
|
|
163
|
-
"stroke-width": number;
|
|
164
|
-
"stroke-opacity": number;
|
|
165
|
-
fill: string;
|
|
166
|
-
};
|
|
167
|
-
/** Used to draw the border corner symbols for the view while it is being marked up so the user can tell Markup is active */
|
|
168
|
-
borderCorners: {
|
|
169
|
-
stroke: string;
|
|
170
|
-
"stroke-width": number;
|
|
171
|
-
"stroke-opacity": number;
|
|
172
|
-
fill: string;
|
|
173
|
-
"fill-opacity": number;
|
|
174
|
-
};
|
|
175
|
-
/** Determines what is returned by MarkupApp.stop */
|
|
176
|
-
result: {
|
|
177
|
-
/** The format for the image data. */
|
|
178
|
-
imageFormat: string;
|
|
179
|
-
/** If true, the markup graphics will be imprinted in the returned image. */
|
|
180
|
-
imprintSvgOnImage: boolean;
|
|
181
|
-
/** the maximum width for the returned image. If the source view width is larger than this, it will be scaled down to this size. */
|
|
182
|
-
maxWidth: number;
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
private static _saveDefaultToolId;
|
|
186
|
-
/** @internal */
|
|
187
|
-
static screenToVbMtx(): Matrix;
|
|
188
|
-
/** @internal */
|
|
189
|
-
static getVpToScreenMtx(): Matrix;
|
|
190
|
-
/** @internal */
|
|
191
|
-
static getVpToVbMtx(): Matrix;
|
|
192
|
-
/** @internal */
|
|
193
|
-
static convertVpToVb(pt: XAndY): Point3d;
|
|
194
|
-
/** determine whether there's a markup session currently active */
|
|
195
|
-
static get isActive(): boolean;
|
|
196
|
-
static markupSelectToolId: string;
|
|
197
|
-
protected static createMarkup(view: ScreenViewport, markupData?: MarkupSvgData): Markup;
|
|
198
|
-
protected static lockViewportSize(view: ScreenViewport, markupData?: MarkupSvgData): void;
|
|
199
|
-
/** @internal */
|
|
200
|
-
static getActionName(action: string): string;
|
|
201
|
-
/** Start a markup session */
|
|
202
|
-
static start(view: ScreenViewport, markupData?: MarkupSvgData): Promise<void>;
|
|
203
|
-
/** Read the result of a Markup session, then stop the session.
|
|
204
|
-
* @note see [MarkupApp.props.result] for options.
|
|
205
|
-
*/
|
|
206
|
-
static stop(): Promise<MarkupData>;
|
|
207
|
-
/** Call this method to initialize the Markup system.
|
|
208
|
-
* It asynchronously loads the MarkupTools namespace for the prompts and tool names for the Markup system, and
|
|
209
|
-
* also registers all of the Markup tools.
|
|
210
|
-
* @return a Promise that may be awaited to ensure that the MarkupTools namespace had been loaded.
|
|
211
|
-
* @note This method is automatically called every time you call [[start]]. Since the Markup tools cannot
|
|
212
|
-
* start unless there is a Markup active, there's really no need to call this method directly.
|
|
213
|
-
* The only virtue in doing so is to pre-load the Markup namespace if you have an opportunity to do so earlier in your
|
|
214
|
-
* startup code.
|
|
215
|
-
* @note This method may be called multiple times, but only the first time initiates the loading/registering. Subsequent
|
|
216
|
-
* calls return the same Promise.
|
|
217
|
-
*/
|
|
218
|
-
static initialize(): Promise<void>;
|
|
219
|
-
/** convert the current markup SVG into a string, but don't include decorations or dynamics
|
|
220
|
-
* @internal
|
|
221
|
-
*/
|
|
222
|
-
protected static readMarkupSvg(): string | undefined;
|
|
223
|
-
/** convert the current markup SVG into a string (after calling readMarkupSvg) making sure width and height are specified.
|
|
224
|
-
* @internal
|
|
225
|
-
*/
|
|
226
|
-
protected static readMarkupSvgForDrawImage(): string | undefined;
|
|
227
|
-
/** @internal */
|
|
228
|
-
protected static readMarkup(): Promise<MarkupData>;
|
|
229
|
-
/** @internal */
|
|
230
|
-
static markupPrefix: string;
|
|
231
|
-
/** @internal */
|
|
232
|
-
static get dropShadowId(): string;
|
|
233
|
-
/** @internal */
|
|
234
|
-
static get cornerId(): string;
|
|
235
|
-
/** @internal */
|
|
236
|
-
static get containerClass(): string;
|
|
237
|
-
/** @internal */
|
|
238
|
-
static get dynamicsClass(): string;
|
|
239
|
-
/** @internal */
|
|
240
|
-
static get decorationsClass(): string;
|
|
241
|
-
/** @internal */
|
|
242
|
-
static get markupSvgClass(): string;
|
|
243
|
-
/** @internal */
|
|
244
|
-
static get boxedTextClass(): string;
|
|
245
|
-
/** @internal */
|
|
246
|
-
static get textClass(): string;
|
|
247
|
-
/** @internal */
|
|
248
|
-
static get stretchHandleClass(): string;
|
|
249
|
-
/** @internal */
|
|
250
|
-
static get rotateLineClass(): string;
|
|
251
|
-
/** @internal */
|
|
252
|
-
static get rotateHandleClass(): string;
|
|
253
|
-
/** @internal */
|
|
254
|
-
static get vertexHandleClass(): string;
|
|
255
|
-
/** @internal */
|
|
256
|
-
static get moveHandleClass(): string;
|
|
257
|
-
/** @internal */
|
|
258
|
-
static get textOutlineClass(): string;
|
|
259
|
-
/** @internal */
|
|
260
|
-
static get textEditorClass(): string;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* The current markup being created/edited. Holds the SVG elements, plus the active [[MarkupTool]].
|
|
264
|
-
* When starting a Markup, a new Div is added as a child of the ScreenViewport's vpDiv.
|
|
265
|
-
* @public
|
|
266
|
-
*/
|
|
267
|
-
export declare class Markup {
|
|
268
|
-
vp: ScreenViewport;
|
|
269
|
-
/** @internal */
|
|
270
|
-
readonly markupDiv: HTMLDivElement;
|
|
271
|
-
/**
|
|
272
|
-
readonly undo: UndoManager;
|
|
273
|
-
/**
|
|
274
|
-
readonly selected: MarkupSelected;
|
|
275
|
-
/** @internal */
|
|
276
|
-
readonly svgContainer?: Svg;
|
|
277
|
-
/** @internal */
|
|
278
|
-
readonly svgMarkup?: G;
|
|
279
|
-
/** @internal */
|
|
280
|
-
readonly svgDynamics?: G;
|
|
281
|
-
/** @internal */
|
|
282
|
-
readonly svgDecorations?: G;
|
|
283
|
-
/** create the drop-shadow filter in the Defs section of the supplied svg element */
|
|
284
|
-
private createDropShadow;
|
|
285
|
-
private addNested;
|
|
286
|
-
private addBorder;
|
|
287
|
-
/** Create a new Markup for the supplied ScreenViewport. Adds a new "overlay-markup" div into the "vpDiv"
|
|
288
|
-
* of the viewport.
|
|
289
|
-
* @note you must call destroy on this object at end of markup to remove the markup div.
|
|
290
|
-
*/
|
|
291
|
-
constructor(vp: ScreenViewport, markupData?: MarkupSvgData);
|
|
292
|
-
/** Called when the Markup is destroyed */
|
|
293
|
-
destroy(): void;
|
|
294
|
-
/** Turn on picking the markup elements in the markup view */
|
|
295
|
-
enablePick(): void;
|
|
296
|
-
/** Turn off picking the markup elements in the markup view */
|
|
297
|
-
disablePick(): void;
|
|
298
|
-
/** Change the default cursor for the markup view */
|
|
299
|
-
setCursor(cursor: string): void;
|
|
300
|
-
/** Delete all the entries in the selection set, then empty it. */
|
|
301
|
-
deleteSelected(): void;
|
|
302
|
-
/** Bring all the entries in the selection set to the front. */
|
|
303
|
-
bringToFront(): void;
|
|
304
|
-
/** Send all the entries in the selection set to the back. */
|
|
305
|
-
sendToBack(): void;
|
|
306
|
-
/** Group all the entries in the selection set, then select the group. */
|
|
307
|
-
groupSelected(): void;
|
|
308
|
-
/** Ungroup all the group entries in the selection set. */
|
|
309
|
-
ungroupSelected(): void;
|
|
310
|
-
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module MarkupApp
|
|
3
|
+
*/
|
|
4
|
+
import { Point3d, XAndY } from "@itwin/core-geometry";
|
|
5
|
+
import { ScreenViewport } from "@itwin/core-frontend";
|
|
6
|
+
import { G, Marker, Element as MarkupElement, Matrix, Svg } from "@svgdotjs/svg.js";
|
|
7
|
+
import { MarkupSelected } from "./SelectTool";
|
|
8
|
+
import { UndoManager } from "./Undo";
|
|
9
|
+
/** The width and height of a Markup image, in pixels.
|
|
10
|
+
* @public */
|
|
11
|
+
export interface WidthAndHeight {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
/** The size and SVG string for a Markup
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export interface MarkupSvgData {
|
|
19
|
+
/** The size of the image, in pixels. This also indicates the aspect ratio of the SVG data. */
|
|
20
|
+
rect: WidthAndHeight;
|
|
21
|
+
/** a string holding the svg data for the markup. Will be undefined if [[MarkupApp.stop]] is called without an active Markup */
|
|
22
|
+
svg?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Markup data returned by [[MarkupApp.stop]]
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export interface MarkupData extends MarkupSvgData {
|
|
28
|
+
/** a base64 encoded string with the image of the view that was marked up. See [[MarkupApp.props.result]] for options. */
|
|
29
|
+
image?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The main object for the Markup package. It is a singleton that stores the state of the Markup application.
|
|
33
|
+
* It has only static members and methods. Applications may customize and control the behavior of the Markup by
|
|
34
|
+
* setting members of [[MarkupApp.props]]. When [[MarkupApp.start]] is first called, it registers a set of "Markup.xxx"
|
|
35
|
+
* tools that may be invoked from UI controls.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export declare class MarkupApp {
|
|
39
|
+
/** the current Markup being created */
|
|
40
|
+
static markup?: Markup;
|
|
41
|
+
/** The namespace for the Markup tools */
|
|
42
|
+
static namespace?: string;
|
|
43
|
+
/** By setting members of this object, applications can control the appearance and behavior of various parts of MarkupApp. */
|
|
44
|
+
static props: {
|
|
45
|
+
/** the UI controls displayed on Elements by the Select Tool to allow users to modify them. */
|
|
46
|
+
handles: {
|
|
47
|
+
/** The diameter of the circles for the handles. */
|
|
48
|
+
size: number;
|
|
49
|
+
/** The attributes of the stretch handles */
|
|
50
|
+
stretch: {
|
|
51
|
+
"fill-opacity": number;
|
|
52
|
+
stroke: string;
|
|
53
|
+
fill: string;
|
|
54
|
+
};
|
|
55
|
+
/** The attributes of the line that connects the top-center stretch handle to the rotate handle. */
|
|
56
|
+
rotateLine: {
|
|
57
|
+
stroke: string;
|
|
58
|
+
"fill-opacity": number;
|
|
59
|
+
};
|
|
60
|
+
/** The attributes of the rotate handle. */
|
|
61
|
+
rotate: {
|
|
62
|
+
cursor: string;
|
|
63
|
+
"fill-opacity": number;
|
|
64
|
+
stroke: string;
|
|
65
|
+
fill: string;
|
|
66
|
+
};
|
|
67
|
+
/** The attributes of box around the element. */
|
|
68
|
+
moveOutline: {
|
|
69
|
+
cursor: string;
|
|
70
|
+
"stroke-dasharray": string;
|
|
71
|
+
fill: string;
|
|
72
|
+
"stroke-opacity": number;
|
|
73
|
+
stroke: string;
|
|
74
|
+
};
|
|
75
|
+
/** The attributes of box that provides the move cursor. */
|
|
76
|
+
move: {
|
|
77
|
+
cursor: string;
|
|
78
|
+
opacity: number;
|
|
79
|
+
"stroke-width": number;
|
|
80
|
+
stroke: string;
|
|
81
|
+
};
|
|
82
|
+
/** The attributes of handles on the vertices of lines. */
|
|
83
|
+
vertex: {
|
|
84
|
+
cursor: string;
|
|
85
|
+
"fill-opacity": number;
|
|
86
|
+
stroke: string;
|
|
87
|
+
fill: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/** properties for providing feedback about selected elements. */
|
|
91
|
+
hilite: {
|
|
92
|
+
/** the color of selected elements */
|
|
93
|
+
color: string;
|
|
94
|
+
/** the color of an element as the cursor passes over it */
|
|
95
|
+
flash: string;
|
|
96
|
+
};
|
|
97
|
+
/** optionally, show a drop-shadow behind all markup elements. */
|
|
98
|
+
dropShadow: {
|
|
99
|
+
/** if false, no drop shadow */
|
|
100
|
+
enable: boolean;
|
|
101
|
+
/** the attributes of the drop shadow. See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow */
|
|
102
|
+
attr: {
|
|
103
|
+
stdDeviation: number;
|
|
104
|
+
dx: number;
|
|
105
|
+
dy: number;
|
|
106
|
+
"flood-color": string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
/** The "active placement" parameters. New elements are created with these parameters, so UI controls should set them. */
|
|
110
|
+
active: {
|
|
111
|
+
/** the CSS style properties of new text elements. */
|
|
112
|
+
text: {
|
|
113
|
+
"font-family": string;
|
|
114
|
+
"font-size": string;
|
|
115
|
+
stroke: string;
|
|
116
|
+
fill: string;
|
|
117
|
+
};
|
|
118
|
+
/** the CSS style properties of new elements. */
|
|
119
|
+
element: {
|
|
120
|
+
stroke: string;
|
|
121
|
+
"stroke-opacity": number;
|
|
122
|
+
"stroke-width": number;
|
|
123
|
+
"stroke-dasharray": number;
|
|
124
|
+
"stroke-linecap": string;
|
|
125
|
+
"stroke-linejoin": string;
|
|
126
|
+
fill: string;
|
|
127
|
+
"fill-opacity": number;
|
|
128
|
+
};
|
|
129
|
+
arrow: {
|
|
130
|
+
length: number;
|
|
131
|
+
width: number;
|
|
132
|
+
};
|
|
133
|
+
cloud: {
|
|
134
|
+
path: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
/** Values for placing and editing Text. */
|
|
138
|
+
text: {
|
|
139
|
+
/** A default string for the Markup.Text.Place command. Applications can turn this off, or supply the user's initials, for example. */
|
|
140
|
+
startValue: string;
|
|
141
|
+
/** Parameters for the size and appearance of the text editor */
|
|
142
|
+
edit: {
|
|
143
|
+
background: string;
|
|
144
|
+
/** Starting size, will be updated if user stretches the box */
|
|
145
|
+
size: {
|
|
146
|
+
width: string;
|
|
147
|
+
height: string;
|
|
148
|
+
};
|
|
149
|
+
/** font size of the text editor */
|
|
150
|
+
fontSize: string;
|
|
151
|
+
/** A background box drawn around text so user can tell what's being selected */
|
|
152
|
+
textBox: {
|
|
153
|
+
fill: string;
|
|
154
|
+
"fill-opacity": number;
|
|
155
|
+
"stroke-opacity": number;
|
|
156
|
+
stroke: string;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
/** Used to draw the border outline around the view while it is being marked up so the user can tell Markup is active */
|
|
161
|
+
borderOutline: {
|
|
162
|
+
stroke: string;
|
|
163
|
+
"stroke-width": number;
|
|
164
|
+
"stroke-opacity": number;
|
|
165
|
+
fill: string;
|
|
166
|
+
};
|
|
167
|
+
/** Used to draw the border corner symbols for the view while it is being marked up so the user can tell Markup is active */
|
|
168
|
+
borderCorners: {
|
|
169
|
+
stroke: string;
|
|
170
|
+
"stroke-width": number;
|
|
171
|
+
"stroke-opacity": number;
|
|
172
|
+
fill: string;
|
|
173
|
+
"fill-opacity": number;
|
|
174
|
+
};
|
|
175
|
+
/** Determines what is returned by MarkupApp.stop */
|
|
176
|
+
result: {
|
|
177
|
+
/** The format for the image data. */
|
|
178
|
+
imageFormat: string;
|
|
179
|
+
/** If true, the markup graphics will be imprinted in the returned image. */
|
|
180
|
+
imprintSvgOnImage: boolean;
|
|
181
|
+
/** the maximum width for the returned image. If the source view width is larger than this, it will be scaled down to this size. */
|
|
182
|
+
maxWidth: number;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
private static _saveDefaultToolId;
|
|
186
|
+
/** @internal */
|
|
187
|
+
static screenToVbMtx(): Matrix;
|
|
188
|
+
/** @internal */
|
|
189
|
+
static getVpToScreenMtx(): Matrix;
|
|
190
|
+
/** @internal */
|
|
191
|
+
static getVpToVbMtx(): Matrix;
|
|
192
|
+
/** @internal */
|
|
193
|
+
static convertVpToVb(pt: XAndY): Point3d;
|
|
194
|
+
/** determine whether there's a markup session currently active */
|
|
195
|
+
static get isActive(): boolean;
|
|
196
|
+
static markupSelectToolId: string;
|
|
197
|
+
protected static createMarkup(view: ScreenViewport, markupData?: MarkupSvgData): Markup;
|
|
198
|
+
protected static lockViewportSize(view: ScreenViewport, markupData?: MarkupSvgData): void;
|
|
199
|
+
/** @internal */
|
|
200
|
+
static getActionName(action: string): string;
|
|
201
|
+
/** Start a markup session */
|
|
202
|
+
static start(view: ScreenViewport, markupData?: MarkupSvgData): Promise<void>;
|
|
203
|
+
/** Read the result of a Markup session, then stop the session.
|
|
204
|
+
* @note see [MarkupApp.props.result] for options.
|
|
205
|
+
*/
|
|
206
|
+
static stop(): Promise<MarkupData>;
|
|
207
|
+
/** Call this method to initialize the Markup system.
|
|
208
|
+
* It asynchronously loads the MarkupTools namespace for the prompts and tool names for the Markup system, and
|
|
209
|
+
* also registers all of the Markup tools.
|
|
210
|
+
* @return a Promise that may be awaited to ensure that the MarkupTools namespace had been loaded.
|
|
211
|
+
* @note This method is automatically called every time you call [[start]]. Since the Markup tools cannot
|
|
212
|
+
* start unless there is a Markup active, there's really no need to call this method directly.
|
|
213
|
+
* The only virtue in doing so is to pre-load the Markup namespace if you have an opportunity to do so earlier in your
|
|
214
|
+
* startup code.
|
|
215
|
+
* @note This method may be called multiple times, but only the first time initiates the loading/registering. Subsequent
|
|
216
|
+
* calls return the same Promise.
|
|
217
|
+
*/
|
|
218
|
+
static initialize(): Promise<void>;
|
|
219
|
+
/** convert the current markup SVG into a string, but don't include decorations or dynamics
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
222
|
+
protected static readMarkupSvg(): string | undefined;
|
|
223
|
+
/** convert the current markup SVG into a string (after calling readMarkupSvg) making sure width and height are specified.
|
|
224
|
+
* @internal
|
|
225
|
+
*/
|
|
226
|
+
protected static readMarkupSvgForDrawImage(): string | undefined;
|
|
227
|
+
/** @internal */
|
|
228
|
+
protected static readMarkup(): Promise<MarkupData>;
|
|
229
|
+
/** @internal */
|
|
230
|
+
static markupPrefix: string;
|
|
231
|
+
/** @internal */
|
|
232
|
+
static get dropShadowId(): string;
|
|
233
|
+
/** @internal */
|
|
234
|
+
static get cornerId(): string;
|
|
235
|
+
/** @internal */
|
|
236
|
+
static get containerClass(): string;
|
|
237
|
+
/** @internal */
|
|
238
|
+
static get dynamicsClass(): string;
|
|
239
|
+
/** @internal */
|
|
240
|
+
static get decorationsClass(): string;
|
|
241
|
+
/** @internal */
|
|
242
|
+
static get markupSvgClass(): string;
|
|
243
|
+
/** @internal */
|
|
244
|
+
static get boxedTextClass(): string;
|
|
245
|
+
/** @internal */
|
|
246
|
+
static get textClass(): string;
|
|
247
|
+
/** @internal */
|
|
248
|
+
static get stretchHandleClass(): string;
|
|
249
|
+
/** @internal */
|
|
250
|
+
static get rotateLineClass(): string;
|
|
251
|
+
/** @internal */
|
|
252
|
+
static get rotateHandleClass(): string;
|
|
253
|
+
/** @internal */
|
|
254
|
+
static get vertexHandleClass(): string;
|
|
255
|
+
/** @internal */
|
|
256
|
+
static get moveHandleClass(): string;
|
|
257
|
+
/** @internal */
|
|
258
|
+
static get textOutlineClass(): string;
|
|
259
|
+
/** @internal */
|
|
260
|
+
static get textEditorClass(): string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The current markup being created/edited. Holds the SVG elements, plus the active [[MarkupTool]].
|
|
264
|
+
* When starting a Markup, a new Div is added as a child of the ScreenViewport's vpDiv.
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
267
|
+
export declare class Markup {
|
|
268
|
+
vp: ScreenViewport;
|
|
269
|
+
/** @internal */
|
|
270
|
+
readonly markupDiv: HTMLDivElement;
|
|
271
|
+
/** Support undo/redo of markup operations */
|
|
272
|
+
readonly undo: UndoManager;
|
|
273
|
+
/** The set of currently selected markup elements */
|
|
274
|
+
readonly selected: MarkupSelected;
|
|
275
|
+
/** @internal */
|
|
276
|
+
readonly svgContainer?: Svg;
|
|
277
|
+
/** @internal */
|
|
278
|
+
readonly svgMarkup?: G;
|
|
279
|
+
/** @internal */
|
|
280
|
+
readonly svgDynamics?: G;
|
|
281
|
+
/** @internal */
|
|
282
|
+
readonly svgDecorations?: G;
|
|
283
|
+
/** create the drop-shadow filter in the Defs section of the supplied svg element */
|
|
284
|
+
private createDropShadow;
|
|
285
|
+
private addNested;
|
|
286
|
+
private addBorder;
|
|
287
|
+
/** Create a new Markup for the supplied ScreenViewport. Adds a new "overlay-markup" div into the "vpDiv"
|
|
288
|
+
* of the viewport.
|
|
289
|
+
* @note you must call destroy on this object at end of markup to remove the markup div.
|
|
290
|
+
*/
|
|
291
|
+
constructor(vp: ScreenViewport, markupData?: MarkupSvgData);
|
|
292
|
+
/** Called when the Markup is destroyed */
|
|
293
|
+
destroy(): void;
|
|
294
|
+
/** Turn on picking the markup elements in the markup view */
|
|
295
|
+
enablePick(): void;
|
|
296
|
+
/** Turn off picking the markup elements in the markup view */
|
|
297
|
+
disablePick(): void;
|
|
298
|
+
/** Change the default cursor for the markup view */
|
|
299
|
+
setCursor(cursor: string): void;
|
|
300
|
+
/** Delete all the entries in the selection set, then empty it. */
|
|
301
|
+
deleteSelected(): void;
|
|
302
|
+
/** Bring all the entries in the selection set to the front. */
|
|
303
|
+
bringToFront(): void;
|
|
304
|
+
/** Send all the entries in the selection set to the back. */
|
|
305
|
+
sendToBack(): void;
|
|
306
|
+
/** Group all the entries in the selection set, then select the group. */
|
|
307
|
+
groupSelected(): void;
|
|
308
|
+
/** Ungroup all the group entries in the selection set. */
|
|
309
|
+
ungroupSelected(): void;
|
|
310
|
+
/** Check if the supplied MarkupElement is a group of MarkupText and the MarkupText's outline Rect.
|
|
311
|
+
* @param el the markup element to check
|
|
312
|
+
* @returns true if boxed text
|
|
313
|
+
*/
|
|
314
|
+
isBoxedText(el: MarkupElement): boolean;
|
|
315
|
+
/** Get an existing or create a new reusable symbol representing an arrow head.
|
|
316
|
+
* If a Marker for the supplied color and size already exists it is returned, otherwise a new Marker is created.
|
|
317
|
+
* @param color the arrow head color
|
|
318
|
+
* @param length the arrow head length
|
|
319
|
+
* @param width the arrow head width
|
|
320
|
+
* @note Flashing doesn't currently affect markers, need support for "context-stroke" and "context-fill". For now encode color in name...
|
|
321
|
+
*/
|
|
322
|
+
createArrowMarker(color: string, length: number, width: number): Marker;
|
|
323
|
+
}
|
|
311
324
|
//# sourceMappingURL=Markup.d.ts.map
|
package/lib/esm/Markup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markup.d.ts","sourceRoot":"","sources":["../../src/Markup.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAkE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAiB,CAAC,EAAE,MAAM,EAAS,GAAG,EAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Markup.d.ts","sourceRoot":"","sources":["../../src/Markup.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAkE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAiB,CAAC,EAAE,MAAM,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,EAAS,GAAG,EAAO,MAAM,kBAAkB,CAAC;AAE/G,OAAO,EAAE,cAAc,EAAc,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAIrC;aACa;AACb,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8FAA8F;IAC9F,IAAI,EAA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