@itwin/core-markup 5.0.0-dev.8 → 5.0.0-dev.83

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 CHANGED
@@ -1,6 +1,51 @@
1
1
  # Change Log - @itwin/core-markup
2
2
 
3
- This log was last generated on Thu, 14 Nov 2024 18:13:56 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 11 Mar 2025 15:27:53 GMT and should not be manually modified.
4
+
5
+ ## 4.10.10
6
+ Tue, 11 Mar 2025 15:25:11 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 4.10.9
11
+ Tue, 11 Mar 2025 05:17:33 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 4.10.8
16
+ Thu, 06 Mar 2025 14:13:37 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 4.10.7
21
+ Tue, 18 Feb 2025 17:27:03 GMT
22
+
23
+ _Version update only_
24
+
25
+ ## 4.10.6
26
+ Fri, 24 Jan 2025 08:02:40 GMT
27
+
28
+ _Version update only_
29
+
30
+ ## 4.10.5
31
+ Tue, 21 Jan 2025 21:56:45 GMT
32
+
33
+ _Version update only_
34
+
35
+ ## 4.10.4
36
+ Mon, 13 Jan 2025 14:06:43 GMT
37
+
38
+ _Version update only_
39
+
40
+ ## 4.10.3
41
+ Mon, 06 Jan 2025 14:00:13 GMT
42
+
43
+ _Version update only_
44
+
45
+ ## 4.10.2
46
+ Thu, 21 Nov 2024 15:22:20 GMT
47
+
48
+ _Version update only_
4
49
 
5
50
  ## 4.10.1
6
51
  Thu, 14 Nov 2024 18:11:00 GMT
package/lib/cjs/Markup.js CHANGED
@@ -25,6 +25,117 @@ const Undo_1 = require("./Undo");
25
25
  * @public
26
26
  */
27
27
  class MarkupApp {
28
+ /** the current Markup being created */
29
+ static markup;
30
+ /** The namespace for the Markup tools */
31
+ static namespace;
32
+ /** By setting members of this object, applications can control the appearance and behavior of various parts of MarkupApp. */
33
+ static props = {
34
+ /** the UI controls displayed on Elements by the Select Tool to allow users to modify them. */
35
+ handles: {
36
+ /** The diameter of the circles for the handles. */
37
+ size: 10,
38
+ /** The attributes of the stretch handles */
39
+ stretch: { "fill-opacity": .85, "stroke": "black", "fill": "white" },
40
+ /** The attributes of the line that connects the top-center stretch handle to the rotate handle. */
41
+ rotateLine: { "stroke": "grey", "fill-opacity": .85 },
42
+ /** The attributes of the rotate handle. */
43
+ rotate: { "cursor": `url(${core_frontend_1.IModelApp.publicPath}Markup/rotate.png) 12 12, auto`, "fill-opacity": .85, "stroke": "black", "fill": "lightBlue" },
44
+ /** The attributes of box around the element. */
45
+ moveOutline: { "cursor": "move", "stroke-dasharray": "6,6", "fill": "none", "stroke-opacity": .85, "stroke": "white" },
46
+ /** The attributes of box that provides the move cursor. */
47
+ move: { "cursor": "move", "opacity": 0, "stroke-width": 10, "stroke": "white" },
48
+ /** The attributes of handles on the vertices of lines. */
49
+ vertex: { "cursor": `url(${core_frontend_1.IModelApp.publicPath}cursors/crosshair.cur), crosshair`, "fill-opacity": .85, "stroke": "black", "fill": "white" },
50
+ },
51
+ /** properties for providing feedback about selected elements. */
52
+ hilite: {
53
+ /** the color of selected elements */
54
+ color: "magenta",
55
+ /** the color of an element as the cursor passes over it */
56
+ flash: "cyan",
57
+ },
58
+ /** optionally, show a drop-shadow behind all markup elements. */
59
+ dropShadow: {
60
+ /** if false, no drop shadow */
61
+ enable: true,
62
+ /** the attributes of the drop shadow. See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow */
63
+ attr: {
64
+ "stdDeviation": 2,
65
+ "dx": 1.2,
66
+ "dy": 1.4,
67
+ "flood-color": "#1B3838",
68
+ },
69
+ },
70
+ /** The "active placement" parameters. New elements are created with these parameters, so UI controls should set them. */
71
+ active: {
72
+ /** the CSS style properties of new text elements. */
73
+ text: {
74
+ "font-family": "sans-serif",
75
+ "font-size": "30px",
76
+ "stroke": "none",
77
+ "fill": "red",
78
+ },
79
+ /** the CSS style properties of new elements. */
80
+ element: {
81
+ "stroke": "red",
82
+ "stroke-opacity": 0.8,
83
+ "stroke-width": 3,
84
+ "stroke-dasharray": 0,
85
+ "stroke-linecap": "round",
86
+ "stroke-linejoin": "round",
87
+ "fill": "blue",
88
+ "fill-opacity": 0.2,
89
+ },
90
+ arrow: {
91
+ length: 7,
92
+ width: 6,
93
+ },
94
+ cloud: {
95
+ path: "M3.0,2.5 C3.9,.78 5.6,-.4 8.1,1.0 C9.1,0 11.3,-.2 12.5,.5 C14.2,-.5 17,.16 17.9,2.5 C21,3 20.2,7.3 17.6,7.5 C16.5,9.2 14.4,9.8 12.7,8.9 C11.6,10 9.5,10.3 8.1,9.4 C5.7,10.8 3.3,9.4 2.6,7.5 C-.9,7.7 .6,1.7 3.0,2.5z",
96
+ },
97
+ },
98
+ /** Values for placing and editing Text. */
99
+ text: {
100
+ /** A default string for the Markup.Text.Place command. Applications can turn this off, or supply the user's initials, for example. */
101
+ startValue: "Note: ",
102
+ /** Parameters for the size and appearance of the text editor */
103
+ edit: {
104
+ background: "blanchedalmond",
105
+ /** Starting size, will be updated if user stretches the box */
106
+ size: { width: "25%", height: "4em" },
107
+ /** font size of the text editor */
108
+ fontSize: "14pt",
109
+ /** A background box drawn around text so user can tell what's being selected */
110
+ textBox: { "fill": "lightGrey", "fill-opacity": .1, "stroke-opacity": .85, "stroke": "lightBlue" },
111
+ },
112
+ },
113
+ /** Used to draw the border outline around the view while it is being marked up so the user can tell Markup is active */
114
+ borderOutline: {
115
+ "stroke": "gold",
116
+ "stroke-width": 6,
117
+ "stroke-opacity": 0.4,
118
+ "fill": "none",
119
+ },
120
+ /** Used to draw the border corner symbols for the view while it is being marked up so the user can tell Markup is active */
121
+ borderCorners: {
122
+ "stroke": "black",
123
+ "stroke-width": 2,
124
+ "stroke-opacity": 0.2,
125
+ "fill": "gold",
126
+ "fill-opacity": 0.2,
127
+ },
128
+ /** Determines what is returned by MarkupApp.stop */
129
+ result: {
130
+ /** The format for the image data. */
131
+ imageFormat: "image/png",
132
+ /** If true, the markup graphics will be imprinted in the returned image. */
133
+ imprintSvgOnImage: true,
134
+ /** the maximum width for the returned image. If the source view width is larger than this, it will be scaled down to this size. */
135
+ maxWidth: 2048,
136
+ },
137
+ };
138
+ static _saveDefaultToolId = "";
28
139
  /** @internal */
29
140
  static screenToVbMtx() {
30
141
  const matrix = this.markup?.svgMarkup?.screenCTM().inverse();
@@ -45,6 +156,7 @@ class MarkupApp {
45
156
  }
46
157
  /** determine whether there's a markup session currently active */
47
158
  static get isActive() { return undefined !== this.markup; }
159
+ static markupSelectToolId = "Markup.Select";
48
160
  static createMarkup(view, markupData) { return new Markup(view, markupData); }
49
161
  static lockViewportSize(view, markupData) {
50
162
  const parentDiv = view.vpDiv;
@@ -152,7 +264,7 @@ class MarkupApp {
152
264
  /** @internal */
153
265
  static async readMarkup() {
154
266
  const result = this.props.result;
155
- let canvas = this.markup.vp.readImageToCanvas();
267
+ let canvas = this.markup.vp.readImageToCanvas({ omitCanvasDecorations: false });
156
268
  let svg, image;
157
269
  try {
158
270
  svg = this.readMarkupSvg(); // read the current svg data for the markup
@@ -179,6 +291,8 @@ class MarkupApp {
179
291
  return { rect: { width: canvas.width, height: canvas.height }, svg, image };
180
292
  }
181
293
  /** @internal */
294
+ static markupPrefix = "markup-";
295
+ /** @internal */
182
296
  static get dropShadowId() { return `${this.markupPrefix}dropShadow`; } // this is referenced in the markup Svg to apply the drop-shadow filter to all markup elements.
183
297
  /** @internal */
184
298
  static get cornerId() { return `${this.markupPrefix}photoCorner`; }
@@ -210,116 +324,6 @@ class MarkupApp {
210
324
  static get textEditorClass() { return `${this.markupPrefix}textEditor`; }
211
325
  }
212
326
  exports.MarkupApp = MarkupApp;
213
- /** By setting members of this object, applications can control the appearance and behavior of various parts of MarkupApp. */
214
- MarkupApp.props = {
215
- /** the UI controls displayed on Elements by the Select Tool to allow users to modify them. */
216
- handles: {
217
- /** The diameter of the circles for the handles. */
218
- size: 10,
219
- /** The attributes of the stretch handles */
220
- stretch: { "fill-opacity": .85, "stroke": "black", "fill": "white" },
221
- /** The attributes of the line that connects the top-center stretch handle to the rotate handle. */
222
- rotateLine: { "stroke": "grey", "fill-opacity": .85 },
223
- /** The attributes of the rotate handle. */
224
- rotate: { "cursor": `url(${core_frontend_1.IModelApp.publicPath}Markup/rotate.png) 12 12, auto`, "fill-opacity": .85, "stroke": "black", "fill": "lightBlue" },
225
- /** The attributes of box around the element. */
226
- moveOutline: { "cursor": "move", "stroke-dasharray": "6,6", "fill": "none", "stroke-opacity": .85, "stroke": "white" },
227
- /** The attributes of box that provides the move cursor. */
228
- move: { "cursor": "move", "opacity": 0, "stroke-width": 10, "stroke": "white" },
229
- /** The attributes of handles on the vertices of lines. */
230
- vertex: { "cursor": `url(${core_frontend_1.IModelApp.publicPath}cursors/crosshair.cur), crosshair`, "fill-opacity": .85, "stroke": "black", "fill": "white" },
231
- },
232
- /** properties for providing feedback about selected elements. */
233
- hilite: {
234
- /** the color of selected elements */
235
- color: "magenta",
236
- /** the color of an element as the cursor passes over it */
237
- flash: "cyan",
238
- },
239
- /** optionally, show a drop-shadow behind all markup elements. */
240
- dropShadow: {
241
- /** if false, no drop shadow */
242
- enable: true,
243
- /** the attributes of the drop shadow. See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow */
244
- attr: {
245
- "stdDeviation": 2,
246
- "dx": 1.2,
247
- "dy": 1.4,
248
- "flood-color": "#1B3838",
249
- },
250
- },
251
- /** The "active placement" parameters. New elements are created with these parameters, so UI controls should set them. */
252
- active: {
253
- /** the CSS style properties of new text elements. */
254
- text: {
255
- "font-family": "sans-serif",
256
- "font-size": "30px",
257
- "stroke": "none",
258
- "fill": "red",
259
- },
260
- /** the CSS style properties of new elements. */
261
- element: {
262
- "stroke": "red",
263
- "stroke-opacity": 0.8,
264
- "stroke-width": 3,
265
- "stroke-dasharray": 0,
266
- "stroke-linecap": "round",
267
- "stroke-linejoin": "round",
268
- "fill": "blue",
269
- "fill-opacity": 0.2,
270
- },
271
- arrow: {
272
- length: 7,
273
- width: 6,
274
- },
275
- cloud: {
276
- path: "M3.0,2.5 C3.9,.78 5.6,-.4 8.1,1.0 C9.1,0 11.3,-.2 12.5,.5 C14.2,-.5 17,.16 17.9,2.5 C21,3 20.2,7.3 17.6,7.5 C16.5,9.2 14.4,9.8 12.7,8.9 C11.6,10 9.5,10.3 8.1,9.4 C5.7,10.8 3.3,9.4 2.6,7.5 C-.9,7.7 .6,1.7 3.0,2.5z",
277
- },
278
- },
279
- /** Values for placing and editing Text. */
280
- text: {
281
- /** A default string for the Markup.Text.Place command. Applications can turn this off, or supply the user's initials, for example. */
282
- startValue: "Note: ",
283
- /** Parameters for the size and appearance of the text editor */
284
- edit: {
285
- background: "blanchedalmond",
286
- /** Starting size, will be updated if user stretches the box */
287
- size: { width: "25%", height: "4em" },
288
- /** font size of the text editor */
289
- fontSize: "14pt",
290
- /** A background box drawn around text so user can tell what's being selected */
291
- textBox: { "fill": "lightGrey", "fill-opacity": .1, "stroke-opacity": .85, "stroke": "lightBlue" },
292
- },
293
- },
294
- /** Used to draw the border outline around the view while it is being marked up so the user can tell Markup is active */
295
- borderOutline: {
296
- "stroke": "gold",
297
- "stroke-width": 6,
298
- "stroke-opacity": 0.4,
299
- "fill": "none",
300
- },
301
- /** Used to draw the border corner symbols for the view while it is being marked up so the user can tell Markup is active */
302
- borderCorners: {
303
- "stroke": "black",
304
- "stroke-width": 2,
305
- "stroke-opacity": 0.2,
306
- "fill": "gold",
307
- "fill-opacity": 0.2,
308
- },
309
- /** Determines what is returned by MarkupApp.stop */
310
- result: {
311
- /** The format for the image data. */
312
- imageFormat: "image/png",
313
- /** If true, the markup graphics will be imprinted in the returned image. */
314
- imprintSvgOnImage: true,
315
- /** the maximum width for the returned image. If the source view width is larger than this, it will be scaled down to this size. */
316
- maxWidth: 2048,
317
- },
318
- };
319
- MarkupApp._saveDefaultToolId = "";
320
- MarkupApp.markupSelectToolId = "Markup.Select";
321
- /** @internal */
322
- MarkupApp.markupPrefix = "markup-";
323
327
  const removeSvgNamespace = (svg) => {
324
328
  svg.node.removeAttribute("xmlns:svgjs");
325
329
  return svg;
@@ -331,6 +335,21 @@ const newSvgElement = (name) => (0, svg_js_1.adopt)((0, svg_js_1.create)(name));
331
335
  * @public
332
336
  */
333
337
  class Markup {
338
+ vp;
339
+ /** @internal */
340
+ markupDiv;
341
+ /** Support undo/redo of markup operations */
342
+ undo = new Undo_1.UndoManager();
343
+ /** The set of currently selected markup elements */
344
+ selected;
345
+ /** @internal */
346
+ svgContainer;
347
+ /** @internal */
348
+ svgMarkup;
349
+ /** @internal */
350
+ svgDynamics;
351
+ /** @internal */
352
+ svgDecorations;
334
353
  /** create the drop-shadow filter in the Defs section of the supplied svg element */
335
354
  createDropShadow(svg) {
336
355
  const filter = (0, svg_js_1.SVG)(`#${MarkupApp.dropShadowId}`); // see if we already have one?
@@ -362,8 +381,6 @@ class Markup {
362
381
  */
363
382
  constructor(vp, markupData) {
364
383
  this.vp = vp;
365
- /** Support undo/redo of markup operations */
366
- this.undo = new Undo_1.UndoManager();
367
384
  this.markupDiv = vp.addNewDiv("overlay-markup", true, 20); // this div goes on top of the canvas, but behind UI layers
368
385
  const rect = this.markupDiv.getBoundingClientRect();
369
386
  // First, see if there is a markup passed in as an argument
@@ -1 +1 @@
1
- {"version":3,"file":"Markup.js","sourceRoot":"","sources":["../../src/Markup.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2D;AAC3D,wDAAsD;AACtD,oDAAoE;AACpE,wDAAsH;AACtH,6CAA+G;AAC/G,6CAA6C;AAC7C,6CAA0D;AAC1D,uCAAuC;AACvC,iCAAqC;AA6BrC;;;;;;GAMG;AACH,MAAa,SAAS;IAiHpB,gBAAgB;IACT,MAAM,CAAC,aAAa;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC;QAC7D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C,KAAa,EAAE,MAAc,EAAE,KAAa;QACnE,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,wCAAwC;QACpE,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,MAAM,aAAa,GAAG,cAAc,MAAM,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;QAC/D,IAAI,MAAM,GAAG,IAAA,YAAG,EAAC,IAAI,aAAa,EAAE,CAAW,CAAC;QAChD,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;YACpB,MAAM,GAAG,IAAI,CAAC,SAAU,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;YACjE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,GAAG,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YACtD,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;YAC5C,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,6JAA6J;YACjM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC5B,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA1ID,wBA0IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module MarkupApp\n */\n\nimport { BentleyError, Logger } from \"@itwin/core-bentley\";\nimport { Point3d, XAndY } from \"@itwin/core-geometry\";\nimport { ImageSource, ImageSourceFormat } from \"@itwin/core-common\";\nimport { FrontendLoggerCategory, imageElementFromImageSource, IModelApp, ScreenViewport } from \"@itwin/core-frontend\";\nimport { adopt, create, G, Marker, Element as MarkupElement, Matrix, Point, Svg, SVG } from \"@svgdotjs/svg.js\";\nimport * as redlineTool from \"./RedlineTool\";\nimport { MarkupSelected, SelectTool } from \"./SelectTool\";\nimport * as textTool from \"./TextEdit\";\nimport { UndoManager } from \"./Undo\";\n\n// cspell:ignore blanchedalmond, lmultiply, svgs\n\n/** The width and height of a Markup image, in pixels.\n * @public */\nexport interface WidthAndHeight {\n width: number;\n height: number;\n}\n\n/** The size and SVG string for a Markup\n * @public\n */\nexport interface MarkupSvgData {\n /** The size of the image, in pixels. This also indicates the aspect ratio of the SVG data. */\n rect: WidthAndHeight;\n /** a string holding the svg data for the markup. Will be undefined if [[MarkupApp.stop]] is called without an active Markup */\n svg?: string;\n}\n\n/** Markup data returned by [[MarkupApp.stop]]\n * @public\n */\nexport interface MarkupData extends MarkupSvgData {\n /** a base64 encoded string with the image of the view that was marked up. See [[MarkupApp.props.result]] for options. */\n image?: string;\n}\n\n/**\n * The main object for the Markup package. It is a singleton that stores the state of the Markup application.\n * It has only static members and methods. Applications may customize and control the behavior of the Markup by\n * setting members of [[MarkupApp.props]]. When [[MarkupApp.start]] is first called, it registers a set of \"Markup.xxx\"\n * tools that may be invoked from UI controls.\n * @public\n */\nexport class MarkupApp {\n /** the current Markup being created */\n public static markup?: Markup;\n /** The namespace for the Markup tools */\n public static namespace?: string;\n /** By setting members of this object, applications can control the appearance and behavior of various parts of MarkupApp. */\n public static props = {\n /** the UI controls displayed on Elements by the Select Tool to allow users to modify them. */\n handles: {\n /** The diameter of the circles for the handles. */\n size: 10,\n /** The attributes of the stretch handles */\n stretch: { \"fill-opacity\": .85, \"stroke\": \"black\", \"fill\": \"white\" },\n /** The attributes of the line that connects the top-center stretch handle to the rotate handle. */\n rotateLine: { \"stroke\": \"grey\", \"fill-opacity\": .85 },\n /** The attributes of the rotate handle. */\n rotate: { \"cursor\": `url(${IModelApp.publicPath}Markup/rotate.png) 12 12, auto`, \"fill-opacity\": .85, \"stroke\": \"black\", \"fill\": \"lightBlue\" },\n /** The attributes of box around the element. */\n moveOutline: { \"cursor\": \"move\", \"stroke-dasharray\": \"6,6\", \"fill\": \"none\", \"stroke-opacity\": .85, \"stroke\": \"white\" },\n /** The attributes of box that provides the move cursor. */\n move: { \"cursor\": \"move\", \"opacity\": 0, \"stroke-width\": 10, \"stroke\": \"white\" },\n /** The attributes of handles on the vertices of lines. */\n vertex: { \"cursor\": `url(${IModelApp.publicPath}cursors/crosshair.cur), crosshair`, \"fill-opacity\": .85, \"stroke\": \"black\", \"fill\": \"white\" },\n },\n /** properties for providing feedback about selected elements. */\n hilite: {\n /** the color of selected elements */\n color: \"magenta\",\n /** the color of an element as the cursor passes over it */\n flash: \"cyan\",\n },\n /** optionally, show a drop-shadow behind all markup elements. */\n dropShadow: {\n /** if false, no drop shadow */\n enable: true,\n /** the attributes of the drop shadow. See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow */\n attr: {\n \"stdDeviation\": 2,\n \"dx\": 1.2,\n \"dy\": 1.4,\n \"flood-color\": \"#1B3838\",\n },\n },\n /** The \"active placement\" parameters. New elements are created with these parameters, so UI controls should set them. */\n active: {\n /** the CSS style properties of new text elements. */\n text: {\n \"font-family\": \"sans-serif\",\n \"font-size\": \"30px\",\n \"stroke\": \"none\",\n \"fill\": \"red\",\n },\n /** the CSS style properties of new elements. */\n element: {\n \"stroke\": \"red\",\n \"stroke-opacity\": 0.8,\n \"stroke-width\": 3,\n \"stroke-dasharray\": 0,\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n \"fill\": \"blue\",\n \"fill-opacity\": 0.2,\n },\n arrow: {\n length: 7,\n width: 6,\n },\n cloud: {\n path: \"M3.0,2.5 C3.9,.78 5.6,-.4 8.1,1.0 C9.1,0 11.3,-.2 12.5,.5 C14.2,-.5 17,.16 17.9,2.5 C21,3 20.2,7.3 17.6,7.5 C16.5,9.2 14.4,9.8 12.7,8.9 C11.6,10 9.5,10.3 8.1,9.4 C5.7,10.8 3.3,9.4 2.6,7.5 C-.9,7.7 .6,1.7 3.0,2.5z\",\n },\n },\n /** Values for placing and editing Text. */\n text: {\n /** A default string for the Markup.Text.Place command. Applications can turn this off, or supply the user's initials, for example. */\n startValue: \"Note: \",\n /** Parameters for the size and appearance of the text editor */\n edit: {\n background: \"blanchedalmond\",\n /** Starting size, will be updated if user stretches the box */\n size: { width: \"25%\", height: \"4em\" },\n /** font size of the text editor */\n fontSize: \"14pt\",\n /** A background box drawn around text so user can tell what's being selected */\n textBox: { \"fill\": \"lightGrey\", \"fill-opacity\": .1, \"stroke-opacity\": .85, \"stroke\": \"lightBlue\" },\n },\n },\n /** Used to draw the border outline around the view while it is being marked up so the user can tell Markup is active */\n borderOutline: {\n \"stroke\": \"gold\",\n \"stroke-width\": 6,\n \"stroke-opacity\": 0.4,\n \"fill\": \"none\",\n },\n /** Used to draw the border corner symbols for the view while it is being marked up so the user can tell Markup is active */\n borderCorners: {\n \"stroke\": \"black\",\n \"stroke-width\": 2,\n \"stroke-opacity\": 0.2,\n \"fill\": \"gold\",\n \"fill-opacity\": 0.2,\n },\n /** Determines what is returned by MarkupApp.stop */\n result: {\n /** The format for the image data. */\n imageFormat: \"image/png\",\n /** If true, the markup graphics will be imprinted in the returned image. */\n imprintSvgOnImage: true,\n /** the maximum width for the returned image. If the source view width is larger than this, it will be scaled down to this size. */\n maxWidth: 2048,\n },\n };\n\n private static _saveDefaultToolId = \"\";\n /** @internal */\n public static screenToVbMtx(): Matrix {\n const matrix = this.markup?.svgMarkup?.screenCTM().inverse();\n return (undefined !== matrix ? matrix : new Matrix());\n }\n /** @internal */\n public static getVpToScreenMtx(): Matrix {\n const rect = this.markup!.markupDiv.getBoundingClientRect();\n return (new Matrix()).translateO(rect.left, rect.top);\n }\n\n /** @internal */\n public static getVpToVbMtx(): Matrix { return this.getVpToScreenMtx().lmultiplyO(this.screenToVbMtx()); }\n /** @internal */\n public static convertVpToVb(pt: XAndY): Point3d {\n const pt0 = new Point(pt.x, pt.y);\n pt0.transformO(this.getVpToVbMtx());\n return new Point3d(pt0.x, pt0.y, 0);\n }\n\n /** determine whether there's a markup session currently active */\n public static get isActive() { return undefined !== this.markup; }\n public static markupSelectToolId = \"Markup.Select\";\n\n protected static createMarkup(view: ScreenViewport, markupData?: MarkupSvgData) { return new Markup(view, markupData); }\n\n protected static lockViewportSize(view: ScreenViewport, markupData?: MarkupSvgData) {\n const parentDiv = view.vpDiv;\n const rect = parentDiv.getBoundingClientRect();\n let width = rect.width;\n let height = rect.height;\n if (markupData) {\n const aspect = markupData.rect.height / markupData.rect.width;\n if ((width * aspect) > height)\n width = Math.floor(height / aspect);\n else\n height = Math.floor(width * aspect);\n }\n const style = parentDiv.style;\n style.width = `${width}px`;\n style.height = `${height}px`;\n }\n\n /** @internal */\n public static getActionName(action: string) { return IModelApp.localization.getLocalizedString(`${this.namespace}:actions.${action}`); }\n\n /** Start a markup session */\n public static async start(view: ScreenViewport, markupData?: MarkupSvgData): Promise<void> {\n if (this.markup)\n return; // a markup session is already active.\n\n await this.initialize();\n\n // first, lock the viewport to its current size while the markup session is running\n this.lockViewportSize(view, markupData);\n\n this.markup = this.createMarkup(view, markupData); // start a markup against the provided view.\n if (!this.markup.svgMarkup) {\n ScreenViewport.setToParentSize(this.markup.vp.vpDiv);\n this.markup.markupDiv.remove();\n return;\n }\n\n IModelApp.toolAdmin.markupView = view; // so viewing tools won't operate on the view.\n\n // set the markup Select tool as the default tool and start it, saving current default tool\n this._saveDefaultToolId = IModelApp.toolAdmin.defaultToolId;\n IModelApp.toolAdmin.defaultToolId = this.markupSelectToolId;\n return IModelApp.toolAdmin.startDefaultTool();\n }\n\n /** Read the result of a Markup session, then stop the session.\n * @note see [MarkupApp.props.result] for options.\n */\n public static async stop(): Promise<MarkupData> {\n await IModelApp.toolAdmin.startDefaultTool(); // Make sure current markup tool exits first...\n const data = await this.readMarkup();\n if (!this.markup)\n return data;\n\n // restore original size for vp.\n ScreenViewport.setToParentSize(this.markup.vp.vpDiv);\n\n IModelApp.toolAdmin.markupView = undefined; // re-enable viewing tools for the view being marked-up\n this.markup.destroy();\n this.markup = undefined;\n // now restore the default tool and start it\n IModelApp.toolAdmin.defaultToolId = this._saveDefaultToolId;\n this._saveDefaultToolId = \"\";\n await IModelApp.toolAdmin.startDefaultTool();\n return data;\n }\n\n /** Call this method to initialize the Markup system.\n * It asynchronously loads the MarkupTools namespace for the prompts and tool names for the Markup system, and\n * also registers all of the Markup tools.\n * @return a Promise that may be awaited to ensure that the MarkupTools namespace had been loaded.\n * @note This method is automatically called every time you call [[start]]. Since the Markup tools cannot\n * start unless there is a Markup active, there's really no need to call this method directly.\n * The only virtue in doing so is to pre-load the Markup namespace if you have an opportunity to do so earlier in your\n * startup code.\n * @note This method may be called multiple times, but only the first time initiates the loading/registering. Subsequent\n * calls return the same Promise.\n */\n public static async initialize(): Promise<void> {\n if (undefined === this.namespace) { // only need to do this once\n this.namespace = \"MarkupTools\";\n const namespacePromise = IModelApp.localization.registerNamespace(this.namespace);\n IModelApp.tools.register(SelectTool, this.namespace);\n IModelApp.tools.registerModule(redlineTool, this.namespace);\n IModelApp.tools.registerModule(textTool, this.namespace);\n return namespacePromise;\n }\n return IModelApp.localization.getNamespacePromise(this.namespace)!; // so caller can make sure localized messages are ready.\n }\n\n /** convert the current markup SVG into a string, but don't include decorations or dynamics\n * @internal\n */\n protected static readMarkupSvg() {\n const markup = this.markup;\n if (!markup || !markup.svgContainer)\n return undefined;\n markup.svgDecorations!.remove(); // we don't want the decorations or dynamics to be included\n markup.svgDynamics!.remove();\n void IModelApp.toolAdmin.startDefaultTool();\n return markup.svgContainer.svg(); // string-ize the SVG data\n }\n\n /** convert the current markup SVG into a string (after calling readMarkupSvg) making sure width and height are specified.\n * @internal\n */\n protected static readMarkupSvgForDrawImage() {\n const markup = this.markup;\n if (!markup || !markup.svgContainer)\n return undefined;\n // Firefox requires width and height on top-level svg or drawImage does nothing, passing width/height to drawImage doesn't work.\n const rect = markup.markupDiv.getBoundingClientRect();\n markup.svgContainer.width(rect.width);\n markup.svgContainer.height(rect.height);\n return markup.svgContainer.svg(); // string-ize the SVG data\n }\n\n /** @internal */\n protected static async readMarkup(): Promise<MarkupData> {\n const result = this.props.result;\n let canvas = this.markup!.vp.readImageToCanvas();\n let svg, image;\n try {\n svg = this.readMarkupSvg(); // read the current svg data for the markup\n const svgForImage = (svg && result.imprintSvgOnImage ? this.readMarkupSvgForDrawImage() : undefined);\n if (svgForImage) {\n const svgImage = await imageElementFromImageSource(new ImageSource(svgForImage, ImageSourceFormat.Svg));\n canvas.getContext(\"2d\")!.drawImage(svgImage, 0, 0); // draw markup svg onto view's canvas2d\n }\n\n // is the source view too wide? If so, we need to scale the image down.\n if (canvas.width > result.maxWidth) {\n // yes, we have to scale it down, create a new canvas and set the new canvas' size\n const newCanvas = document.createElement(\"canvas\");\n newCanvas.width = result.maxWidth;\n newCanvas.height = canvas.height * (result.maxWidth / canvas.width);\n newCanvas.getContext(\"2d\")!.drawImage(canvas, 0, 0, canvas.width, canvas.height, 0, 0, newCanvas.width, newCanvas.height);\n canvas = newCanvas; // return the image from adjusted canvas, not view canvas.\n }\n\n // return the markup data to be saved by the application.\n image = (!result.imageFormat ? undefined : canvas.toDataURL(result.imageFormat));\n } catch (e) {\n Logger.logError(`${FrontendLoggerCategory.Package}.markup`, \"Error creating image from svg\", BentleyError.getErrorProps(e));\n }\n return { rect: { width: canvas.width, height: canvas.height }, svg, image };\n }\n\n /** @internal */\n public static markupPrefix = \"markup-\";\n /** @internal */\n public static get dropShadowId() { return `${this.markupPrefix}dropShadow`; } // this is referenced in the markup Svg to apply the drop-shadow filter to all markup elements.\n /** @internal */\n public static get cornerId() { return `${this.markupPrefix}photoCorner`; }\n /** @internal */\n public static get containerClass() { return `${this.markupPrefix}container`; }\n /** @internal */\n public static get dynamicsClass() { return `${this.markupPrefix}dynamics`; }\n /** @internal */\n public static get decorationsClass() { return `${this.markupPrefix}decorations`; }\n /** @internal */\n public static get markupSvgClass() { return `${this.markupPrefix}svg`; }\n /** @internal */\n public static get boxedTextClass() { return `${this.markupPrefix}boxedText`; }\n /** @internal */\n public static get textClass() { return `${this.markupPrefix}text`; }\n /** @internal */\n public static get stretchHandleClass() { return `${this.markupPrefix}stretchHandle`; }\n /** @internal */\n public static get rotateLineClass() { return `${this.markupPrefix}rotateLine`; }\n /** @internal */\n public static get rotateHandleClass() { return `${this.markupPrefix}rotateHandle`; }\n /** @internal */\n public static get vertexHandleClass() { return `${this.markupPrefix}vertexHandle`; }\n /** @internal */\n public static get moveHandleClass() { return `${this.markupPrefix}moveHandle`; }\n /** @internal */\n public static get textOutlineClass() { return `${this.markupPrefix}textOutline`; }\n /** @internal */\n public static get textEditorClass() { return `${this.markupPrefix}textEditor`; }\n}\n\nconst removeSvgNamespace = (svg: Svg) => {\n svg.node.removeAttribute(\"xmlns:svgjs\");\n return svg;\n};\n\nconst newSvgElement = (name: string) => adopt(create(name));\n\n/**\n * The current markup being created/edited. Holds the SVG elements, plus the active [[MarkupTool]].\n * When starting a Markup, a new Div is added as a child of the ScreenViewport's vpDiv.\n * @public\n */\nexport class Markup {\n /** @internal */\n public readonly markupDiv: HTMLDivElement;\n /** Support undo/redo of markup operations */\n public readonly undo = new UndoManager();\n /** The set of currently selected markup elements */\n public readonly selected!: MarkupSelected;\n /** @internal */\n public readonly svgContainer?: Svg;\n /** @internal */\n public readonly svgMarkup?: G;\n /** @internal */\n public readonly svgDynamics?: G;\n /** @internal */\n public readonly svgDecorations?: G;\n\n /** create the drop-shadow filter in the Defs section of the supplied svg element */\n private createDropShadow(svg: Svg) {\n const filter = SVG(`#${MarkupApp.dropShadowId}`); // see if we already have one?\n if (filter)\n filter.remove(); // yes, remove it. This must be someone modifying the drop shadow properties\n\n // create a new filter, and add it to the Defs of the supplied svg\n svg.defs()\n .add(newSvgElement(\"filter\").id(MarkupApp.dropShadowId)\n .add(newSvgElement(\"feDropShadow\").attr(MarkupApp.props.dropShadow.attr)));\n }\n private addNested(className: string): G { return this.svgContainer!.group().addClass(className); }\n private addBorder() {\n const rect = this.svgContainer!.viewbox();\n const inset = MarkupApp.props.borderOutline[\"stroke-width\"];\n const cornerSize = inset * 6;\n const cornerPts = [0, 0, cornerSize, 0, cornerSize * .7, cornerSize * .3, cornerSize * .3, cornerSize * .3, cornerSize * .3, cornerSize * .7, 0, cornerSize];\n const decorations = this.svgDecorations!;\n const photoCorner = decorations.symbol().polygon(cornerPts).attr(MarkupApp.props.borderCorners).id(MarkupApp.cornerId);\n const cornerGroup = decorations.group();\n cornerGroup.rect(rect.width - inset, rect.height - inset).move(inset / 2, inset / 2).attr(MarkupApp.props.borderOutline);\n cornerGroup.use(photoCorner);\n cornerGroup.use(photoCorner).rotate(90).translate(rect.width - cornerSize, 0);\n cornerGroup.use(photoCorner).rotate(180).translate(rect.width - cornerSize, rect.height - cornerSize);\n cornerGroup.use(photoCorner).rotate(270).translate(0, rect.height - cornerSize);\n }\n\n /** Create a new Markup for the supplied ScreenViewport. Adds a new \"overlay-markup\" div into the \"vpDiv\"\n * of the viewport.\n * @note you must call destroy on this object at end of markup to remove the markup div.\n */\n public constructor(public vp: ScreenViewport, markupData?: MarkupSvgData) {\n this.markupDiv = vp.addNewDiv(\"overlay-markup\", true, 20); // this div goes on top of the canvas, but behind UI layers\n const rect = this.markupDiv.getBoundingClientRect();\n\n // First, see if there is a markup passed in as an argument\n if (markupData && markupData.svg) {\n this.markupDiv.innerHTML = markupData.svg; // make it a child of the markupDiv\n this.svgContainer = SVG(`.${MarkupApp.containerClass}`) as Svg | undefined; // get it in svg.js format\n this.svgMarkup = SVG(`.${MarkupApp.markupSvgClass}`) as G | undefined;\n if (!this.svgContainer || !this.svgMarkup) // if either isn't present, its not a valid markup\n return;\n removeSvgNamespace(this.svgContainer); // the SVG call above adds this - remove it\n this.svgMarkup.each(() => { }, true); // create an SVG.Element for each entry in the supplied markup.\n } else {\n // create the container that will be returned as the \"svg\" data for this markup\n this.svgContainer = SVG().addTo(this.markupDiv).addClass(MarkupApp.containerClass).viewbox(0, 0, rect.width, rect.height);\n removeSvgNamespace(this.svgContainer);\n this.svgMarkup = this.addNested(MarkupApp.markupSvgClass);\n }\n\n if (MarkupApp.props.dropShadow.enable) {\n this.createDropShadow(this.svgContainer);\n this.svgContainer.attr(\"filter\", `url(#${MarkupApp.dropShadowId})`);\n }\n\n /** add two nested groups for providing feedback during the markup session. These Svgs are removed before the data is returned. */\n this.svgDynamics = this.addNested(MarkupApp.dynamicsClass); // only for tool dynamics of SVG graphics.\n this.svgDecorations = this.addNested(MarkupApp.decorationsClass); // only for temporary decorations of SVG graphics.\n this.addBorder();\n this.selected = new MarkupSelected(this.svgDecorations);\n }\n\n /** Called when the Markup is destroyed */\n public destroy() { this.markupDiv.remove(); }\n /** Turn on picking the markup elements in the markup view */\n public enablePick() { this.markupDiv.style.pointerEvents = \"auto\"; }\n /** Turn off picking the markup elements in the markup view */\n public disablePick() { this.markupDiv.style.pointerEvents = \"none\"; }\n /** Change the default cursor for the markup view */\n public setCursor(cursor: string) { this.markupDiv.style.cursor = cursor; }\n /** Delete all the entries in the selection set, then empty it. */\n public deleteSelected() { this.selected.deleteAll(this.undo); }\n /** Bring all the entries in the selection set to the front. */\n public bringToFront() { this.selected.reposition(MarkupApp.getActionName(\"toFront\"), this.undo, (el) => el.front()); }\n /** Send all the entries in the selection set to the back. */\n public sendToBack() { this.selected.reposition(MarkupApp.getActionName(\"toBack\"), this.undo, (el) => el.back()); }\n /** Group all the entries in the selection set, then select the group. */\n public groupSelected() {\n if (undefined !== this.svgMarkup)\n this.selected.groupAll(this.undo);\n }\n\n /** Ungroup all the group entries in the selection set. */\n public ungroupSelected() {\n if (undefined !== this.svgMarkup)\n this.selected.ungroupAll(this.undo);\n }\n\n /** Check if the supplied MarkupElement is a group of MarkupText and the MarkupText's outline Rect.\n * @param el the markup element to check\n * @returns true if boxed text\n */\n public isBoxedText(el: MarkupElement): boolean {\n return el.type === \"g\" &&\n el.node.classList.length > 0 &&\n el.node.classList[0] === MarkupApp.boxedTextClass &&\n el.children().length === 2;\n }\n\n /** Get an existing or create a new reusable symbol representing an arrow head.\n * If a Marker for the supplied color and size already exists it is returned, otherwise a new Marker is created.\n * @param color the arrow head color\n * @param length the arrow head length\n * @param width the arrow head width\n * @note Flashing doesn't currently affect markers, need support for \"context-stroke\" and \"context-fill\". For now encode color in name...\n */\n public createArrowMarker(color: string, length: number, width: number): Marker {\n length = Math.ceil(length); // Don't allow \".\" in selector string...\n width = Math.ceil(width);\n const arrowMarkerId = `ArrowMarker${length}x${width}-${color}`;\n let marker = SVG(`#${arrowMarkerId}`) as Marker;\n if (null === marker) {\n marker = this.svgMarkup!.marker(length, width).id(arrowMarkerId);\n marker.polygon([0, 0, length, width * 0.5, 0, width]);\n marker.attr(\"orient\", \"auto-start-reverse\");\n marker.attr(\"overflow\", \"visible\"); // Don't clip the stroke that is being applied to allow the specified start/end to be used directly while hiding the arrow tail fully under the arrow head...\n marker.attr(\"refX\", length);\n marker.css({ stroke: color, fill: color });\n }\n return marker;\n }\n}\n"]}
1
+ {"version":3,"file":"Markup.js","sourceRoot":"","sources":["../../src/Markup.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2D;AAC3D,wDAAsD;AACtD,oDAAoE;AACpE,wDAAsH;AACtH,6CAA+G;AAC/G,6CAA6C;AAC7C,6CAA0D;AAC1D,uCAAuC;AACvC,iCAAqC;AA6BrC;;;;;;GAMG;AACH,MAAa,SAAS;IACpB,uCAAuC;IAChC,MAAM,CAAC,MAAM,CAAU;IAC9B,yCAAyC;IAClC,MAAM,CAAC,SAAS,CAAU;IACjC,6HAA6H;IACtH,MAAM,CAAC,KAAK,GAAG;QACpB,8FAA8F;QAC9F,OAAO,EAAE;YACP,mDAAmD;YACnD,IAAI,EAAE,EAAE;YACR,4CAA4C;YAC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,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA1ID,wBA0IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module MarkupApp\n */\n\nimport { BentleyError, Logger } from \"@itwin/core-bentley\";\nimport { Point3d, XAndY } from \"@itwin/core-geometry\";\nimport { ImageSource, ImageSourceFormat } from \"@itwin/core-common\";\nimport { FrontendLoggerCategory, imageElementFromImageSource, IModelApp, ScreenViewport } from \"@itwin/core-frontend\";\nimport { adopt, create, G, Marker, Element as MarkupElement, Matrix, Point, Svg, SVG } from \"@svgdotjs/svg.js\";\nimport * as redlineTool from \"./RedlineTool\";\nimport { MarkupSelected, SelectTool } from \"./SelectTool\";\nimport * as textTool from \"./TextEdit\";\nimport { UndoManager } from \"./Undo\";\n\n// cspell:ignore blanchedalmond, lmultiply, svgs\n\n/** The width and height of a Markup image, in pixels.\n * @public */\nexport interface WidthAndHeight {\n width: number;\n height: number;\n}\n\n/** The size and SVG string for a Markup\n * @public\n */\nexport interface MarkupSvgData {\n /** The size of the image, in pixels. This also indicates the aspect ratio of the SVG data. */\n rect: WidthAndHeight;\n /** a string holding the svg data for the markup. Will be undefined if [[MarkupApp.stop]] is called without an active Markup */\n svg?: string;\n}\n\n/** Markup data returned by [[MarkupApp.stop]]\n * @public\n */\nexport interface MarkupData extends MarkupSvgData {\n /** a base64 encoded string with the image of the view that was marked up. See [[MarkupApp.props.result]] for options. */\n image?: string;\n}\n\n/**\n * The main object for the Markup package. It is a singleton that stores the state of the Markup application.\n * It has only static members and methods. Applications may customize and control the behavior of the Markup by\n * setting members of [[MarkupApp.props]]. When [[MarkupApp.start]] is first called, it registers a set of \"Markup.xxx\"\n * tools that may be invoked from UI controls.\n * @public\n */\nexport class MarkupApp {\n /** the current Markup being created */\n public static markup?: Markup;\n /** The namespace for the Markup tools */\n public static namespace?: string;\n /** By setting members of this object, applications can control the appearance and behavior of various parts of MarkupApp. */\n public static props = {\n /** the UI controls displayed on Elements by the Select Tool to allow users to modify them. */\n handles: {\n /** The diameter of the circles for the handles. */\n size: 10,\n /** The attributes of the stretch handles */\n stretch: { \"fill-opacity\": .85, \"stroke\": \"black\", \"fill\": \"white\" },\n /** The attributes of the line that connects the top-center stretch handle to the rotate handle. */\n rotateLine: { \"stroke\": \"grey\", \"fill-opacity\": .85 },\n /** The attributes of the rotate handle. */\n rotate: { \"cursor\": `url(${IModelApp.publicPath}Markup/rotate.png) 12 12, auto`, \"fill-opacity\": .85, \"stroke\": \"black\", \"fill\": \"lightBlue\" },\n /** The attributes of box around the element. */\n moveOutline: { \"cursor\": \"move\", \"stroke-dasharray\": \"6,6\", \"fill\": \"none\", \"stroke-opacity\": .85, \"stroke\": \"white\" },\n /** The attributes of box that provides the move cursor. */\n move: { \"cursor\": \"move\", \"opacity\": 0, \"stroke-width\": 10, \"stroke\": \"white\" },\n /** The attributes of handles on the vertices of lines. */\n vertex: { \"cursor\": `url(${IModelApp.publicPath}cursors/crosshair.cur), crosshair`, \"fill-opacity\": .85, \"stroke\": \"black\", \"fill\": \"white\" },\n },\n /** properties for providing feedback about selected elements. */\n hilite: {\n /** the color of selected elements */\n color: \"magenta\",\n /** the color of an element as the cursor passes over it */\n flash: \"cyan\",\n },\n /** optionally, show a drop-shadow behind all markup elements. */\n dropShadow: {\n /** if false, no drop shadow */\n enable: true,\n /** the attributes of the drop shadow. See https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow */\n attr: {\n \"stdDeviation\": 2,\n \"dx\": 1.2,\n \"dy\": 1.4,\n \"flood-color\": \"#1B3838\",\n },\n },\n /** The \"active placement\" parameters. New elements are created with these parameters, so UI controls should set them. */\n active: {\n /** the CSS style properties of new text elements. */\n text: {\n \"font-family\": \"sans-serif\",\n \"font-size\": \"30px\",\n \"stroke\": \"none\",\n \"fill\": \"red\",\n },\n /** the CSS style properties of new elements. */\n element: {\n \"stroke\": \"red\",\n \"stroke-opacity\": 0.8,\n \"stroke-width\": 3,\n \"stroke-dasharray\": 0,\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n \"fill\": \"blue\",\n \"fill-opacity\": 0.2,\n },\n arrow: {\n length: 7,\n width: 6,\n },\n cloud: {\n path: \"M3.0,2.5 C3.9,.78 5.6,-.4 8.1,1.0 C9.1,0 11.3,-.2 12.5,.5 C14.2,-.5 17,.16 17.9,2.5 C21,3 20.2,7.3 17.6,7.5 C16.5,9.2 14.4,9.8 12.7,8.9 C11.6,10 9.5,10.3 8.1,9.4 C5.7,10.8 3.3,9.4 2.6,7.5 C-.9,7.7 .6,1.7 3.0,2.5z\",\n },\n },\n /** Values for placing and editing Text. */\n text: {\n /** A default string for the Markup.Text.Place command. Applications can turn this off, or supply the user's initials, for example. */\n startValue: \"Note: \",\n /** Parameters for the size and appearance of the text editor */\n edit: {\n background: \"blanchedalmond\",\n /** Starting size, will be updated if user stretches the box */\n size: { width: \"25%\", height: \"4em\" },\n /** font size of the text editor */\n fontSize: \"14pt\",\n /** A background box drawn around text so user can tell what's being selected */\n textBox: { \"fill\": \"lightGrey\", \"fill-opacity\": .1, \"stroke-opacity\": .85, \"stroke\": \"lightBlue\" },\n },\n },\n /** Used to draw the border outline around the view while it is being marked up so the user can tell Markup is active */\n borderOutline: {\n \"stroke\": \"gold\",\n \"stroke-width\": 6,\n \"stroke-opacity\": 0.4,\n \"fill\": \"none\",\n },\n /** Used to draw the border corner symbols for the view while it is being marked up so the user can tell Markup is active */\n borderCorners: {\n \"stroke\": \"black\",\n \"stroke-width\": 2,\n \"stroke-opacity\": 0.2,\n \"fill\": \"gold\",\n \"fill-opacity\": 0.2,\n },\n /** Determines what is returned by MarkupApp.stop */\n result: {\n /** The format for the image data. */\n imageFormat: \"image/png\",\n /** If true, the markup graphics will be imprinted in the returned image. */\n imprintSvgOnImage: true,\n /** the maximum width for the returned image. If the source view width is larger than this, it will be scaled down to this size. */\n maxWidth: 2048,\n },\n };\n\n private static _saveDefaultToolId = \"\";\n /** @internal */\n public static screenToVbMtx(): Matrix {\n const matrix = this.markup?.svgMarkup?.screenCTM().inverse();\n return (undefined !== matrix ? matrix : new Matrix());\n }\n /** @internal */\n public static getVpToScreenMtx(): Matrix {\n const rect = this.markup!.markupDiv.getBoundingClientRect();\n return (new Matrix()).translateO(rect.left, rect.top);\n }\n\n /** @internal */\n public static getVpToVbMtx(): Matrix { return this.getVpToScreenMtx().lmultiplyO(this.screenToVbMtx()); }\n /** @internal */\n public static convertVpToVb(pt: XAndY): Point3d {\n const pt0 = new Point(pt.x, pt.y);\n pt0.transformO(this.getVpToVbMtx());\n return new Point3d(pt0.x, pt0.y, 0);\n }\n\n /** determine whether there's a markup session currently active */\n public static get isActive() { return undefined !== this.markup; }\n public static markupSelectToolId = \"Markup.Select\";\n\n protected static createMarkup(view: ScreenViewport, markupData?: MarkupSvgData) { return new Markup(view, markupData); }\n\n protected static lockViewportSize(view: ScreenViewport, markupData?: MarkupSvgData) {\n const parentDiv = view.vpDiv;\n const rect = parentDiv.getBoundingClientRect();\n let width = rect.width;\n let height = rect.height;\n if (markupData) {\n const aspect = markupData.rect.height / markupData.rect.width;\n if ((width * aspect) > height)\n width = Math.floor(height / aspect);\n else\n height = Math.floor(width * aspect);\n }\n const style = parentDiv.style;\n style.width = `${width}px`;\n style.height = `${height}px`;\n }\n\n /** @internal */\n public static getActionName(action: string) { return IModelApp.localization.getLocalizedString(`${this.namespace}:actions.${action}`); }\n\n /** Start a markup session */\n public static async start(view: ScreenViewport, markupData?: MarkupSvgData): Promise<void> {\n if (this.markup)\n return; // a markup session is already active.\n\n await this.initialize();\n\n // first, lock the viewport to its current size while the markup session is running\n this.lockViewportSize(view, markupData);\n\n this.markup = this.createMarkup(view, markupData); // start a markup against the provided view.\n if (!this.markup.svgMarkup) {\n ScreenViewport.setToParentSize(this.markup.vp.vpDiv);\n this.markup.markupDiv.remove();\n return;\n }\n\n IModelApp.toolAdmin.markupView = view; // so viewing tools won't operate on the view.\n\n // set the markup Select tool as the default tool and start it, saving current default tool\n this._saveDefaultToolId = IModelApp.toolAdmin.defaultToolId;\n IModelApp.toolAdmin.defaultToolId = this.markupSelectToolId;\n return IModelApp.toolAdmin.startDefaultTool();\n }\n\n /** Read the result of a Markup session, then stop the session.\n * @note see [MarkupApp.props.result] for options.\n */\n public static async stop(): Promise<MarkupData> {\n await IModelApp.toolAdmin.startDefaultTool(); // Make sure current markup tool exits first...\n const data = await this.readMarkup();\n if (!this.markup)\n return data;\n\n // restore original size for vp.\n ScreenViewport.setToParentSize(this.markup.vp.vpDiv);\n\n IModelApp.toolAdmin.markupView = undefined; // re-enable viewing tools for the view being marked-up\n this.markup.destroy();\n this.markup = undefined;\n // now restore the default tool and start it\n IModelApp.toolAdmin.defaultToolId = this._saveDefaultToolId;\n this._saveDefaultToolId = \"\";\n await IModelApp.toolAdmin.startDefaultTool();\n return data;\n }\n\n /** Call this method to initialize the Markup system.\n * It asynchronously loads the MarkupTools namespace for the prompts and tool names for the Markup system, and\n * also registers all of the Markup tools.\n * @return a Promise that may be awaited to ensure that the MarkupTools namespace had been loaded.\n * @note This method is automatically called every time you call [[start]]. Since the Markup tools cannot\n * start unless there is a Markup active, there's really no need to call this method directly.\n * The only virtue in doing so is to pre-load the Markup namespace if you have an opportunity to do so earlier in your\n * startup code.\n * @note This method may be called multiple times, but only the first time initiates the loading/registering. Subsequent\n * calls return the same Promise.\n */\n public static async initialize(): Promise<void> {\n if (undefined === this.namespace) { // only need to do this once\n this.namespace = \"MarkupTools\";\n const namespacePromise = IModelApp.localization.registerNamespace(this.namespace);\n IModelApp.tools.register(SelectTool, this.namespace);\n IModelApp.tools.registerModule(redlineTool, this.namespace);\n IModelApp.tools.registerModule(textTool, this.namespace);\n return namespacePromise;\n }\n return IModelApp.localization.getNamespacePromise(this.namespace)!; // so caller can make sure localized messages are ready.\n }\n\n /** convert the current markup SVG into a string, but don't include decorations or dynamics\n * @internal\n */\n protected static readMarkupSvg() {\n const markup = this.markup;\n if (!markup || !markup.svgContainer)\n return undefined;\n markup.svgDecorations!.remove(); // we don't want the decorations or dynamics to be included\n markup.svgDynamics!.remove();\n void IModelApp.toolAdmin.startDefaultTool();\n return markup.svgContainer.svg(); // string-ize the SVG data\n }\n\n /** convert the current markup SVG into a string (after calling readMarkupSvg) making sure width and height are specified.\n * @internal\n */\n protected static readMarkupSvgForDrawImage() {\n const markup = this.markup;\n if (!markup || !markup.svgContainer)\n return undefined;\n // Firefox requires width and height on top-level svg or drawImage does nothing, passing width/height to drawImage doesn't work.\n const rect = markup.markupDiv.getBoundingClientRect();\n markup.svgContainer.width(rect.width);\n markup.svgContainer.height(rect.height);\n return markup.svgContainer.svg(); // string-ize the SVG data\n }\n\n /** @internal */\n protected static async readMarkup(): Promise<MarkupData> {\n const result = this.props.result;\n let canvas = this.markup!.vp.readImageToCanvas({omitCanvasDecorations: false});\n let svg, image;\n try {\n svg = this.readMarkupSvg(); // read the current svg data for the markup\n const svgForImage = (svg && result.imprintSvgOnImage ? this.readMarkupSvgForDrawImage() : undefined);\n if (svgForImage) {\n const svgImage = await imageElementFromImageSource(new ImageSource(svgForImage, ImageSourceFormat.Svg));\n canvas.getContext(\"2d\")!.drawImage(svgImage, 0, 0); // draw markup svg onto view's canvas2d\n }\n\n // is the source view too wide? If so, we need to scale the image down.\n if (canvas.width > result.maxWidth) {\n // yes, we have to scale it down, create a new canvas and set the new canvas' size\n const newCanvas = document.createElement(\"canvas\");\n newCanvas.width = result.maxWidth;\n newCanvas.height = canvas.height * (result.maxWidth / canvas.width);\n newCanvas.getContext(\"2d\")!.drawImage(canvas, 0, 0, canvas.width, canvas.height, 0, 0, newCanvas.width, newCanvas.height);\n canvas = newCanvas; // return the image from adjusted canvas, not view canvas.\n }\n\n // return the markup data to be saved by the application.\n image = (!result.imageFormat ? undefined : canvas.toDataURL(result.imageFormat));\n } catch (e) {\n Logger.logError(`${FrontendLoggerCategory.Package}.markup`, \"Error creating image from svg\", BentleyError.getErrorProps(e));\n }\n return { rect: { width: canvas.width, height: canvas.height }, svg, image };\n }\n\n /** @internal */\n public static markupPrefix = \"markup-\";\n /** @internal */\n public static get dropShadowId() { return `${this.markupPrefix}dropShadow`; } // this is referenced in the markup Svg to apply the drop-shadow filter to all markup elements.\n /** @internal */\n public static get cornerId() { return `${this.markupPrefix}photoCorner`; }\n /** @internal */\n public static get containerClass() { return `${this.markupPrefix}container`; }\n /** @internal */\n public static get dynamicsClass() { return `${this.markupPrefix}dynamics`; }\n /** @internal */\n public static get decorationsClass() { return `${this.markupPrefix}decorations`; }\n /** @internal */\n public static get markupSvgClass() { return `${this.markupPrefix}svg`; }\n /** @internal */\n public static get boxedTextClass() { return `${this.markupPrefix}boxedText`; }\n /** @internal */\n public static get textClass() { return `${this.markupPrefix}text`; }\n /** @internal */\n public static get stretchHandleClass() { return `${this.markupPrefix}stretchHandle`; }\n /** @internal */\n public static get rotateLineClass() { return `${this.markupPrefix}rotateLine`; }\n /** @internal */\n public static get rotateHandleClass() { return `${this.markupPrefix}rotateHandle`; }\n /** @internal */\n public static get vertexHandleClass() { return `${this.markupPrefix}vertexHandle`; }\n /** @internal */\n public static get moveHandleClass() { return `${this.markupPrefix}moveHandle`; }\n /** @internal */\n public static get textOutlineClass() { return `${this.markupPrefix}textOutline`; }\n /** @internal */\n public static get textEditorClass() { return `${this.markupPrefix}textEditor`; }\n}\n\nconst removeSvgNamespace = (svg: Svg) => {\n svg.node.removeAttribute(\"xmlns:svgjs\");\n return svg;\n};\n\nconst newSvgElement = (name: string) => adopt(create(name));\n\n/**\n * The current markup being created/edited. Holds the SVG elements, plus the active [[MarkupTool]].\n * When starting a Markup, a new Div is added as a child of the ScreenViewport's vpDiv.\n * @public\n */\nexport class Markup {\n /** @internal */\n public readonly markupDiv: HTMLDivElement;\n /** Support undo/redo of markup operations */\n public readonly undo = new UndoManager();\n /** The set of currently selected markup elements */\n public readonly selected!: MarkupSelected;\n /** @internal */\n public readonly svgContainer?: Svg;\n /** @internal */\n public readonly svgMarkup?: G;\n /** @internal */\n public readonly svgDynamics?: G;\n /** @internal */\n public readonly svgDecorations?: G;\n\n /** create the drop-shadow filter in the Defs section of the supplied svg element */\n private createDropShadow(svg: Svg) {\n const filter = SVG(`#${MarkupApp.dropShadowId}`); // see if we already have one?\n if (filter)\n filter.remove(); // yes, remove it. This must be someone modifying the drop shadow properties\n\n // create a new filter, and add it to the Defs of the supplied svg\n svg.defs()\n .add(newSvgElement(\"filter\").id(MarkupApp.dropShadowId)\n .add(newSvgElement(\"feDropShadow\").attr(MarkupApp.props.dropShadow.attr)));\n }\n private addNested(className: string): G { return this.svgContainer!.group().addClass(className); }\n private addBorder() {\n const rect = this.svgContainer!.viewbox();\n const inset = MarkupApp.props.borderOutline[\"stroke-width\"];\n const cornerSize = inset * 6;\n const cornerPts = [0, 0, cornerSize, 0, cornerSize * .7, cornerSize * .3, cornerSize * .3, cornerSize * .3, cornerSize * .3, cornerSize * .7, 0, cornerSize];\n const decorations = this.svgDecorations!;\n const photoCorner = decorations.symbol().polygon(cornerPts).attr(MarkupApp.props.borderCorners).id(MarkupApp.cornerId);\n const cornerGroup = decorations.group();\n cornerGroup.rect(rect.width - inset, rect.height - inset).move(inset / 2, inset / 2).attr(MarkupApp.props.borderOutline);\n cornerGroup.use(photoCorner);\n cornerGroup.use(photoCorner).rotate(90).translate(rect.width - cornerSize, 0);\n cornerGroup.use(photoCorner).rotate(180).translate(rect.width - cornerSize, rect.height - cornerSize);\n cornerGroup.use(photoCorner).rotate(270).translate(0, rect.height - cornerSize);\n }\n\n /** Create a new Markup for the supplied ScreenViewport. Adds a new \"overlay-markup\" div into the \"vpDiv\"\n * of the viewport.\n * @note you must call destroy on this object at end of markup to remove the markup div.\n */\n public constructor(public vp: ScreenViewport, markupData?: MarkupSvgData) {\n this.markupDiv = vp.addNewDiv(\"overlay-markup\", true, 20); // this div goes on top of the canvas, but behind UI layers\n const rect = this.markupDiv.getBoundingClientRect();\n\n // First, see if there is a markup passed in as an argument\n if (markupData && markupData.svg) {\n this.markupDiv.innerHTML = markupData.svg; // make it a child of the markupDiv\n this.svgContainer = SVG(`.${MarkupApp.containerClass}`) as Svg | undefined; // get it in svg.js format\n this.svgMarkup = SVG(`.${MarkupApp.markupSvgClass}`) as G | undefined;\n if (!this.svgContainer || !this.svgMarkup) // if either isn't present, its not a valid markup\n return;\n removeSvgNamespace(this.svgContainer); // the SVG call above adds this - remove it\n this.svgMarkup.each(() => { }, true); // create an SVG.Element for each entry in the supplied markup.\n } else {\n // create the container that will be returned as the \"svg\" data for this markup\n this.svgContainer = SVG().addTo(this.markupDiv).addClass(MarkupApp.containerClass).viewbox(0, 0, rect.width, rect.height);\n removeSvgNamespace(this.svgContainer);\n this.svgMarkup = this.addNested(MarkupApp.markupSvgClass);\n }\n\n if (MarkupApp.props.dropShadow.enable) {\n this.createDropShadow(this.svgContainer);\n this.svgContainer.attr(\"filter\", `url(#${MarkupApp.dropShadowId})`);\n }\n\n /** add two nested groups for providing feedback during the markup session. These Svgs are removed before the data is returned. */\n this.svgDynamics = this.addNested(MarkupApp.dynamicsClass); // only for tool dynamics of SVG graphics.\n this.svgDecorations = this.addNested(MarkupApp.decorationsClass); // only for temporary decorations of SVG graphics.\n this.addBorder();\n this.selected = new MarkupSelected(this.svgDecorations);\n }\n\n /** Called when the Markup is destroyed */\n public destroy() { this.markupDiv.remove(); }\n /** Turn on picking the markup elements in the markup view */\n public enablePick() { this.markupDiv.style.pointerEvents = \"auto\"; }\n /** Turn off picking the markup elements in the markup view */\n public disablePick() { this.markupDiv.style.pointerEvents = \"none\"; }\n /** Change the default cursor for the markup view */\n public setCursor(cursor: string) { this.markupDiv.style.cursor = cursor; }\n /** Delete all the entries in the selection set, then empty it. */\n public deleteSelected() { this.selected.deleteAll(this.undo); }\n /** Bring all the entries in the selection set to the front. */\n public bringToFront() { this.selected.reposition(MarkupApp.getActionName(\"toFront\"), this.undo, (el) => el.front()); }\n /** Send all the entries in the selection set to the back. */\n public sendToBack() { this.selected.reposition(MarkupApp.getActionName(\"toBack\"), this.undo, (el) => el.back()); }\n /** Group all the entries in the selection set, then select the group. */\n public groupSelected() {\n if (undefined !== this.svgMarkup)\n this.selected.groupAll(this.undo);\n }\n\n /** Ungroup all the group entries in the selection set. */\n public ungroupSelected() {\n if (undefined !== this.svgMarkup)\n this.selected.ungroupAll(this.undo);\n }\n\n /** Check if the supplied MarkupElement is a group of MarkupText and the MarkupText's outline Rect.\n * @param el the markup element to check\n * @returns true if boxed text\n */\n public isBoxedText(el: MarkupElement): boolean {\n return el.type === \"g\" &&\n el.node.classList.length > 0 &&\n el.node.classList[0] === MarkupApp.boxedTextClass &&\n el.children().length === 2;\n }\n\n /** Get an existing or create a new reusable symbol representing an arrow head.\n * If a Marker for the supplied color and size already exists it is returned, otherwise a new Marker is created.\n * @param color the arrow head color\n * @param length the arrow head length\n * @param width the arrow head width\n * @note Flashing doesn't currently affect markers, need support for \"context-stroke\" and \"context-fill\". For now encode color in name...\n */\n public createArrowMarker(color: string, length: number, width: number): Marker {\n length = Math.ceil(length); // Don't allow \".\" in selector string...\n width = Math.ceil(width);\n const arrowMarkerId = `ArrowMarker${length}x${width}-${color}`;\n let marker = SVG(`#${arrowMarkerId}`) as Marker;\n if (null === marker) {\n marker = this.svgMarkup!.marker(length, width).id(arrowMarkerId);\n marker.polygon([0, 0, length, width * 0.5, 0, width]);\n marker.attr(\"orient\", \"auto-start-reverse\");\n marker.attr(\"overflow\", \"visible\"); // Don't clip the stroke that is being applied to allow the specified start/end to be used directly while hiding the arrow tail fully under the arrow head...\n marker.attr(\"refX\", length);\n marker.css({ stroke: color, fill: color });\n }\n return marker;\n }\n}\n"]}
@@ -14,6 +14,8 @@ const Markup_1 = require("./Markup");
14
14
  * @public
15
15
  */
16
16
  class MarkupTool extends core_frontend_1.PrimitiveTool {
17
+ markup;
18
+ static toolKey = "MarkupTools:tools.Markup.";
17
19
  requireWriteableTarget() { return false; }
18
20
  isCompatibleViewport(vp, isSelectedViewChange) { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && vp === core_frontend_1.IModelApp.toolAdmin.markupView); }
19
21
  async onInstall() {
@@ -85,5 +87,4 @@ class MarkupTool extends core_frontend_1.PrimitiveTool {
85
87
  }
86
88
  }
87
89
  exports.MarkupTool = MarkupTool;
88
- MarkupTool.toolKey = "MarkupTools:tools.Markup.";
89
90
  //# sourceMappingURL=MarkupTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkupTool.js","sourceRoot":"","sources":["../../src/MarkupTool.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAyI;AAEzI,qCAA6C;AAE7C;;GAEG;AACH,MAAsB,UAAW,SAAQ,6BAAa;IAGpC,sBAAsB,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IACnD,oBAAoB,CAAC,EAAwB,EAAE,oBAA6B,IAAa,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,EAAE,oBAAoB,CAAC,IAAI,SAAS,KAAK,EAAE,IAAI,EAAE,KAAK,yBAAS,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACtN,KAAK,CAAC,SAAS;QAC7B,IAAI,SAAS,KAAK,kBAAS,CAAC,MAAM;YAChC,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,MAAM,GAAG,kBAAS,CAAC,MAAM,CAAC;QAC/B,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;IAEe,KAAK,CAAC,aAAa;QACjC,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;QAC5B,IAAI,CAAC,2BAA2B,EAAE,CAAC;IACrC,CAAC;IACe,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACnD,KAAK,CAAC,aAAa,KAAK,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;I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eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC,CAAC;QACnC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,+BAA+B;QACtD,OAAO,SAAS,CAAC;IACnB,CAAC;;AAjFH,gCAmFC;AAjFe,kBAAO,GAAG,2BAA2B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module MarkupTools\n */\n\nimport { XAndY } from \"@itwin/core-geometry\";\nimport { BeButton, BeTouchEvent, CoordinateLockOverrides, EventHandled, IModelApp, PrimitiveTool, Viewport } from \"@itwin/core-frontend\";\nimport { G, LinkedHTMLElement, Element as MarkupElement, Text as MarkupText } from \"@svgdotjs/svg.js\";\nimport { Markup, MarkupApp } from \"./Markup\";\n\n/** Base class for all tools that operate on Markup elements.\n * @public\n */\nexport abstract class MarkupTool extends PrimitiveTool {\n public markup!: Markup;\n public static toolKey = \"MarkupTools:tools.Markup.\";\n public override requireWriteableTarget(): boolean { return false; }\n public override isCompatibleViewport(vp: Viewport | undefined, isSelectedViewChange: boolean): boolean { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && vp === IModelApp.toolAdmin.markupView); }\n public override async onInstall(): Promise<boolean> {\n if (undefined === MarkupApp.markup)\n return false;\n\n this.markup = MarkupApp.markup;\n return super.onInstall();\n }\n\n public override async onPostInstall() {\n await super.onPostInstall();\n this.setupAndPromptForNextAction();\n }\n public override async onUnsuspend() { this.showPrompt(); }\n public async onRestartTool() { return this.exitTool(); }\n\n protected showPrompt(): void { }\n protected setupAndPromptForNextAction(): void {\n IModelApp.toolAdmin.toolState.coordLockOvr = CoordinateLockOverrides.All; // Don't adjust point to ACS or grid...\n this.showPrompt();\n }\n protected outputMarkupPrompt(msg: string) { IModelApp.notifications.outputPromptByKey(MarkupTool.toolKey + msg); }\n\n public override async onTouchMoveStart(ev: BeTouchEvent, startEv: BeTouchEvent): Promise<EventHandled> {\n if (startEv.isSingleTouch)\n await IModelApp.toolAdmin.convertTouchMoveStartToButtonDownAndMotion(startEv, ev);\n return EventHandled.Yes; // View tools are not allowed during redlining; use touch events to create markup and don't pass event to IdleTool...\n }\n\n public override async onTouchMove(ev: BeTouchEvent): Promise<void> { return IModelApp.toolAdmin.convertTouchMoveToMotion(ev); }\n public override async onTouchComplete(ev: BeTouchEvent): Promise<void> { return IModelApp.toolAdmin.convertTouchEndToButtonUp(ev); }\n public override async onTouchCancel(ev: BeTouchEvent): Promise<void> { return IModelApp.toolAdmin.convertTouchEndToButtonUp(ev, BeButton.Reset); }\n\n public override async undoPreviousStep(): Promise<boolean> {\n if (await this.onUndoPreviousStep()) // first see if this tool has an \"oops\" operation.\n return true; // yes, we're done\n this.markup.undo.doUndo(); // otherwise undo the last change by previous tools\n return true;\n }\n\n public override async redoPreviousStep(): Promise<boolean> {\n if (await this.onRedoPreviousStep())\n return true;\n this.markup.undo.doRedo();\n return true;\n }\n\n /** Find the topmost MarkupElement at the specified point in the markup view.\n * @param pt the point in view coordinates\n * @returns The topmost element, or undefined if no elements under pt.\n */\n public pickElement(pt: XAndY): MarkupElement | undefined {\n const markup = this.markup;\n const rect = markup.markupDiv.getBoundingClientRect();\n const node = document.elementFromPoint(pt.x + rect.left, pt.y + rect.top) as LinkedHTMLElement | null;\n if (!node || !node.instance)\n return undefined;\n const el = node.instance;\n return el.getChildOrGroupOf(markup.svgMarkup!);\n }\n protected setCurrentStyle(element: MarkupElement, canBeFilled: boolean): void {\n element.css(MarkupApp.props.active.element);\n if (!canBeFilled)\n element.css({ fill: \"none\" });\n }\n\n protected setCurrentTextStyle(element: MarkupElement): void { element.css(MarkupApp.props.active.text); }\n\n /** @internal */\n public createBoxedText(g: G, text: MarkupText) {\n const boxedText = g.group().addClass(MarkupApp.boxedTextClass);\n const outline = text.getOutline(3);\n this.setCurrentStyle(outline, true);\n outline.css({ \"stroke-width\": 1 });\n outline.addTo(boxedText);\n text.addTo(boxedText); // make sure the text is on top\n return boxedText;\n }\n\n}\n"]}
1
+ {"version":3,"file":"MarkupTool.js","sourceRoot":"","sources":["../../src/MarkupTool.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAyI;AAEzI,qCAA6C;AAE7C;;GAEG;AACH,MAAsB,UAAW,SAAQ,6BAAa;IAC7C,MAAM,CAAU;IAChB,MAAM,CAAC,OAAO,GAAG,2BAA2B,CAAC;IACpC,sBAAsB,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IACnD,oBAAoB,CAAC,EAAwB,EAAE,oBAA6B,IAAa,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,EAAE,oBAAoB,CAAC,IAAI,SAAS,KAAK,EAAE,IAAI,EAAE,KAAK,yBAAS,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACtN,KAAK,CAAC,SAAS;QAC7B,IAAI,SAAS,KAAK,kBAAS,CAAC,MAAM;YAChC,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,MAAM,GAAG,kBAAS,CAAC,MAAM,CAAC;QAC/B,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;IAEe,KAAK,CAAC,aAAa;QACjC,MAAM,KAAK,CAAC,aAAa,EAAE,CAAC;QAC5B,IAAI,CAAC,2BAA2B,EAAE,CAAC;IACrC,CAAC;IACe,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACnD,KAAK,CAAC,aAAa,KAAK,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAE9C,UAAU,KAAW,CAAC;IACtB,2BAA2B;QACn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QACpC,OAAO,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC,CAAC;QACnC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,+BAA+B;QACtD,OAAO,SAAS,CAAC;IACnB,CAAC;;AAjFH,gCAmFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module MarkupTools\n */\n\nimport { XAndY } from \"@itwin/core-geometry\";\nimport { BeButton, BeTouchEvent, CoordinateLockOverrides, EventHandled, IModelApp, PrimitiveTool, Viewport } from \"@itwin/core-frontend\";\nimport { G, LinkedHTMLElement, Element as MarkupElement, Text as MarkupText } from \"@svgdotjs/svg.js\";\nimport { Markup, MarkupApp } from \"./Markup\";\n\n/** Base class for all tools that operate on Markup elements.\n * @public\n */\nexport abstract class MarkupTool extends PrimitiveTool {\n public markup!: Markup;\n public static toolKey = \"MarkupTools:tools.Markup.\";\n public override requireWriteableTarget(): boolean { return false; }\n public override isCompatibleViewport(vp: Viewport | undefined, isSelectedViewChange: boolean): boolean { return (super.isCompatibleViewport(vp, isSelectedViewChange) && undefined !== vp && vp === IModelApp.toolAdmin.markupView); }\n public override async onInstall(): Promise<boolean> {\n if (undefined === MarkupApp.markup)\n return false;\n\n this.markup = MarkupApp.markup;\n return super.onInstall();\n }\n\n public override async onPostInstall() {\n await super.onPostInstall();\n this.setupAndPromptForNextAction();\n }\n public override async onUnsuspend() { this.showPrompt(); }\n public async onRestartTool() { return this.exitTool(); }\n\n protected showPrompt(): void { }\n protected setupAndPromptForNextAction(): void {\n IModelApp.toolAdmin.toolState.coordLockOvr = CoordinateLockOverrides.All; // Don't adjust point to ACS or grid...\n this.showPrompt();\n }\n protected outputMarkupPrompt(msg: string) { IModelApp.notifications.outputPromptByKey(MarkupTool.toolKey + msg); }\n\n public override async onTouchMoveStart(ev: BeTouchEvent, startEv: BeTouchEvent): Promise<EventHandled> {\n if (startEv.isSingleTouch)\n await IModelApp.toolAdmin.convertTouchMoveStartToButtonDownAndMotion(startEv, ev);\n return EventHandled.Yes; // View tools are not allowed during redlining; use touch events to create markup and don't pass event to IdleTool...\n }\n\n public override async onTouchMove(ev: BeTouchEvent): Promise<void> { return IModelApp.toolAdmin.convertTouchMoveToMotion(ev); }\n public override async onTouchComplete(ev: BeTouchEvent): Promise<void> { return IModelApp.toolAdmin.convertTouchEndToButtonUp(ev); }\n public override async onTouchCancel(ev: BeTouchEvent): Promise<void> { return IModelApp.toolAdmin.convertTouchEndToButtonUp(ev, BeButton.Reset); }\n\n public override async undoPreviousStep(): Promise<boolean> {\n if (await this.onUndoPreviousStep()) // first see if this tool has an \"oops\" operation.\n return true; // yes, we're done\n this.markup.undo.doUndo(); // otherwise undo the last change by previous tools\n return true;\n }\n\n public override async redoPreviousStep(): Promise<boolean> {\n if (await this.onRedoPreviousStep())\n return true;\n this.markup.undo.doRedo();\n return true;\n }\n\n /** Find the topmost MarkupElement at the specified point in the markup view.\n * @param pt the point in view coordinates\n * @returns The topmost element, or undefined if no elements under pt.\n */\n public pickElement(pt: XAndY): MarkupElement | undefined {\n const markup = this.markup;\n const rect = markup.markupDiv.getBoundingClientRect();\n const node = document.elementFromPoint(pt.x + rect.left, pt.y + rect.top) as LinkedHTMLElement | null;\n if (!node || !node.instance)\n return undefined;\n const el = node.instance;\n return el.getChildOrGroupOf(markup.svgMarkup!);\n }\n protected setCurrentStyle(element: MarkupElement, canBeFilled: boolean): void {\n element.css(MarkupApp.props.active.element);\n if (!canBeFilled)\n element.css({ fill: \"none\" });\n }\n\n protected setCurrentTextStyle(element: MarkupElement): void { element.css(MarkupApp.props.active.text); }\n\n /** @internal */\n public createBoxedText(g: G, text: MarkupText) {\n const boxedText = g.group().addClass(MarkupApp.boxedTextClass);\n const outline = text.getOutline(3);\n this.setCurrentStyle(outline, true);\n outline.css({ \"stroke-width\": 1 });\n outline.addTo(boxedText);\n text.addTo(boxedText); // make sure the text is on top\n return boxedText;\n }\n\n}\n"]}