@orangelogic/design-system 2.69.0 → 2.70.0
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/library/chunks/AxisLabelRadial.BTpA5dYy.js +11 -0
- package/library/chunks/BaseColumnSeries.hIO71GLG.js +304 -0
- package/library/chunks/CandlestickSeries.w9C0GR9v.js +362 -0
- package/library/chunks/Circle.tOnnO-F-.js +17 -0
- package/library/chunks/ColumnSeries.Ckz75x1M.js +54 -0
- package/library/chunks/EditableAxisLabel.CCMTJT7K.js +445 -0
- package/library/chunks/EditableLabel.DPmicdjK.js +119 -0
- package/library/chunks/Gradient.BrDBLm8v.js +40 -0
- package/library/chunks/LinearGradient.CxfXxvMw.js +37 -0
- package/library/chunks/MonotoneXTension.CJMEHHj3.js +139 -0
- package/library/chunks/Picture.BNASYM-P.js +49 -0
- package/library/chunks/Polygon.Dr-GV2hn.js +70 -0
- package/library/chunks/ProgressPie.4mPA6xqm.js +234 -0
- package/library/chunks/RadialLabel.HfsGiN4x.js +88 -0
- package/library/chunks/Scrollbar.Bgg-RhjP.js +118 -0
- package/library/chunks/Slice.Dm56LTKj.js +120 -0
- package/library/chunks/Slider.FKJwoPq2.js +19 -0
- package/library/chunks/SpriteResizer.-qJDgug8.js +446 -0
- package/library/chunks/Triangle.BECgi7mc.js +21 -0
- package/library/chunks/ZoomTools.cgwuIB0e.js +199 -0
- package/library/chunks/___vite-browser-external_commonjs-proxy.C2tf3HsQ.js +8 -0
- package/library/chunks/{_baseUniq.Df-fLIBx.js → _baseUniq.BUihBa8c.js} +56 -53
- package/library/chunks/{_commonjsHelpers.ByX85dGu.js → _commonjsHelpers.DQNKXVTB.js} +2 -2
- package/library/chunks/accessors.BHk36ecy.js +11 -0
- package/library/chunks/am-chart.oZVBmpnn.js +18435 -0
- package/library/chunks/{animation.DfUHRQry.js → animation.DU8t6mrk.js} +1 -1
- package/library/chunks/{button.SoX-7UYy.js → button.CAAJPQFu.js} +3 -3
- package/library/chunks/{capitalize.WSkCXkNE.js → capitalize.CNStXZBq.js} +1 -1
- package/library/chunks/cardinal.BCA_LB0u.js +64 -0
- package/library/chunks/{color-swatch-group.Dx1fbSJx.js → color-swatch-group.CKHyWM8K.js} +6 -6
- package/library/chunks/{color-swatch.B7XXHxx1.js → color-swatch.BkpPCXd6.js} +2 -2
- package/library/chunks/colorPicker.C4w_vDjh.js +527 -0
- package/library/chunks/{confirm-popover.327ATuQH.js → confirm-popover.ZD74yDWw.js} +3 -3
- package/library/chunks/{content-builder.Bxi6k2LA.js → content-builder.B4Tqoc6M.js} +40 -34
- package/library/chunks/{cropper.BraEEykE.js → cropper.CQB3_qqG.js} +6937 -6935
- package/library/chunks/{dialog.eN3RUbwx.js → dialog.qSV5AjOE.js} +2 -2
- package/library/chunks/{dom.CZrJ64Dm.js → dom.BQVKDNd8.js} +1 -1
- package/library/chunks/{dot-pagination.Bek4w4zz.js → dot-pagination.BN_0ljfc.js} +2 -2
- package/library/chunks/exporting.BdjsEGF8.js +1407 -0
- package/library/chunks/{file-on-demand.BiC4cymk.js → file-on-demand.CXE4zf0J.js} +448 -386
- package/library/chunks/flow.D0FqdfOy.js +1594 -0
- package/library/chunks/{folder-select.DVEFgexx.js → folder-select.CPALQK22.js} +4 -4
- package/library/chunks/{form.CO12-VK0.js → form.DgwYWi0O.js} +1 -1
- package/library/chunks/gantt.DfUM7Gvb.js +2459 -0
- package/library/chunks/{header.Da5yvwdy.js → header.DXZ_5gLY.js} +2 -2
- package/library/chunks/hierarchy.5kfBCoGt.js +3561 -0
- package/library/chunks/{hub-connection.CfARlehM.js → hub-connection.Ot2odiCz.js} +1 -1
- package/library/chunks/{i18n.BMRLOAZR.js → i18n.C0iakJkV.js} +19 -11
- package/library/chunks/{iframe.BJizUE1A.js → iframe.BlzVfeBc.js} +2 -2
- package/library/chunks/{image.bndP5q2c.js → image.B3WjaCXP.js} +2 -2
- package/library/chunks/index.BkoLctE9.js +533 -0
- package/library/chunks/index.CZJTjkLp.js +142 -0
- package/library/chunks/{index.Bhnf0N8Q.js → index.CmVKj_wl.js} +7 -7
- package/library/chunks/index.DU0XUO4k.js +176 -0
- package/library/chunks/index.DcjJFMlq.js +1520 -0
- package/library/chunks/isObjectLike.z36Fu426.js +34 -0
- package/library/chunks/{isSymbol.huJ_Cvxt.js → isSymbol.L0C2ND_U.js} +1 -1
- package/library/chunks/json.BjaT7cyo.js +119 -0
- package/library/chunks/{list-editor.Du1h2Ms0.js → list-editor.CIAAFPco.js} +251 -222
- package/library/chunks/map.DbgNAGxD.js +3037 -0
- package/library/chunks/markerjs2.esm.B_9kjmye.js +1912 -0
- package/library/chunks/{option.Ce_wlnZj.js → option.ByVbmxUQ.js} +2 -2
- package/library/chunks/{pagination.DXu-mFAk.js → pagination.DPQn2fKX.js} +4 -4
- package/library/chunks/pdfmake.Bs7cMDH0.js +41224 -0
- package/library/chunks/percent.DO4FjAdu.js +902 -0
- package/library/chunks/{purify.es.BGaRrCfO.js → purify.es.BIuh5IAZ.js} +115 -115
- package/library/chunks/radar.Dd5fJVMg.js +789 -0
- package/library/chunks/{responsive.DgQTIrna.js → responsive.DL-wBD4P.js} +1 -1
- package/library/chunks/sliceGrouper.DA3aeuJ-.js +93 -0
- package/library/chunks/stock.BfI5MUyK.js +12684 -0
- package/library/chunks/{string.Cp_XNbnV.js → string.B_rEG27K.js} +1 -1
- package/library/chunks/{tab-group.B2pW__9H.js → tab-group.1h51o_Ly.js} +4 -4
- package/library/chunks/{table.5eWm9FfN.js → table.wVHv1Xze.js} +348 -327
- package/library/chunks/timeline.BxMLjB5J.js +837 -0
- package/library/chunks/timer.B39XOBYL.js +123 -0
- package/library/chunks/{toString.CRT5zqEU.js → toString.CL_lYXbK.js} +3 -3
- package/library/chunks/transform.BuqENXeT.js +50 -0
- package/library/chunks/{tree.Zls5YZ8z.js → tree.Bx0IGsWm.js} +2 -2
- package/library/chunks/venn.CxFupTb9.js +966 -0
- package/library/chunks/vfs_fonts.VJpdcrR6.js +9 -0
- package/library/chunks/watch.BCJD77bD.js +547 -0
- package/library/chunks/wc.ThQubbN2.js +255 -0
- package/library/chunks/xlsx.v-qkA-dg.js +25118 -0
- package/library/chunks/xy.q6e68du3.js +333 -0
- package/library/components/alert.js +2 -2
- package/library/components/am-chart.d.ts +3 -0
- package/library/components/am-chart.js +11 -0
- package/library/components/animated-image.js +1 -1
- package/library/components/animation.js +2 -2
- package/library/components/array-line-clamp.js +1 -1
- package/library/components/asset-link-format.js +7 -7
- package/library/components/atoms.js +166 -162
- package/library/components/avatar.js +1 -1
- package/library/components/border-input-group.js +1 -1
- package/library/components/breadcrumb-item.js +1 -1
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +4 -4
- package/library/components/checkbox.js +2 -2
- package/library/components/color-picker.js +4 -4
- package/library/components/color-swatch-group.js +7 -7
- package/library/components/color-swatch.js +3 -3
- package/library/components/confirm-popover.js +4 -4
- package/library/components/copy-button.js +2 -2
- package/library/components/corner-position-input-group.js +2 -2
- package/library/components/cropper.js +1 -1
- package/library/components/details.js +3 -2
- package/library/components/dialog.js +3 -3
- package/library/components/divider.js +1 -1
- package/library/components/dot-pagination.js +3 -3
- package/library/components/drawer.js +3 -3
- package/library/components/dropdown.js +2 -2
- package/library/components/dynamic-select.js +32 -30
- package/library/components/e-chart.d.ts +3 -0
- package/library/components/e-chart.js +47908 -0
- package/library/components/element-clamp.js +3 -3
- package/library/components/file-on-demand.js +10 -10
- package/library/components/folder-select.js +4 -4
- package/library/components/format-bytes.js +1 -1
- package/library/components/format-date.js +1 -1
- package/library/components/format-number.js +1 -1
- package/library/components/format-time.js +2 -2
- package/library/components/grid-item.js +1 -1
- package/library/components/header.js +3 -3
- package/library/components/hub-connection.js +2 -2
- package/library/components/icon-button.js +1 -1
- package/library/components/icon.js +1 -1
- package/library/components/iframe.js +3 -3
- package/library/components/image-comparer.js +2 -2
- package/library/components/image.js +3 -3
- package/library/components/include.js +1 -1
- package/library/components/input.js +3 -3
- package/library/components/line-clamp.js +1 -1
- package/library/components/list-editor.js +11 -8
- package/library/components/markdown.js +2 -2
- package/library/components/masonry.js +2 -2
- package/library/components/menu-item.js +2 -2
- package/library/components/menu.js +1 -1
- package/library/components/molecules.js +5 -5
- package/library/components/mutation-observer.js +1 -1
- package/library/components/option.js +3 -3
- package/library/components/organisms.js +2 -2
- package/library/components/pagination.js +5 -5
- package/library/components/popup.js +1 -1
- package/library/components/position-picker.js +1 -1
- package/library/components/progress-bar.js +1 -1
- package/library/components/progress-ring.js +1 -1
- package/library/components/qr-code.js +1 -1
- package/library/components/radio-button.js +1 -1
- package/library/components/radio-card.js +1 -1
- package/library/components/radio-group.js +2 -2
- package/library/components/radio.js +1 -1
- package/library/components/range.js +3 -3
- package/library/components/rating.js +2 -2
- package/library/components/relative-time.js +1 -1
- package/library/components/resize-observer.js +1 -1
- package/library/components/select.js +4 -4
- package/library/components/share-option-list.js +3 -3
- package/library/components/sidebar.js +1 -1
- package/library/components/size-input-group.js +2 -2
- package/library/components/spinner.js +1 -1
- package/library/components/split-panel.js +2 -2
- package/library/components/stepper.js +1 -1
- package/library/components/switch.js +2 -2
- package/library/components/tab-group.js +5 -5
- package/library/components/tab-panel.js +1 -1
- package/library/components/tab.js +2 -2
- package/library/components/table.js +5 -5
- package/library/components/tag.js +1 -1
- package/library/components/textarea.js +2 -2
- package/library/components/timecode.js +2 -2
- package/library/components/tooltip.js +2 -2
- package/library/components/tree-item.js +3 -3
- package/library/components/tree.js +3 -3
- package/library/components/typeface.js +2 -2
- package/library/components/types.js +27684 -27970
- package/library/components/video.js +1107 -1110
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/am-chart/am-chart.d.ts +45 -0
- package/library/packages/atoms/src/components/am-chart/am-chart.styles.d.ts +2 -0
- package/library/packages/atoms/src/components/am-chart/am-chart.utils.d.ts +23 -0
- package/library/packages/atoms/src/components/e-chart/e-chart-controller.d.ts +30 -0
- package/library/packages/atoms/src/components/e-chart/e-chart.d.ts +38 -0
- package/library/packages/atoms/src/components/e-chart/e-chart.styles.d.ts +2 -0
- package/library/packages/atoms/src/components/table/table.d.ts +21 -0
- package/library/packages/atoms/src/components/table/tabulator-tables/core/Tabulator.d.ts +1 -0
- package/library/packages/atoms/src/components/table/tabulator-tables/core/tools/DataLoader.d.ts +3 -1
- package/library/packages/atoms/src/index.d.ts +2 -0
- package/library/packages/events/src/cx-chart-plan-change.d.ts +10 -0
- package/library/packages/events/src/cx-dashboard-filter-change.d.ts +6 -0
- package/library/packages/events/src/cx-dashboard-table-load-more.d.ts +9 -0
- package/library/packages/events/src/cx-e-chart-drill-down.d.ts +16 -0
- package/library/packages/events/src/events.d.ts +4 -0
- package/library/packages/molecules/src/index.d.ts +1 -0
- package/library/packages/molecules/src/list-editor/list-editor.d.ts +7 -0
- package/library/packages/molecules/src/stat-card/stat-card.d.ts +81 -0
- package/library/packages/molecules/src/stat-card/stat-card.styles.d.ts +2 -0
- package/library/packages/molecules/src/storybook/storybook.d.ts +1 -0
- package/library/packages/organisms/src/asset-link-format/asset-link-format.d.ts +1 -1
- package/library/packages/organisms/src/content-builder/components/chart-plan-builder/chart-plan-builder.d.ts +88 -0
- package/library/packages/organisms/src/content-builder/components/chart-plan-builder/chart-plan-builder.styles.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/components/chart-plan-builder/chart-plan-schema.d.ts +100 -0
- package/library/packages/organisms/src/content-builder/styleController.d.ts +2 -2
- package/library/packages/organisms/src/dashboard-filter/dashboard-filter.d.ts +83 -0
- package/library/packages/organisms/src/dashboard-filter/dashboard-filter.styles.d.ts +2 -0
- package/library/packages/organisms/src/dashboard-table/dashboard-table.d.ts +45 -0
- package/library/packages/organisms/src/dashboard-table/dashboard-table.styles.d.ts +2 -0
- package/library/packages/organisms/src/index.d.ts +3 -0
- package/library/packages/services/src/api/endpoints.d.ts +3 -0
- package/library/packages/types/src/am-chart.d.ts +22 -0
- package/library/packages/types/src/content-builder.d.ts +1 -0
- package/library/packages/types/src/stat-card.d.ts +19 -0
- package/library/packages/types/src/table.d.ts +4 -0
- package/library/packages/utils/src/custom-element/i18n.d.ts +8 -0
- package/library/react-web-component.d.ts +280 -4
- package/library/utils.js +8 -8
- package/package.json +1 -1
- package/library/chunks/_baseRest.ClTMQtN1.js +0 -67
- package/library/chunks/identity.ByMq8VxU.js +0 -6
- package/library/chunks/isObjectLike.D3cpZO39.js +0 -81
- package/library/chunks/watch.q1sEjPWL.js +0 -501
|
@@ -0,0 +1,1912 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
var G = function(o, e) {
|
|
16
|
+
return (G = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, s) {
|
|
17
|
+
t.__proto__ = s;
|
|
18
|
+
} || function(t, s) {
|
|
19
|
+
for (var r in s) Object.prototype.hasOwnProperty.call(s, r) && (t[r] = s[r]);
|
|
20
|
+
})(o, e);
|
|
21
|
+
};
|
|
22
|
+
function d(o, e) {
|
|
23
|
+
function t() {
|
|
24
|
+
this.constructor = o;
|
|
25
|
+
}
|
|
26
|
+
G(o, e), o.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
27
|
+
}
|
|
28
|
+
function H(o, e, t, s) {
|
|
29
|
+
return new (t || (t = Promise))(function(r, i) {
|
|
30
|
+
function n(p) {
|
|
31
|
+
try {
|
|
32
|
+
c(s.next(p));
|
|
33
|
+
} catch (l) {
|
|
34
|
+
i(l);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function a(p) {
|
|
38
|
+
try {
|
|
39
|
+
c(s.throw(p));
|
|
40
|
+
} catch (l) {
|
|
41
|
+
i(l);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function c(p) {
|
|
45
|
+
var l;
|
|
46
|
+
p.done ? r(p.value) : (l = p.value, l instanceof t ? l : new t(function(u) {
|
|
47
|
+
u(l);
|
|
48
|
+
})).then(n, a);
|
|
49
|
+
}
|
|
50
|
+
c((s = s.apply(o, [])).next());
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function z(o, e) {
|
|
54
|
+
var t, s, r, i, n = { label: 0, sent: function() {
|
|
55
|
+
if (1 & r[0]) throw r[1];
|
|
56
|
+
return r[1];
|
|
57
|
+
}, trys: [], ops: [] };
|
|
58
|
+
return i = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (i[Symbol.iterator] = function() {
|
|
59
|
+
return this;
|
|
60
|
+
}), i;
|
|
61
|
+
function a(c) {
|
|
62
|
+
return function(p) {
|
|
63
|
+
return function(l) {
|
|
64
|
+
if (t) throw new TypeError("Generator is already executing.");
|
|
65
|
+
for (; n; ) try {
|
|
66
|
+
if (t = 1, s && (r = 2 & l[0] ? s.return : l[0] ? s.throw || ((r = s.return) && r.call(s), 0) : s.next) && !(r = r.call(s, l[1])).done) return r;
|
|
67
|
+
switch (s = 0, r && (l = [2 & l[0], r.value]), l[0]) {
|
|
68
|
+
case 0:
|
|
69
|
+
case 1:
|
|
70
|
+
r = l;
|
|
71
|
+
break;
|
|
72
|
+
case 4:
|
|
73
|
+
return n.label++, { value: l[1], done: !1 };
|
|
74
|
+
case 5:
|
|
75
|
+
n.label++, s = l[1], l = [0];
|
|
76
|
+
continue;
|
|
77
|
+
case 7:
|
|
78
|
+
l = n.ops.pop(), n.trys.pop();
|
|
79
|
+
continue;
|
|
80
|
+
default:
|
|
81
|
+
if (r = n.trys, !((r = r.length > 0 && r[r.length - 1]) || l[0] !== 6 && l[0] !== 2)) {
|
|
82
|
+
n = 0;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (l[0] === 3 && (!r || l[1] > r[0] && l[1] < r[3])) {
|
|
86
|
+
n.label = l[1];
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
if (l[0] === 6 && n.label < r[1]) {
|
|
90
|
+
n.label = r[1], r = l;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
if (r && n.label < r[2]) {
|
|
94
|
+
n.label = r[2], n.ops.push(l);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
r[2] && n.ops.pop(), n.trys.pop();
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
l = e.call(o, n);
|
|
101
|
+
} catch (u) {
|
|
102
|
+
l = [6, u], s = 0;
|
|
103
|
+
} finally {
|
|
104
|
+
t = r = 0;
|
|
105
|
+
}
|
|
106
|
+
if (5 & l[0]) throw l[1];
|
|
107
|
+
return { value: l[0] ? l[1] : void 0, done: !0 };
|
|
108
|
+
}([c, p]);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function E() {
|
|
113
|
+
for (var o = 0, e = 0, t = arguments.length; e < t; e++) o += arguments[e].length;
|
|
114
|
+
var s = Array(o), r = 0;
|
|
115
|
+
for (e = 0; e < t; e++) for (var i = arguments[e], n = 0, a = i.length; n < a; n++, r++) s[r] = i[n];
|
|
116
|
+
return s;
|
|
117
|
+
}
|
|
118
|
+
var h = function() {
|
|
119
|
+
function o() {
|
|
120
|
+
}
|
|
121
|
+
return o.createDefs = function() {
|
|
122
|
+
return document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
123
|
+
}, o.setAttributes = function(e, t) {
|
|
124
|
+
for (var s = 0, r = t; s < r.length; s++) {
|
|
125
|
+
var i = r[s], n = i[0], a = i[1];
|
|
126
|
+
e.setAttribute(n, a);
|
|
127
|
+
}
|
|
128
|
+
}, o.createRect = function(e, t, s) {
|
|
129
|
+
var r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
130
|
+
return r.setAttribute("width", e.toString()), r.setAttribute("height", t.toString()), s && o.setAttributes(r, s), r;
|
|
131
|
+
}, o.createLine = function(e, t, s, r, i) {
|
|
132
|
+
var n = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
133
|
+
return n.setAttribute("x1", e.toString()), n.setAttribute("y1", t.toString()), n.setAttribute("x2", s.toString()), n.setAttribute("y2", r.toString()), i && o.setAttributes(n, i), n;
|
|
134
|
+
}, o.createPolygon = function(e, t) {
|
|
135
|
+
var s = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
|
136
|
+
return s.setAttribute("points", e), t && o.setAttributes(s, t), s;
|
|
137
|
+
}, o.createCircle = function(e, t) {
|
|
138
|
+
var s = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
139
|
+
return s.setAttribute("cx", (e / 2).toString()), s.setAttribute("cy", (e / 2).toString()), s.setAttribute("r", e.toString()), t && o.setAttributes(s, t), s;
|
|
140
|
+
}, o.createEllipse = function(e, t, s) {
|
|
141
|
+
var r = document.createElementNS("http://www.w3.org/2000/svg", "ellipse");
|
|
142
|
+
return r.setAttribute("cx", (e / 2).toString()), r.setAttribute("cy", (t / 2).toString()), r.setAttribute("rx", (e / 2).toString()), r.setAttribute("ry", (t / 2).toString()), s && o.setAttributes(r, s), r;
|
|
143
|
+
}, o.createGroup = function(e) {
|
|
144
|
+
var t = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
145
|
+
return e && o.setAttributes(t, e), t;
|
|
146
|
+
}, o.createTransform = function() {
|
|
147
|
+
return document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGTransform();
|
|
148
|
+
}, o.createMarker = function(e, t, s, r, i, n, a) {
|
|
149
|
+
var c = document.createElementNS("http://www.w3.org/2000/svg", "marker");
|
|
150
|
+
return o.setAttributes(c, [["id", e], ["orient", t], ["markerWidth", s.toString()], ["markerHeight", r.toString()], ["refX", i.toString()], ["refY", n.toString()]]), c.appendChild(a), c;
|
|
151
|
+
}, o.createText = function(e) {
|
|
152
|
+
var t = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
153
|
+
return t.setAttribute("x", "0"), t.setAttribute("y", "0"), e && o.setAttributes(t, e), t;
|
|
154
|
+
}, o.createTSpan = function(e, t) {
|
|
155
|
+
var s = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
156
|
+
return s.textContent = e, t && o.setAttributes(s, t), s;
|
|
157
|
+
}, o.createImage = function(e) {
|
|
158
|
+
var t = document.createElementNS("http://www.w3.org/2000/svg", "image");
|
|
159
|
+
return e && o.setAttributes(t, e), t;
|
|
160
|
+
}, o.createPoint = function(e, t) {
|
|
161
|
+
var s = document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGPoint();
|
|
162
|
+
return s.x = e, s.y = t, s;
|
|
163
|
+
}, o.createPath = function(e, t) {
|
|
164
|
+
var s = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
165
|
+
return s.setAttribute("d", e), t && o.setAttributes(s, t), s;
|
|
166
|
+
}, o;
|
|
167
|
+
}(), R = function() {
|
|
168
|
+
function o() {
|
|
169
|
+
}
|
|
170
|
+
return o.addKey = function(e) {
|
|
171
|
+
o.key = e;
|
|
172
|
+
}, Object.defineProperty(o, "isLicensed", { get: function() {
|
|
173
|
+
return !!o.key && new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/, "i").test(o.key);
|
|
174
|
+
}, enumerable: !1, configurable: !0 }), o;
|
|
175
|
+
}(), J = function() {
|
|
176
|
+
function o() {
|
|
177
|
+
this.naturalSize = !1, this.imageType = "image/png", this.markersOnly = !1;
|
|
178
|
+
}
|
|
179
|
+
return o.prototype.rasterize = function(e, t, s) {
|
|
180
|
+
var r = this;
|
|
181
|
+
return new Promise(function(i) {
|
|
182
|
+
var n = s !== void 0 ? s : document.createElement("canvas");
|
|
183
|
+
e === null && (r.markersOnly = !0, r.naturalSize = !1);
|
|
184
|
+
var a = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
185
|
+
a.setAttribute("xmlns", "http://www.w3.org/2000/svg"), a.setAttribute("width", t.width.baseVal.valueAsString), a.setAttribute("height", t.height.baseVal.valueAsString), a.setAttribute("viewBox", "0 0 " + t.viewBox.baseVal.width.toString() + " " + t.viewBox.baseVal.height.toString()), a.innerHTML = t.innerHTML, r.naturalSize === !0 ? (a.width.baseVal.value = e.naturalWidth, a.height.baseVal.value = e.naturalHeight) : r.width !== void 0 && r.height !== void 0 && (a.width.baseVal.value = r.width, a.height.baseVal.value = r.height), n.width = a.width.baseVal.value, n.height = a.height.baseVal.value;
|
|
186
|
+
var c = a.outerHTML, p = n.getContext("2d");
|
|
187
|
+
r.markersOnly !== !0 && p.drawImage(e, 0, 0, n.width, n.height);
|
|
188
|
+
var l = window.URL, u = new Image(n.width, n.height);
|
|
189
|
+
u.setAttribute("crossOrigin", "anonymous");
|
|
190
|
+
var g = new Blob([c], { type: "image/svg+xml" }), C = l.createObjectURL(g);
|
|
191
|
+
u.onload = function() {
|
|
192
|
+
p.drawImage(u, 0, 0), l.revokeObjectURL(C);
|
|
193
|
+
var K = n.toDataURL(r.imageType, r.imageQuality);
|
|
194
|
+
i(K);
|
|
195
|
+
}, u.src = C;
|
|
196
|
+
});
|
|
197
|
+
}, o;
|
|
198
|
+
}(), O = function() {
|
|
199
|
+
}, Q = function() {
|
|
200
|
+
function o(e) {
|
|
201
|
+
this._classNamePrefixBase = "__markerjs2_", this.classes = [], this.rules = [], this.settings = this.defaultSettings, this._classNamePrefix = this._classNamePrefixBase + "_" + e + "_";
|
|
202
|
+
}
|
|
203
|
+
return Object.defineProperty(o.prototype, "classNamePrefixBase", { get: function() {
|
|
204
|
+
return this._classNamePrefixBase;
|
|
205
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "classNamePrefix", { get: function() {
|
|
206
|
+
return this._classNamePrefix;
|
|
207
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "defaultSettings", { get: function() {
|
|
208
|
+
return { canvasBackgroundColor: "#ffffff", toolbarBackgroundColor: "#111111", toolbarBackgroundHoverColor: "#333333", toolbarColor: "#eeeeee", toolbarHeight: 40, toolboxColor: "#eeeeee", toolboxAccentColor: "#3080c3", undoButtonVisible: !0, redoButtonVisible: !1, zoomButtonVisible: !1, zoomOutButtonVisible: !1, clearButtonVisible: !1, resultButtonBlockVisible: !0, logoPosition: "left" };
|
|
209
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "fadeInAnimationClassName", { get: function() {
|
|
210
|
+
return this.classNamePrefix + "fade_in";
|
|
211
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "fadeOutAnimationClassName", { get: function() {
|
|
212
|
+
return this.classNamePrefix + "fade_out";
|
|
213
|
+
}, enumerable: !1, configurable: !0 }), o.prototype.addClass = function(e) {
|
|
214
|
+
return this.styleSheet === void 0 && this.addStyleSheet(), e.name = "" + this.classNamePrefix + e.localName, this.classes.push(e), this.styleSheet.sheet.insertRule("." + e.name + " {" + e.style + "}", this.styleSheet.sheet.cssRules.length), e;
|
|
215
|
+
}, o.prototype.addRule = function(e) {
|
|
216
|
+
this.styleSheet === void 0 && this.addStyleSheet(), this.rules.push(e), this.styleSheet.sheet.insertRule(e.selector + " {" + e.style + "}", this.styleSheet.sheet.cssRules.length);
|
|
217
|
+
}, o.prototype.addStyleSheet = function() {
|
|
218
|
+
var e;
|
|
219
|
+
this.styleSheet = document.createElement("style"), ((e = this.styleSheetRoot) !== null && e !== void 0 ? e : document.head).appendChild(this.styleSheet), this.addRule(new m("." + this.classNamePrefix + " h3", "font-family: sans-serif")), this.addRule(new m("@keyframes " + this.classNamePrefix + "_fade_in_animation_frames", `
|
|
220
|
+
from {
|
|
221
|
+
opacity: 0;
|
|
222
|
+
}
|
|
223
|
+
to {
|
|
224
|
+
opacity: 1;
|
|
225
|
+
}
|
|
226
|
+
`)), this.addRule(new m("@keyframes " + this.classNamePrefix + "_fade_out_animation_frames", `
|
|
227
|
+
from {
|
|
228
|
+
opacity: 1;
|
|
229
|
+
}
|
|
230
|
+
to {
|
|
231
|
+
opacity: 0;
|
|
232
|
+
}
|
|
233
|
+
`)), this.addClass(new y("fade_in", `
|
|
234
|
+
animation-duration: 0.3s;
|
|
235
|
+
animation-name: ` + this.classNamePrefix + `_fade_in_animation_frames;
|
|
236
|
+
`)), this.addClass(new y("fade_out", `
|
|
237
|
+
animation-duration: 0.3s;
|
|
238
|
+
animation-name: ` + this.classNamePrefix + `_fade_out_animation_frames;
|
|
239
|
+
`));
|
|
240
|
+
}, o.prototype.removeStyleSheet = function() {
|
|
241
|
+
var e;
|
|
242
|
+
this.styleSheet && (((e = this.styleSheetRoot) !== null && e !== void 0 ? e : document.head).removeChild(this.styleSheet), this.styleSheet = void 0);
|
|
243
|
+
}, o;
|
|
244
|
+
}(), m = function(o, e) {
|
|
245
|
+
this.selector = o, this.style = e;
|
|
246
|
+
}, y = function(o, e) {
|
|
247
|
+
this.localName = o, this.style = e;
|
|
248
|
+
}, q = function() {
|
|
249
|
+
function o(e, t, s, r, i) {
|
|
250
|
+
this.buttons = [], this.markerButtons = [], this.buttonClickListeners = [], this.markerjsContainer = e, this.displayMode = t, this.markerItems = s, this.uiStyleSettings = r, this.styles = i, this.addStyles(), this.adjustLayout = this.adjustLayout.bind(this), this.overflowButtonClicked = this.overflowButtonClicked.bind(this), this.setCurrentMarker = this.setCurrentMarker.bind(this);
|
|
251
|
+
}
|
|
252
|
+
return o.prototype.show = function(e) {
|
|
253
|
+
var t = this;
|
|
254
|
+
this.uiContainer = document.createElement("div"), this.uiContainer.style.visibility = e, this.uiContainer.className = this.toolbarStyleClass.name + " " + this.styles.fadeInAnimationClassName + " " + (this.uiStyleSettings.toolbarStyleColorsClassName ? this.uiStyleSettings.toolbarStyleColorsClassName : this.toolbarStyleColorsClass.name);
|
|
255
|
+
var s = document.createElement("div");
|
|
256
|
+
s.className = this.toolbarBlockStyleClass.name, s.style.whiteSpace = "nowrap", this.uiContainer.appendChild(s), this.addActionButton(s, '<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>', "select", "Select mode"), this.addActionButton(s, '<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>', "delete", "Delete marker"), this.uiStyleSettings.clearButtonVisible && this.addActionButton(s, '<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>', "clear", "Delete all markers"), this.uiStyleSettings.undoButtonVisible && this.addActionButton(s, '<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>', "undo", "Undo"), this.uiStyleSettings.redoButtonVisible && this.addActionButton(s, '<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>', "redo", "Redo"), this.uiStyleSettings.zoomButtonVisible && this.addActionButton(s, '<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>', "zoom", "Zoom in"), this.uiStyleSettings.zoomButtonVisible && this.uiStyleSettings.zoomOutButtonVisible && this.addActionButton(s, '<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>', "zoom-out", "Zoom out"), this.uiStyleSettings.notesButtonVisible && this.addActionButton(s, '<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>', "notes", "Notes"), this.markerButtonBlock = document.createElement("div"), this.markerButtonBlock.className = this.toolbarBlockStyleClass.name, this.markerButtonBlock.style.flexGrow = "2", this.markerButtonBlock.style.textAlign = "center", this.uiContainer.appendChild(this.markerButtonBlock), this.markerButtonOverflowBlock = document.createElement("div"), this.markerButtonOverflowBlock.className = this.toolbarOverflowBlockStyleClass.name + " " + (this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName ? this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName : this.toolbarOverflowBlockStyleColorsClass.name), this.markerButtonOverflowBlock.style.display = "none", this.uiContainer.appendChild(this.markerButtonOverflowBlock), this.markerItems && (this.markerItems.forEach(function(i) {
|
|
257
|
+
var n = document.createElement("div");
|
|
258
|
+
n.className = "" + t.toolbarButtonStyleClass.name, n.setAttribute("data-type-name", i.typeName), n.setAttribute("aria-label", i.title), n.setAttribute("title", i.title), n.innerHTML = i.icon, n.addEventListener("click", function() {
|
|
259
|
+
t.markerToolbarButtonClicked(n, i);
|
|
260
|
+
}), t.buttons.push(n), t.markerButtons.push(n);
|
|
261
|
+
}), this.overflowButton = document.createElement("div"), this.overflowButton.className = this.toolbarButtonStyleClass.name + " " + (this.uiStyleSettings.toolbarButtonStyleColorsClassName ? this.uiStyleSettings.toolbarButtonStyleColorsClassName : this.toolbarButtonStyleColorsClass.name), this.overflowButton.innerHTML = '<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>', this.overflowButton.addEventListener("click", this.overflowButtonClicked), this.markerButtonBlock.appendChild(this.overflowButton));
|
|
262
|
+
var r = document.createElement("div");
|
|
263
|
+
r.className = this.toolbarBlockStyleClass.name, r.style.whiteSpace = "nowrap", r.style.display = this.uiStyleSettings.resultButtonBlockVisible !== !1 ? "" : "none", this.uiContainer.appendChild(r), this.addActionButton(r, '<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>', "render", "Save and close"), this.addActionButton(r, '<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>', "close", "Close"), this.markerjsContainer.appendChild(this.uiContainer), this.setSelectMode(), this.setCurrentMarker(), this.adjustLayout();
|
|
264
|
+
}, o.prototype.addButtonClickListener = function(e) {
|
|
265
|
+
this.buttonClickListeners.push(e);
|
|
266
|
+
}, o.prototype.removeButtonClickListener = function(e) {
|
|
267
|
+
this.buttonClickListeners.indexOf(e) > -1 && this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(e), 1);
|
|
268
|
+
}, o.prototype.setSelectMode = function() {
|
|
269
|
+
this.resetButtonStyles(), this.setActiveButton(this.buttons[0]);
|
|
270
|
+
}, o.prototype.adjustLayout = function() {
|
|
271
|
+
if (this.markerButtons && this.markerButtons.length > 0) {
|
|
272
|
+
var e = Math.floor(this.markerButtonBlock.clientWidth / this.uiStyleSettings.toolbarHeight) - 1;
|
|
273
|
+
this.markerButtonBlock.innerHTML = "", this.markerButtonOverflowBlock.innerHTML = "";
|
|
274
|
+
for (var t = 0; t < this.markerButtons.length; t++) t < e || t === e && this.markerButtons.length - 1 === e ? this.markerButtonBlock.appendChild(this.markerButtons[t]) : (t === e && this.markerButtonBlock.appendChild(this.overflowButton), this.markerButtonOverflowBlock.appendChild(this.markerButtons[t]));
|
|
275
|
+
}
|
|
276
|
+
}, o.prototype.overflowButtonClicked = function() {
|
|
277
|
+
this.markerButtonOverflowBlock.style.display !== "none" ? (this.markerButtonOverflowBlock.className = this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName, ""), this.markerButtonOverflowBlock.style.display = "none") : (this.markerButtonOverflowBlock.className += " " + this.styles.fadeInAnimationClassName, this.markerButtonOverflowBlock.style.top = this.uiContainer.offsetTop + this.overflowButton.offsetHeight + "px", this.markerButtonOverflowBlock.style.right = this.uiContainer.offsetWidth - this.overflowButton.offsetLeft - this.overflowButton.offsetWidth + 2 * this.uiContainer.offsetLeft + "px", this.markerButtonOverflowBlock.style.display = "inline-block");
|
|
278
|
+
}, o.prototype.resetButtonStyles = function() {
|
|
279
|
+
var e = this;
|
|
280
|
+
this.buttons.forEach(function(t) {
|
|
281
|
+
t.className = t.className.replace(e.uiStyleSettings.toolbarButtonStyleColorsClassName ? e.uiStyleSettings.toolbarButtonStyleColorsClassName : e.toolbarButtonStyleColorsClass.name, "").trim(), t.className = t.className.replace(e.uiStyleSettings.toolbarActiveButtonStyleColorsClassName ? e.uiStyleSettings.toolbarActiveButtonStyleColorsClassName : e.toolbarActiveButtonStyleColorsClass.name, "").trim(), t.className += " " + (e.uiStyleSettings.toolbarButtonStyleColorsClassName ? e.uiStyleSettings.toolbarButtonStyleColorsClassName : e.toolbarButtonStyleColorsClass.name);
|
|
282
|
+
});
|
|
283
|
+
}, o.prototype.addActionButton = function(e, t, s, r) {
|
|
284
|
+
var i = this, n = document.createElement("div");
|
|
285
|
+
switch (n.className = "" + this.toolbarButtonStyleClass.name, n.innerHTML = t, n.setAttribute("role", "button"), n.setAttribute("data-action", s), n.title = r, n.setAttribute("aria-label", r), n.addEventListener("click", function() {
|
|
286
|
+
i.actionToolbarButtonClicked(n, s);
|
|
287
|
+
}), s) {
|
|
288
|
+
case "select":
|
|
289
|
+
n.style.fill = this.uiStyleSettings.selectButtonColor;
|
|
290
|
+
break;
|
|
291
|
+
case "delete":
|
|
292
|
+
case "clear":
|
|
293
|
+
n.style.fill = this.uiStyleSettings.deleteButtonColor;
|
|
294
|
+
break;
|
|
295
|
+
case "undo":
|
|
296
|
+
case "redo":
|
|
297
|
+
n.style.fill = this.uiStyleSettings.selectButtonColor;
|
|
298
|
+
break;
|
|
299
|
+
case "render":
|
|
300
|
+
n.style.fill = this.uiStyleSettings.okButtonColor;
|
|
301
|
+
break;
|
|
302
|
+
case "close":
|
|
303
|
+
n.style.fill = this.uiStyleSettings.closeButtonColor;
|
|
304
|
+
}
|
|
305
|
+
e.appendChild(n), this.buttons.push(n);
|
|
306
|
+
}, o.prototype.addStyles = function() {
|
|
307
|
+
this.toolbarStyleClass = this.styles.addClass(new y("toolbar", `
|
|
308
|
+
width: 100%;
|
|
309
|
+
flex-shrink: 0;
|
|
310
|
+
display: flex;
|
|
311
|
+
flex-direction: row;
|
|
312
|
+
justify-content: space-between;
|
|
313
|
+
height: ` + this.uiStyleSettings.toolbarHeight + `px;
|
|
314
|
+
box-sizing: content-box;
|
|
315
|
+
` + (this.displayMode === "inline" ? "border-top-left-radius: " + Math.round(this.uiStyleSettings.toolbarHeight / 10) + "px;" : "") + `
|
|
316
|
+
` + (this.displayMode === "inline" ? "border-top-right-radius: " + Math.round(this.uiStyleSettings.toolbarHeight / 10) + "px;" : "") + `
|
|
317
|
+
overflow: hidden;
|
|
318
|
+
`)), this.toolbarStyleColorsClass = this.styles.addClass(new y("toolbar_colors", `
|
|
319
|
+
background-color: ` + this.uiStyleSettings.toolbarBackgroundColor + `;
|
|
320
|
+
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
321
|
+
`)), this.toolbarBlockStyleClass = this.styles.addClass(new y("toolbar-block", `
|
|
322
|
+
display: inline-block;
|
|
323
|
+
box-sizing: content-box;
|
|
324
|
+
`)), this.toolbarOverflowBlockStyleClass = this.styles.addClass(new y("toolbar-overflow-block", `
|
|
325
|
+
position: absolute;
|
|
326
|
+
top: ` + this.uiStyleSettings.toolbarHeight + `px;
|
|
327
|
+
max-width: ` + 2 * this.uiStyleSettings.toolbarHeight + `px;
|
|
328
|
+
z-index: 10;
|
|
329
|
+
box-sizing: content-box;
|
|
330
|
+
`)), this.toolbarOverflowBlockStyleColorsClass = this.styles.addClass(new y("toolbar-overflow-block_colors", `
|
|
331
|
+
background-color: ` + this.uiStyleSettings.toolbarBackgroundColor + `;
|
|
332
|
+
`));
|
|
333
|
+
var e = this.uiStyleSettings.toolbarHeight / 4;
|
|
334
|
+
this.toolbarButtonStyleClass = this.styles.addClass(new y("toolbar_button", `
|
|
335
|
+
display: inline-block;
|
|
336
|
+
width: ` + (this.uiStyleSettings.toolbarHeight - 2 * e) + `px;
|
|
337
|
+
height: ` + (this.uiStyleSettings.toolbarHeight - 2 * e) + `px;
|
|
338
|
+
padding: ` + e + `px;
|
|
339
|
+
box-sizing: content-box;
|
|
340
|
+
`)), this.toolbarButtonStyleColorsClass = this.styles.addClass(new y("toolbar_button_colors", `
|
|
341
|
+
fill: ` + this.uiStyleSettings.toolbarColor + `;
|
|
342
|
+
`)), this.toolbarActiveButtonStyleColorsClass = this.styles.addClass(new y("toolbar_active_button", `
|
|
343
|
+
fill: ` + this.uiStyleSettings.toolbarColor + `;
|
|
344
|
+
background-color: ` + this.uiStyleSettings.toolbarBackgroundHoverColor + `
|
|
345
|
+
`)), this.styles.addRule(new m("." + this.toolbarButtonStyleClass.name + " svg", `
|
|
346
|
+
height: ` + this.uiStyleSettings.toolbarHeight / 2 + `px;
|
|
347
|
+
`)), this.styles.addRule(new m("." + this.toolbarButtonStyleColorsClass.name + ":hover", `
|
|
348
|
+
background-color: ` + this.uiStyleSettings.toolbarBackgroundHoverColor + `
|
|
349
|
+
`));
|
|
350
|
+
}, o.prototype.markerToolbarButtonClicked = function(e, t) {
|
|
351
|
+
this.setActiveButton(e), this.buttonClickListeners && this.buttonClickListeners.length > 0 && this.buttonClickListeners.forEach(function(s) {
|
|
352
|
+
return s("marker", t);
|
|
353
|
+
}), this.markerButtonOverflowBlock.style.display = "none";
|
|
354
|
+
}, o.prototype.actionToolbarButtonClicked = function(e, t) {
|
|
355
|
+
this.buttonClickListeners && this.buttonClickListeners.length > 0 && this.buttonClickListeners.forEach(function(s) {
|
|
356
|
+
return s("action", t);
|
|
357
|
+
}), this.markerButtonOverflowBlock.style.display = "none", this.setActiveButton(this.buttons[0]);
|
|
358
|
+
}, o.prototype.setActiveButton = function(e) {
|
|
359
|
+
this.resetButtonStyles(), e.className = e.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName ? this.uiStyleSettings.toolbarButtonStyleColorsClassName : this.toolbarButtonStyleColorsClass.name, "").trim(), e.className += " " + (this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName ? this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName : this.toolbarActiveButtonStyleColorsClass.name);
|
|
360
|
+
}, o.prototype.setActiveMarkerButton = function(e) {
|
|
361
|
+
var t = this.markerButtons.find(function(s) {
|
|
362
|
+
return s.getAttribute("data-type-name") === e;
|
|
363
|
+
});
|
|
364
|
+
t && this.setActiveButton(t);
|
|
365
|
+
}, o.prototype.setCurrentMarker = function(e) {
|
|
366
|
+
var t = this;
|
|
367
|
+
this.currentMarker = e, this.buttons.filter(function(s) {
|
|
368
|
+
return /delete|notes/.test(s.getAttribute("data-action"));
|
|
369
|
+
}).forEach(function(s) {
|
|
370
|
+
t.currentMarker === void 0 ? (s.style.fillOpacity = "0.4", s.style.pointerEvents = "none") : (s.style.fillOpacity = "1", s.style.pointerEvents = "all");
|
|
371
|
+
});
|
|
372
|
+
}, o;
|
|
373
|
+
}(), $ = function() {
|
|
374
|
+
function o(e, t, s, r) {
|
|
375
|
+
this.panels = [], this.panelButtons = [], this.markerjsContainer = e, this.displayMode = t, this.uiStyleSettings = s, this.styles = r, this.panelButtonClick = this.panelButtonClick.bind(this), this.addStyles();
|
|
376
|
+
}
|
|
377
|
+
return o.prototype.addStyles = function() {
|
|
378
|
+
var e;
|
|
379
|
+
this.toolboxStyleClass = this.styles.addClass(new y("toolbox", `
|
|
380
|
+
width: 100%;
|
|
381
|
+
flex-shrink: 0;
|
|
382
|
+
display: flex;
|
|
383
|
+
flex-direction: column;
|
|
384
|
+
font-family: sans-serif;
|
|
385
|
+
` + (this.displayMode === "popup" ? "height:" + 2.5 * this.uiStyleSettings.toolbarHeight + "px;" : "") + `
|
|
386
|
+
box-sizing: content-box;
|
|
387
|
+
` + (this.displayMode === "popup" ? "background-color: " + this.uiStyleSettings.canvasBackgroundColor + ";" : "") + `
|
|
388
|
+
` + (this.displayMode === "inline" ? "border-bottom-left-radius: " + Math.round(this.uiStyleSettings.toolbarHeight / 10) + "px;" : "") + `
|
|
389
|
+
` + (this.displayMode === "inline" ? "border-bottom-right-radius: " + Math.round(this.uiStyleSettings.toolbarHeight / 10) + "px;" : "") + `
|
|
390
|
+
overflow: hidden;
|
|
391
|
+
`)), this.toolboxStyleColorsClass = this.styles.addClass(new y("toolbox_colors", `
|
|
392
|
+
color: ` + this.uiStyleSettings.toolboxColor + `;
|
|
393
|
+
`));
|
|
394
|
+
var t = this.uiStyleSettings.toolbarHeight / 4;
|
|
395
|
+
this.toolboxButtonRowStyleClass = this.styles.addClass(new y("toolbox-button-row", `
|
|
396
|
+
display: flex;
|
|
397
|
+
cursor: default;
|
|
398
|
+
box-sizing: content-box;
|
|
399
|
+
`)), this.toolboxButtonRowStyleColorsClass = this.styles.addClass(new y("toolbox-button-row_colors", `
|
|
400
|
+
background-color: ` + this.uiStyleSettings.toolbarBackgroundColor + `;
|
|
401
|
+
`)), this.toolboxPanelRowStyleClass = this.styles.addClass(new y("toolbox-panel-row", `
|
|
402
|
+
display: flex;
|
|
403
|
+
` + (this.displayMode === "inline" ? "position: absolute;" : "") + `
|
|
404
|
+
` + (this.displayMode === "inline" ? "bottom: " + this.uiStyleSettings.toolbarHeight + "px;" : "") + `
|
|
405
|
+
cursor: default;
|
|
406
|
+
height: ` + 1.5 * this.uiStyleSettings.toolbarHeight + `px;
|
|
407
|
+
` + (this.displayMode === "inline" ? "width: 100%;" : "") + `
|
|
408
|
+
box-sizing: content-box;
|
|
409
|
+
`)), this.toolboxPanelRowStyleColorsClass = this.styles.addClass(new y("toolbox-panel-row_colors", `
|
|
410
|
+
background-color: ` + ((e = this.uiStyleSettings.toolboxBackgroundColor) !== null && e !== void 0 ? e : this.uiStyleSettings.toolbarBackgroundHoverColor) + `;
|
|
411
|
+
`)), this.toolboxButtonStyleClass = this.styles.addClass(new y("toolbox_button", `
|
|
412
|
+
display: inline-block;
|
|
413
|
+
width: ` + (this.uiStyleSettings.toolbarHeight - 2 * t) + `px;
|
|
414
|
+
height: ` + (this.uiStyleSettings.toolbarHeight - 2 * t) + `px;
|
|
415
|
+
padding: ` + t + `px;
|
|
416
|
+
box-sizing: content-box;
|
|
417
|
+
`)), this.toolboxButtonStyleColorsClass = this.styles.addClass(new y("toolbox-button_colors", `
|
|
418
|
+
fill: ` + this.uiStyleSettings.toolbarColor + `;
|
|
419
|
+
`)), this.toolboxActiveButtonStyleColorsClass = this.styles.addClass(new y("toolbox-active-button_colors", `
|
|
420
|
+
background-color: ` + this.uiStyleSettings.toolbarBackgroundHoverColor + `;
|
|
421
|
+
fill: ` + this.uiStyleSettings.toolbarColor + `;
|
|
422
|
+
`)), this.styles.addRule(new m("." + this.toolboxButtonStyleColorsClass.name + ":hover", `
|
|
423
|
+
background-color: ` + this.uiStyleSettings.toolbarBackgroundHoverColor + `
|
|
424
|
+
`)), this.styles.addRule(new m("." + this.toolboxButtonStyleClass.name + " svg", `
|
|
425
|
+
height: ` + this.uiStyleSettings.toolbarHeight / 2 + `px;
|
|
426
|
+
`)), this.styles.addRule(new m("." + this.toolboxPanelRowStyleClass.name + " > div", `
|
|
427
|
+
scrollbar-width: thin;
|
|
428
|
+
`)), this.styles.addRule(new m("." + this.toolboxPanelRowStyleClass.name + " > div::-webkit-scrollbar", `
|
|
429
|
+
height: 10px;
|
|
430
|
+
width: 10px;
|
|
431
|
+
`)), this.styles.addRule(new m("." + this.toolboxPanelRowStyleClass.name + " > div::-webkit-scrollbar-track", `
|
|
432
|
+
background-color: transparent;
|
|
433
|
+
`)), this.styles.addRule(new m("." + this.toolboxPanelRowStyleClass.name + " > div::-webkit-scrollbar-thumb", `
|
|
434
|
+
background-color: #444;
|
|
435
|
+
border-radius: 20px;
|
|
436
|
+
border: 2px solid #aaa;
|
|
437
|
+
`));
|
|
438
|
+
}, o.prototype.show = function(e) {
|
|
439
|
+
var t;
|
|
440
|
+
this.uiContainer = document.createElement("div"), this.uiContainer.style.visibility = e, this.uiContainer.className = this.toolboxStyleClass.name + " " + ((t = this.uiStyleSettings.toolboxStyleColorsClassName) !== null && t !== void 0 ? t : this.toolboxStyleColorsClass.name), this.markerjsContainer.appendChild(this.uiContainer);
|
|
441
|
+
}, o.prototype.setPanelButtons = function(e) {
|
|
442
|
+
var t, s, r = this;
|
|
443
|
+
this.panels = e, this.uiContainer !== void 0 && (this.uiContainer.innerHTML = "", this.panelRow = document.createElement("div"), this.panelRow.className = this.toolboxPanelRowStyleClass.name + " " + ((t = this.uiStyleSettings.toolboxPanelRowStyleColorsClassName) !== null && t !== void 0 ? t : this.toolboxPanelRowStyleColorsClass.name), this.uiContainer.appendChild(this.panelRow), this.buttonRow = document.createElement("div"), this.buttonRow.className = this.toolboxButtonRowStyleClass.name + " " + ((s = this.uiStyleSettings.toolboxButtonRowStyleColorsClassName) !== null && s !== void 0 ? s : this.toolboxButtonRowStyleColorsClass.name) + " ", this.uiContainer.appendChild(this.buttonRow), this.panelButtons.splice(0), this.panels.forEach(function(i) {
|
|
444
|
+
var n;
|
|
445
|
+
i.uiStyleSettings = r.uiStyleSettings;
|
|
446
|
+
var a = document.createElement("div");
|
|
447
|
+
a.className = r.toolboxButtonStyleClass.name + " " + ((n = r.uiStyleSettings.toolboxButtonStyleColorsClassName) !== null && n !== void 0 ? n : r.toolboxButtonStyleColorsClass.name), a.innerHTML = i.icon, a.title = i.title, a.setAttribute("role", "button"), a.setAttribute("aria-label", i.title), i.id && a.setAttribute("data-action", i.id), a.addEventListener("click", function() {
|
|
448
|
+
r.panelButtonClick(i);
|
|
449
|
+
}), r.panelButtons.push(a), r.buttonRow.appendChild(a);
|
|
450
|
+
}), this.displayMode === "inline" ? this.panelRow.style.display = "none" : this.panelRow.style.visibility = "hidden");
|
|
451
|
+
}, o.prototype.panelButtonClick = function(e) {
|
|
452
|
+
var t = this, s = -1;
|
|
453
|
+
if (e !== this.activePanel) {
|
|
454
|
+
s = this.panels.indexOf(e), this.panelRow.innerHTML = "";
|
|
455
|
+
var r = e.getUi();
|
|
456
|
+
r.style.margin = this.uiStyleSettings.toolbarHeight / 4 + "px", this.panelRow.appendChild(r), this.panelRow.style.display = "flex", this.panelRow.style.visibility = "visible", this.panelRow.className = this.panelRow.className.replace(this.styles.fadeOutAnimationClassName, ""), this.panelRow.className += " " + this.styles.fadeInAnimationClassName, this.activePanel = e;
|
|
457
|
+
} else this.activePanel = void 0, this.panelRow.className = this.panelRow.className.replace(this.styles.fadeInAnimationClassName, ""), this.panelRow.className += " " + this.styles.fadeOutAnimationClassName, setTimeout(function() {
|
|
458
|
+
t.displayMode === "inline" ? t.panelRow.style.display = "none" : t.panelRow.style.visibility = "hidden";
|
|
459
|
+
}, 200);
|
|
460
|
+
this.panelButtons.forEach(function(i, n) {
|
|
461
|
+
var a, c;
|
|
462
|
+
i.className = t.toolboxButtonStyleClass.name + " " + (n === s ? "" + ((a = t.uiStyleSettings.toolboxActiveButtonStyleColorsClassName) !== null && a !== void 0 ? a : t.toolboxActiveButtonStyleColorsClass.name) : "" + ((c = t.uiStyleSettings.toolboxButtonStyleColorsClassName) !== null && c !== void 0 ? c : t.toolboxButtonStyleColorsClass.name));
|
|
463
|
+
});
|
|
464
|
+
}, o;
|
|
465
|
+
}(), x = function() {
|
|
466
|
+
function o(e, t, s) {
|
|
467
|
+
this.title = e, this.icon = t, this._id = s;
|
|
468
|
+
}
|
|
469
|
+
return Object.defineProperty(o.prototype, "id", { get: function() {
|
|
470
|
+
return this._id;
|
|
471
|
+
}, enumerable: !1, configurable: !0 }), o;
|
|
472
|
+
}(), f = function(o) {
|
|
473
|
+
function e(t, s, r, i, n) {
|
|
474
|
+
var a = o.call(this, t, i || '<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>', n || "color-picker-panel") || this;
|
|
475
|
+
return a.colors = [], a.addTransparent = !1, a.colorBoxes = [], a.colors = s, a.currentColor = r, a.setCurrentColor = a.setCurrentColor.bind(a), a.getColorBox = a.getColorBox.bind(a), a;
|
|
476
|
+
}
|
|
477
|
+
return d(e, o), e.prototype.getUi = function() {
|
|
478
|
+
var t = this, s = document.createElement("div");
|
|
479
|
+
return s.style.overflow = "hidden", s.style.overflowX = "auto", s.style.whiteSpace = "nowrap", this.colors.forEach(function(r) {
|
|
480
|
+
var i = t.getColorBox(r);
|
|
481
|
+
s.appendChild(i), t.colorBoxes.push(i);
|
|
482
|
+
}), s;
|
|
483
|
+
}, e.prototype.getColorBox = function(t) {
|
|
484
|
+
var s = this, r = this.uiStyleSettings.toolbarHeight / 4, i = this.uiStyleSettings.toolbarHeight - r, n = document.createElement("div");
|
|
485
|
+
n.style.display = "inline-block", n.style.boxSizing = "content-box", n.style.width = i - 2 + "px", n.style.height = i - 2 + "px", n.style.padding = "1px", n.style.marginRight = "2px", n.style.marginBottom = "2px", n.style.borderWidth = "2px", n.style.borderStyle = "solid", n.style.borderRadius = (i + 2) / 2 + "px", n.style.borderColor = t === this.currentColor ? this.uiStyleSettings.toolboxAccentColor : "transparent", n.addEventListener("click", function() {
|
|
486
|
+
s.setCurrentColor(t, n);
|
|
487
|
+
});
|
|
488
|
+
var a = document.createElement("div");
|
|
489
|
+
return a.style.display = "inline-block", a.style.width = i - 2 + "px", a.style.height = i - 2 + "px", a.style.backgroundColor = t, a.style.borderRadius = i / 2 + "px", t === "transparent" && (a.style.fill = this.uiStyleSettings.toolboxAccentColor, a.innerHTML = `<svg viewBox="0 0 24 24">
|
|
490
|
+
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
491
|
+
</svg>`), n.appendChild(a), n;
|
|
492
|
+
}, e.prototype.setCurrentColor = function(t, s) {
|
|
493
|
+
var r = this;
|
|
494
|
+
this.currentColor = t, this.colorBoxes.forEach(function(i) {
|
|
495
|
+
i.style.borderColor = i === s ? r.uiStyleSettings.toolboxAccentColor : "transparent";
|
|
496
|
+
}), this.onColorChanged && this.onColorChanged(t);
|
|
497
|
+
}, e;
|
|
498
|
+
}(x), F = function() {
|
|
499
|
+
function o(e, t, s) {
|
|
500
|
+
this._state = "new", this._isSelected = !1, this._container = e, this._overlayContainer = t, this.globalSettings = s, this.stateChanged = this.stateChanged.bind(this), this.colorChanged = this.colorChanged.bind(this), this.fillColorChanged = this.fillColorChanged.bind(this);
|
|
501
|
+
}
|
|
502
|
+
return Object.defineProperty(o.prototype, "typeName", { get: function() {
|
|
503
|
+
return Object.getPrototypeOf(this).constructor.typeName;
|
|
504
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "container", { get: function() {
|
|
505
|
+
return this._container;
|
|
506
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "overlayContainer", { get: function() {
|
|
507
|
+
return this._overlayContainer;
|
|
508
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "state", { get: function() {
|
|
509
|
+
return this._state;
|
|
510
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "toolboxPanels", { get: function() {
|
|
511
|
+
return [];
|
|
512
|
+
}, enumerable: !1, configurable: !0 }), o.prototype.ownsTarget = function(e) {
|
|
513
|
+
return !1;
|
|
514
|
+
}, Object.defineProperty(o.prototype, "isSelected", { get: function() {
|
|
515
|
+
return this._isSelected;
|
|
516
|
+
}, enumerable: !1, configurable: !0 }), o.prototype.select = function() {
|
|
517
|
+
this.container.style.cursor = "move", this._isSelected = !0, this.manipulationStartState = this.getState();
|
|
518
|
+
}, o.prototype.deselect = function() {
|
|
519
|
+
this.container.style.cursor = "default", this._isSelected = !1, this.stateChanged();
|
|
520
|
+
}, o.prototype.pointerDown = function(e, t) {
|
|
521
|
+
}, o.prototype.dblClick = function(e, t) {
|
|
522
|
+
}, o.prototype.manipulate = function(e) {
|
|
523
|
+
}, o.prototype.pointerUp = function(e) {
|
|
524
|
+
this.stateChanged();
|
|
525
|
+
}, o.prototype.dispose = function() {
|
|
526
|
+
}, o.prototype.addMarkerVisualToContainer = function(e) {
|
|
527
|
+
this.container.childNodes.length > 0 ? this.container.insertBefore(e, this.container.childNodes[0]) : this.container.appendChild(e);
|
|
528
|
+
}, o.prototype.getState = function() {
|
|
529
|
+
return { typeName: o.typeName, state: this.state, notes: this.notes };
|
|
530
|
+
}, o.prototype.restoreState = function(e) {
|
|
531
|
+
this._state = e.state, this.notes = e.notes;
|
|
532
|
+
}, o.prototype.scale = function(e, t) {
|
|
533
|
+
}, o.prototype.colorChanged = function(e) {
|
|
534
|
+
this.onColorChanged && this.onColorChanged(e), this.stateChanged();
|
|
535
|
+
}, o.prototype.fillColorChanged = function(e) {
|
|
536
|
+
this.onFillColorChanged && this.onFillColorChanged(e), this.stateChanged();
|
|
537
|
+
}, o.prototype.stateChanged = function() {
|
|
538
|
+
if (this.onStateChanged && this.state !== "creating" && this.state !== "new") {
|
|
539
|
+
var e = this.getState();
|
|
540
|
+
this.manipulationStartState !== void 0 && (this.manipulationStartState.state = "select"), e.state = "select", JSON.stringify(this.manipulationStartState) != JSON.stringify(e) && this.onStateChanged(this);
|
|
541
|
+
}
|
|
542
|
+
}, o.typeName = "MarkerBase", o;
|
|
543
|
+
}(), tt = function() {
|
|
544
|
+
function o() {
|
|
545
|
+
this.findGripByVisual = this.findGripByVisual.bind(this);
|
|
546
|
+
}
|
|
547
|
+
return o.prototype.findGripByVisual = function(e) {
|
|
548
|
+
return this.topLeft.ownsTarget(e) ? this.topLeft : this.topCenter.ownsTarget(e) ? this.topCenter : this.topRight.ownsTarget(e) ? this.topRight : this.centerLeft.ownsTarget(e) ? this.centerLeft : this.centerRight.ownsTarget(e) ? this.centerRight : this.bottomLeft.ownsTarget(e) ? this.bottomLeft : this.bottomCenter.ownsTarget(e) ? this.bottomCenter : this.bottomRight.ownsTarget(e) ? this.bottomRight : void 0;
|
|
549
|
+
}, o;
|
|
550
|
+
}(), _ = function() {
|
|
551
|
+
function o() {
|
|
552
|
+
this.GRIP_SIZE = 10, this.visual = h.createGroup(), this.visual.appendChild(h.createCircle(1.5 * this.GRIP_SIZE, [["fill", "transparent"]])), this.visual.appendChild(h.createCircle(this.GRIP_SIZE, [["fill", "#cccccc"], ["fill-opacity", "0.7"], ["stroke", "#333333"], ["stroke-width", "2"], ["stroke-opacity", "0.7"]]));
|
|
553
|
+
}
|
|
554
|
+
return o.prototype.ownsTarget = function(e) {
|
|
555
|
+
return e === this.visual || e === this.visual.childNodes[0] || e === this.visual.childNodes[1];
|
|
556
|
+
}, o;
|
|
557
|
+
}(), T = function() {
|
|
558
|
+
function o() {
|
|
559
|
+
}
|
|
560
|
+
return o.toITransformMatrix = function(e) {
|
|
561
|
+
return { a: e.a, b: e.b, c: e.c, d: e.d, e: e.e, f: e.f };
|
|
562
|
+
}, o.toSVGMatrix = function(e, t) {
|
|
563
|
+
return e.a = t.a, e.b = t.b, e.c = t.c, e.d = t.d, e.e = t.e, e.f = t.f, e;
|
|
564
|
+
}, o;
|
|
565
|
+
}(), B = function(o) {
|
|
566
|
+
function e(t, s, r) {
|
|
567
|
+
var i = o.call(this, t, s, r) || this;
|
|
568
|
+
return i.left = 0, i.top = 0, i.width = 0, i.height = 0, i.defaultSize = { x: 50, y: 20 }, i.offsetX = 0, i.offsetY = 0, i.rotationAngle = 0, i.CB_DISTANCE = 10, i._suppressMarkerCreateEvent = !1, i.container.transform.baseVal.appendItem(h.createTransform()), i.setupControlBox(), i;
|
|
569
|
+
}
|
|
570
|
+
return d(e, o), Object.defineProperty(e.prototype, "centerX", { get: function() {
|
|
571
|
+
return this.left + this.width / 2;
|
|
572
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "centerY", { get: function() {
|
|
573
|
+
return this.top + this.height / 2;
|
|
574
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "visual", { get: function() {
|
|
575
|
+
return this._visual;
|
|
576
|
+
}, set: function(t) {
|
|
577
|
+
this._visual = t;
|
|
578
|
+
var s = h.createTransform();
|
|
579
|
+
this._visual.transform.baseVal.appendItem(s);
|
|
580
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.ownsTarget = function(t) {
|
|
581
|
+
return !!o.prototype.ownsTarget.call(this, t) || !!(this.controlGrips.findGripByVisual(t) !== void 0 || this.rotatorGrip !== void 0 && this.rotatorGrip.ownsTarget(t));
|
|
582
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
583
|
+
o.prototype.pointerDown.call(this, t, s), this.state === "new" && (this.left = t.x, this.top = t.y), this.manipulationStartLeft = this.left, this.manipulationStartTop = this.top, this.manipulationStartWidth = this.width, this.manipulationStartHeight = this.height;
|
|
584
|
+
var r = this.unrotatePoint(t);
|
|
585
|
+
if (this.manipulationStartX = r.x, this.manipulationStartY = r.y, this.offsetX = r.x - this.left, this.offsetY = r.y - this.top, this.state !== "new") if (this.select(), this.activeGrip = this.controlGrips.findGripByVisual(s), this.activeGrip !== void 0) this._state = "resize";
|
|
586
|
+
else if (this.rotatorGrip !== void 0 && this.rotatorGrip.ownsTarget(s)) {
|
|
587
|
+
this.activeGrip = this.rotatorGrip;
|
|
588
|
+
var i = this.rotatePoint({ x: this.centerX, y: this.centerY });
|
|
589
|
+
this.left = i.x - this.width / 2, this.top = i.y - this.height / 2, this.moveVisual({ x: this.left, y: this.top });
|
|
590
|
+
var n = this.container.transform.baseVal.getItem(0);
|
|
591
|
+
n.setRotate(this.rotationAngle, this.centerX, this.centerY), this.container.transform.baseVal.replaceItem(n, 0), this.adjustControlBox(), this._state = "rotate";
|
|
592
|
+
} else this._state = "move";
|
|
593
|
+
}, e.prototype.pointerUp = function(t) {
|
|
594
|
+
var s = this.state;
|
|
595
|
+
o.prototype.pointerUp.call(this, t), this.state === "creating" && this.width < 10 && this.height < 10 ? (this.width = this.defaultSize.x, this.height = this.defaultSize.y) : this.manipulate(t), this._state = "select", s === "creating" && this.onMarkerCreated && this._suppressMarkerCreateEvent === !1 && this.onMarkerCreated(this);
|
|
596
|
+
}, e.prototype.moveVisual = function(t) {
|
|
597
|
+
this.visual.style.transform = "translate(" + t.x + "px, " + t.y + "px)";
|
|
598
|
+
}, e.prototype.manipulate = function(t) {
|
|
599
|
+
var s = this.unrotatePoint(t);
|
|
600
|
+
this.state === "creating" ? this.resize(t) : this.state === "move" ? (this.left = this.manipulationStartLeft + (s.x - this.manipulationStartLeft) - this.offsetX, this.top = this.manipulationStartTop + (s.y - this.manipulationStartTop) - this.offsetY, this.moveVisual({ x: this.left, y: this.top }), this.adjustControlBox()) : this.state === "resize" ? this.resize(s) : this.state === "rotate" && this.rotate(t);
|
|
601
|
+
}, e.prototype.resize = function(t) {
|
|
602
|
+
var s = this.manipulationStartLeft, r = this.manipulationStartWidth, i = this.manipulationStartTop, n = this.manipulationStartHeight;
|
|
603
|
+
switch (this.activeGrip) {
|
|
604
|
+
case this.controlGrips.bottomLeft:
|
|
605
|
+
case this.controlGrips.centerLeft:
|
|
606
|
+
case this.controlGrips.topLeft:
|
|
607
|
+
s = this.manipulationStartLeft + t.x - this.manipulationStartX, r = this.manipulationStartWidth + this.manipulationStartLeft - s;
|
|
608
|
+
break;
|
|
609
|
+
case this.controlGrips.bottomRight:
|
|
610
|
+
case this.controlGrips.centerRight:
|
|
611
|
+
case this.controlGrips.topRight:
|
|
612
|
+
case void 0:
|
|
613
|
+
r = this.manipulationStartWidth + t.x - this.manipulationStartX;
|
|
614
|
+
}
|
|
615
|
+
switch (this.activeGrip) {
|
|
616
|
+
case this.controlGrips.topCenter:
|
|
617
|
+
case this.controlGrips.topLeft:
|
|
618
|
+
case this.controlGrips.topRight:
|
|
619
|
+
i = this.manipulationStartTop + t.y - this.manipulationStartY, n = this.manipulationStartHeight + this.manipulationStartTop - i;
|
|
620
|
+
break;
|
|
621
|
+
case this.controlGrips.bottomCenter:
|
|
622
|
+
case this.controlGrips.bottomLeft:
|
|
623
|
+
case this.controlGrips.bottomRight:
|
|
624
|
+
case void 0:
|
|
625
|
+
n = this.manipulationStartHeight + t.y - this.manipulationStartY;
|
|
626
|
+
}
|
|
627
|
+
r >= 0 ? (this.left = s, this.width = r) : (this.left = s + r, this.width = -r), n >= 0 ? (this.top = i, this.height = n) : (this.top = i + n, this.height = -n), this.setSize();
|
|
628
|
+
}, e.prototype.setSize = function() {
|
|
629
|
+
this.moveVisual({ x: this.left, y: this.top }), this.adjustControlBox();
|
|
630
|
+
}, e.prototype.rotate = function(t) {
|
|
631
|
+
if (Math.abs(t.x - this.centerX) > 0.1) {
|
|
632
|
+
var s = Math.sign(t.x - this.centerX);
|
|
633
|
+
this.rotationAngle = 180 * Math.atan((t.y - this.centerY) / (t.x - this.centerX)) / Math.PI + 90 * s, this.applyRotation();
|
|
634
|
+
}
|
|
635
|
+
}, e.prototype.applyRotation = function() {
|
|
636
|
+
var t = this.container.transform.baseVal.getItem(0);
|
|
637
|
+
t.setRotate(this.rotationAngle, this.centerX, this.centerY), this.container.transform.baseVal.replaceItem(t, 0);
|
|
638
|
+
}, e.prototype.rotatePoint = function(t) {
|
|
639
|
+
if (this.rotationAngle === 0) return t;
|
|
640
|
+
var s = this.container.getCTM(), r = h.createPoint(t.x, t.y);
|
|
641
|
+
return { x: (r = r.matrixTransform(s)).x, y: r.y };
|
|
642
|
+
}, e.prototype.unrotatePoint = function(t) {
|
|
643
|
+
if (this.rotationAngle === 0) return t;
|
|
644
|
+
var s = this.container.getCTM();
|
|
645
|
+
s = s.inverse();
|
|
646
|
+
var r = h.createPoint(t.x, t.y);
|
|
647
|
+
return { x: (r = r.matrixTransform(s)).x, y: r.y };
|
|
648
|
+
}, e.prototype.select = function() {
|
|
649
|
+
o.prototype.select.call(this), this.adjustControlBox(), this.controlBox.style.display = "";
|
|
650
|
+
}, e.prototype.deselect = function() {
|
|
651
|
+
o.prototype.deselect.call(this), this.controlBox.style.display = "none";
|
|
652
|
+
}, e.prototype.setupControlBox = function() {
|
|
653
|
+
this.controlBox = h.createGroup();
|
|
654
|
+
var t = h.createTransform();
|
|
655
|
+
t.setTranslate(-this.CB_DISTANCE / 2, -this.CB_DISTANCE / 2), this.controlBox.transform.baseVal.appendItem(t), this.container.appendChild(this.controlBox), this.controlRect = h.createRect(this.width + this.CB_DISTANCE, this.height + this.CB_DISTANCE, [["stroke", "black"], ["stroke-width", "1"], ["stroke-opacity", "0.5"], ["stroke-dasharray", "3, 2"], ["fill", "transparent"], ["pointer-events", "none"]]), this.controlBox.appendChild(this.controlRect), this.globalSettings.disableRotation !== !0 && (this.rotatorGripLine = h.createLine((this.width + 2 * this.CB_DISTANCE) / 2, this.top - this.CB_DISTANCE, (this.width + 2 * this.CB_DISTANCE) / 2, this.top - 3 * this.CB_DISTANCE, [["stroke", "black"], ["stroke-width", "1"], ["stroke-opacity", "0.5"], ["stroke-dasharray", "3, 2"]]), this.controlBox.appendChild(this.rotatorGripLine)), this.controlGrips = new tt(), this.addControlGrips(), this.controlBox.style.display = "none";
|
|
656
|
+
}, e.prototype.adjustControlBox = function() {
|
|
657
|
+
var t = this.controlBox.transform.baseVal.getItem(0);
|
|
658
|
+
t.setTranslate(this.left - this.CB_DISTANCE / 2, this.top - this.CB_DISTANCE / 2), this.controlBox.transform.baseVal.replaceItem(t, 0), this.controlRect.setAttribute("width", (this.width + this.CB_DISTANCE).toString()), this.controlRect.setAttribute("height", (this.height + this.CB_DISTANCE).toString()), this.rotatorGripLine !== void 0 && (this.rotatorGripLine.setAttribute("x1", ((this.width + this.CB_DISTANCE) / 2).toString()), this.rotatorGripLine.setAttribute("y1", (-this.CB_DISTANCE / 2).toString()), this.rotatorGripLine.setAttribute("x2", ((this.width + this.CB_DISTANCE) / 2).toString()), this.rotatorGripLine.setAttribute("y2", (3 * -this.CB_DISTANCE).toString())), this.positionGrips();
|
|
659
|
+
}, e.prototype.addControlGrips = function() {
|
|
660
|
+
this.controlGrips.topLeft = this.createGrip(), this.controlGrips.topCenter = this.createGrip(), this.controlGrips.topRight = this.createGrip(), this.controlGrips.centerLeft = this.createGrip(), this.controlGrips.centerRight = this.createGrip(), this.controlGrips.bottomLeft = this.createGrip(), this.controlGrips.bottomCenter = this.createGrip(), this.controlGrips.bottomRight = this.createGrip(), this.globalSettings.disableRotation !== !0 && (this.rotatorGrip = this.createGrip()), this.positionGrips();
|
|
661
|
+
}, e.prototype.createGrip = function() {
|
|
662
|
+
var t = new _();
|
|
663
|
+
return t.visual.transform.baseVal.appendItem(h.createTransform()), this.controlBox.appendChild(t.visual), t;
|
|
664
|
+
}, e.prototype.positionGrips = function() {
|
|
665
|
+
var t = this.controlGrips.topLeft.GRIP_SIZE, s = -t / 2, r = s, i = (this.width + this.CB_DISTANCE) / 2 - t / 2, n = (this.height + this.CB_DISTANCE) / 2 - t / 2, a = this.height + this.CB_DISTANCE - t / 2, c = this.width + this.CB_DISTANCE - t / 2;
|
|
666
|
+
this.positionGrip(this.controlGrips.topLeft.visual, s, r), this.positionGrip(this.controlGrips.topCenter.visual, i, r), this.positionGrip(this.controlGrips.topRight.visual, c, r), this.positionGrip(this.controlGrips.centerLeft.visual, s, n), this.positionGrip(this.controlGrips.centerRight.visual, c, n), this.positionGrip(this.controlGrips.bottomLeft.visual, s, a), this.positionGrip(this.controlGrips.bottomCenter.visual, i, a), this.positionGrip(this.controlGrips.bottomRight.visual, c, a), this.rotatorGrip !== void 0 && this.positionGrip(this.rotatorGrip.visual, i, r - 3 * this.CB_DISTANCE);
|
|
667
|
+
}, e.prototype.positionGrip = function(t, s, r) {
|
|
668
|
+
var i = t.transform.baseVal.getItem(0);
|
|
669
|
+
i.setTranslate(s, r), t.transform.baseVal.replaceItem(i, 0);
|
|
670
|
+
}, e.prototype.hideControlBox = function() {
|
|
671
|
+
this.controlBox.style.display = "none";
|
|
672
|
+
}, e.prototype.showControlBox = function() {
|
|
673
|
+
this.controlBox.style.display = "";
|
|
674
|
+
}, e.prototype.getState = function() {
|
|
675
|
+
return Object.assign({ left: this.left, top: this.top, width: this.width, height: this.height, rotationAngle: this.rotationAngle, visualTransformMatrix: T.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix), containerTransformMatrix: T.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix) }, o.prototype.getState.call(this));
|
|
676
|
+
}, e.prototype.restoreState = function(t) {
|
|
677
|
+
o.prototype.restoreState.call(this, t);
|
|
678
|
+
var s = t;
|
|
679
|
+
this.left = s.left, this.top = s.top, this.width = s.width, this.height = s.height, this.rotationAngle = s.rotationAngle, this.visual.transform.baseVal.getItem(0).setMatrix(T.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix, s.visualTransformMatrix)), this.container.transform.baseVal.getItem(0).setMatrix(T.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix, s.containerTransformMatrix));
|
|
680
|
+
}, e.prototype.scale = function(t, s) {
|
|
681
|
+
o.prototype.scale.call(this, t, s);
|
|
682
|
+
var r = this.rotatePoint({ x: this.left, y: this.top }), i = this.unrotatePoint({ x: r.x * t, y: r.y * s });
|
|
683
|
+
this.left = i.x, this.top = i.y, this.width = this.width * t, this.height = this.height * s, this.adjustControlBox();
|
|
684
|
+
}, e;
|
|
685
|
+
}(F), j = function(o) {
|
|
686
|
+
function e(t, s, r) {
|
|
687
|
+
var i = o.call(this, t, s, r) || this;
|
|
688
|
+
return i.fillColor = "transparent", i.strokeColor = "transparent", i.strokeWidth = 0, i.strokeDasharray = "", i.opacity = 1, i.setStrokeColor = i.setStrokeColor.bind(i), i.setFillColor = i.setFillColor.bind(i), i.setStrokeWidth = i.setStrokeWidth.bind(i), i.setStrokeDasharray = i.setStrokeDasharray.bind(i), i.createVisual = i.createVisual.bind(i), i;
|
|
689
|
+
}
|
|
690
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
691
|
+
return !(!o.prototype.ownsTarget.call(this, t) && t !== this.visual);
|
|
692
|
+
}, e.prototype.createVisual = function() {
|
|
693
|
+
this.visual = h.createRect(1, 1, [["fill", this.fillColor], ["stroke", this.strokeColor], ["stroke-width", this.strokeWidth.toString()], ["stroke-dasharray", this.strokeDasharray], ["opacity", this.opacity.toString()]]), this.addMarkerVisualToContainer(this.visual);
|
|
694
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
695
|
+
o.prototype.pointerDown.call(this, t, s), this.state === "new" && (this.createVisual(), this.moveVisual(t), this._state = "creating");
|
|
696
|
+
}, e.prototype.manipulate = function(t) {
|
|
697
|
+
o.prototype.manipulate.call(this, t);
|
|
698
|
+
}, e.prototype.resize = function(t) {
|
|
699
|
+
o.prototype.resize.call(this, t), this.setSize();
|
|
700
|
+
}, e.prototype.setSize = function() {
|
|
701
|
+
o.prototype.setSize.call(this), h.setAttributes(this.visual, [["width", this.width.toString()], ["height", this.height.toString()]]);
|
|
702
|
+
}, e.prototype.pointerUp = function(t) {
|
|
703
|
+
o.prototype.pointerUp.call(this, t), this.setSize();
|
|
704
|
+
}, e.prototype.setStrokeColor = function(t) {
|
|
705
|
+
this.strokeColor = t, this.visual && h.setAttributes(this.visual, [["stroke", this.strokeColor]]), this.colorChanged(t), this.stateChanged();
|
|
706
|
+
}, e.prototype.setFillColor = function(t) {
|
|
707
|
+
this.fillColor = t, this.visual && h.setAttributes(this.visual, [["fill", this.fillColor]]), this.stateChanged();
|
|
708
|
+
}, e.prototype.setStrokeWidth = function(t) {
|
|
709
|
+
this.strokeWidth = t, this.visual && h.setAttributes(this.visual, [["stroke-width", this.strokeWidth.toString()]]), this.stateChanged();
|
|
710
|
+
}, e.prototype.setStrokeDasharray = function(t) {
|
|
711
|
+
this.strokeDasharray = t, this.visual && h.setAttributes(this.visual, [["stroke-dasharray", this.strokeDasharray]]), this.stateChanged();
|
|
712
|
+
}, e.prototype.getState = function() {
|
|
713
|
+
return Object.assign({ fillColor: this.fillColor, strokeColor: this.strokeColor, strokeWidth: this.strokeWidth, strokeDasharray: this.strokeDasharray, opacity: this.opacity }, o.prototype.getState.call(this));
|
|
714
|
+
}, e.prototype.restoreState = function(t) {
|
|
715
|
+
var s = t;
|
|
716
|
+
this.fillColor = s.fillColor, this.strokeColor = s.strokeColor, this.strokeWidth = s.strokeWidth, this.strokeDasharray = s.strokeDasharray, this.opacity = s.opacity, this.createVisual(), o.prototype.restoreState.call(this, t), this.setSize();
|
|
717
|
+
}, e.prototype.scale = function(t, s) {
|
|
718
|
+
o.prototype.scale.call(this, t, s), this.setSize();
|
|
719
|
+
}, e.title = "Rectangle marker", e;
|
|
720
|
+
}(B), S = function(o) {
|
|
721
|
+
function e(t, s, r, i, n) {
|
|
722
|
+
var a = o.call(this, t, i || '<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>', n || "line-width-panel") || this;
|
|
723
|
+
return a.widths = [], a.widthBoxes = [], a.widths = s, a.currentWidth = r, a.setCurrentWidth = a.setCurrentWidth.bind(a), a;
|
|
724
|
+
}
|
|
725
|
+
return d(e, o), e.prototype.getUi = function() {
|
|
726
|
+
var t = this, s = document.createElement("div");
|
|
727
|
+
return s.style.display = "flex", s.style.overflow = "hidden", s.style.flexGrow = "2", this.widths.forEach(function(r) {
|
|
728
|
+
var i = document.createElement("div");
|
|
729
|
+
i.style.display = "flex", i.style.flexGrow = "2", i.style.alignItems = "center", i.style.justifyContent = "space-between", i.style.padding = "5px", i.style.borderWidth = "2px", i.style.borderStyle = "solid", i.style.borderColor = r === t.currentWidth ? t.uiStyleSettings.toolboxAccentColor : "transparent", i.addEventListener("click", function() {
|
|
730
|
+
t.setCurrentWidth(r, i);
|
|
731
|
+
}), s.appendChild(i);
|
|
732
|
+
var n = document.createElement("div");
|
|
733
|
+
n.innerText = r.toString(), n.style.marginRight = "5px", i.appendChild(n);
|
|
734
|
+
var a = document.createElement("div");
|
|
735
|
+
a.style.minHeight = "20px", a.style.flexGrow = "2", a.style.display = "flex", a.style.alignItems = "center";
|
|
736
|
+
var c = document.createElement("hr");
|
|
737
|
+
c.style.minWidth = "20px", c.style.border = "0px", c.style.borderTop = r + "px solid " + t.uiStyleSettings.toolboxColor, c.style.flexGrow = "2", a.appendChild(c), i.appendChild(a), t.widthBoxes.push(i);
|
|
738
|
+
}), s;
|
|
739
|
+
}, e.prototype.setCurrentWidth = function(t, s) {
|
|
740
|
+
var r = this;
|
|
741
|
+
this.currentWidth = t, this.widthBoxes.forEach(function(i) {
|
|
742
|
+
i.style.borderColor = i === s ? r.uiStyleSettings.toolboxAccentColor : "transparent";
|
|
743
|
+
}), this.onWidthChanged && this.onWidthChanged(this.currentWidth);
|
|
744
|
+
}, e;
|
|
745
|
+
}(x), M = function(o) {
|
|
746
|
+
function e(t, s, r, i, n) {
|
|
747
|
+
var a = o.call(this, t, i || '<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>', n || "line-style-panel") || this;
|
|
748
|
+
return a.styles = [], a.styleBoxes = [], a.styles = s, a.currentStyle = r, a.setCurrentStyle = a.setCurrentStyle.bind(a), a;
|
|
749
|
+
}
|
|
750
|
+
return d(e, o), e.prototype.getUi = function() {
|
|
751
|
+
var t = this, s = document.createElement("div");
|
|
752
|
+
return s.style.display = "flex", s.style.overflow = "hidden", s.style.flexGrow = "2", this.styles.forEach(function(r) {
|
|
753
|
+
var i = document.createElement("div");
|
|
754
|
+
i.style.display = "flex", i.style.alignItems = "center", i.style.justifyContent = "space-between", i.style.padding = "5px", i.style.borderWidth = "2px", i.style.borderStyle = "solid", i.style.overflow = "hidden", i.style.maxWidth = 100 / t.styles.length - 5 + "%", i.style.borderColor = r === t.currentStyle ? t.uiStyleSettings.toolboxAccentColor : "transparent", i.addEventListener("click", function() {
|
|
755
|
+
t.setCurrentStyle(r, i);
|
|
756
|
+
}), s.appendChild(i);
|
|
757
|
+
var n = document.createElement("div");
|
|
758
|
+
n.style.minHeight = "20px", n.style.flexGrow = "2", n.style.overflow = "hidden";
|
|
759
|
+
var a = `<svg width="100" height="20">
|
|
760
|
+
<line x1="0" y1="10" x2="100" y2="10" stroke="` + t.uiStyleSettings.toolboxColor + '" stroke-width="3" ' + (r !== "" ? 'stroke-dasharray="' + r + '"' : "") + ` />
|
|
761
|
+
</svg>`;
|
|
762
|
+
n.innerHTML = a, i.appendChild(n), t.styleBoxes.push(i);
|
|
763
|
+
}), s;
|
|
764
|
+
}, e.prototype.setCurrentStyle = function(t, s) {
|
|
765
|
+
var r = this;
|
|
766
|
+
this.currentStyle = t, this.styleBoxes.forEach(function(i) {
|
|
767
|
+
i.style.borderColor = i === s ? r.uiStyleSettings.toolboxAccentColor : "transparent";
|
|
768
|
+
}), this.onStyleChanged && this.onStyleChanged(this.currentStyle);
|
|
769
|
+
}, e;
|
|
770
|
+
}(x), P = function(o) {
|
|
771
|
+
function e(t, s, r) {
|
|
772
|
+
var i = o.call(this, t, s, r) || this;
|
|
773
|
+
return i.strokeColor = r.defaultColor, i.strokeWidth = r.defaultStrokeWidth, i.strokeDasharray = r.defaultStrokeDasharray, i.strokePanel = new f("Line color", r.defaultColorSet, r.defaultColor), i.strokePanel.onColorChanged = i.setStrokeColor, i.strokeWidthPanel = new S("Line width", r.defaultStrokeWidths, r.defaultStrokeWidth), i.strokeWidthPanel.onWidthChanged = i.setStrokeWidth, i.strokeStylePanel = new M("Line style", r.defaultStrokeDasharrays, r.defaultStrokeDasharray), i.strokeStylePanel.onStyleChanged = i.setStrokeDasharray, i;
|
|
774
|
+
}
|
|
775
|
+
return d(e, o), Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
776
|
+
return [this.strokePanel, this.strokeWidthPanel, this.strokeStylePanel];
|
|
777
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
778
|
+
var t = o.prototype.getState.call(this);
|
|
779
|
+
return t.typeName = e.typeName, t;
|
|
780
|
+
}, e.typeName = "FrameMarker", e.title = "Frame marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>', e;
|
|
781
|
+
}(j), et = function() {
|
|
782
|
+
this.defaultColorSet = ["#EF4444", "#10B981", "#2563EB", "#FFFF00", "#7C3AED", "#F472B6", "#000000", "#FFFFFF"], this.defaultColor = this.defaultColorSet[0], this.defaultFillColor = this.defaultColorSet[0], this.defaultStrokeColor = this.defaultColorSet[7], this.defaultHighlightColor = this.defaultColorSet[3], this.defaultStrokeWidth = 3, this.defaultStrokeDasharray = "", this.defaultHighlightOpacity = 0.5, this.defaultFontFamily = "Helvetica, Arial, sans-serif", this.defaultStrokeWidths = [1, 2, 3, 5, 10], this.defaultStrokeDasharrays = ["", "3", "12 3", "9 6 3 6"], this.defaultOpacitySteps = [0.1, 0.25, 0.5, 0.75, 1], this.displayMode = "inline", this.defaultFontFamilies = ['Times, "Times New Roman", serif', "Helvetica, Arial, sans-serif", 'Courier, "Courier New", monospace', "cursive", "fantasy"], this.popupMargin = 30, this.newFreehandMarkerOnPointerUp = !1, this.defaultColorsFollowCurrentColors = !1, this.freehandPixelRatio = 1, this.disableRotation = !1, this.defaultCaptionFontSize = "1rem", this.defaultCaptionText = "Text", this.wrapText = !1, this.defaultText = "Your text here";
|
|
783
|
+
}, U = function(o) {
|
|
784
|
+
function e(t, s, r) {
|
|
785
|
+
var i = o.call(this, t, s, r) || this;
|
|
786
|
+
return i.x1 = 0, i.y1 = 0, i.x2 = 0, i.y2 = 0, i.defaultLength = 50, i.manipulationStartX = 0, i.manipulationStartY = 0, i.manipulationStartX1 = 0, i.manipulationStartY1 = 0, i.manipulationStartX2 = 0, i.manipulationStartY2 = 0, i.setupControlBox(), i;
|
|
787
|
+
}
|
|
788
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
789
|
+
return !!o.prototype.ownsTarget.call(this, t) || !(!this.grip1.ownsTarget(t) && !this.grip2.ownsTarget(t));
|
|
790
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
791
|
+
o.prototype.pointerDown.call(this, t, s), this.manipulationStartX = t.x, this.manipulationStartY = t.y, this.state === "new" && (this.x1 = t.x, this.y1 = t.y, this.x2 = t.x, this.y2 = t.y), this.manipulationStartX1 = this.x1, this.manipulationStartY1 = this.y1, this.manipulationStartX2 = this.x2, this.manipulationStartY2 = this.y2, this.state !== "new" && (this.select(), this.grip1.ownsTarget(s) ? this.activeGrip = this.grip1 : this.grip2.ownsTarget(s) ? this.activeGrip = this.grip2 : this.activeGrip = void 0, this.activeGrip ? this._state = "resize" : this._state = "move");
|
|
792
|
+
}, e.prototype.pointerUp = function(t) {
|
|
793
|
+
var s = this.state;
|
|
794
|
+
o.prototype.pointerUp.call(this, t), this.state === "creating" && Math.abs(this.x1 - this.x2) < 10 && Math.abs(this.y1 - this.y2) < 10 ? (this.x2 = this.x1 + this.defaultLength, this.adjustVisual(), this.adjustControlBox()) : this.manipulate(t), this._state = "select", s === "creating" && this.onMarkerCreated && this.onMarkerCreated(this);
|
|
795
|
+
}, e.prototype.adjustVisual = function() {
|
|
796
|
+
}, e.prototype.manipulate = function(t) {
|
|
797
|
+
this.state === "creating" ? this.resize(t) : this.state === "move" ? (this.x1 = this.manipulationStartX1 + t.x - this.manipulationStartX, this.y1 = this.manipulationStartY1 + t.y - this.manipulationStartY, this.x2 = this.manipulationStartX2 + t.x - this.manipulationStartX, this.y2 = this.manipulationStartY2 + t.y - this.manipulationStartY, this.adjustVisual(), this.adjustControlBox()) : this.state === "resize" && this.resize(t);
|
|
798
|
+
}, e.prototype.resize = function(t) {
|
|
799
|
+
switch (this.activeGrip) {
|
|
800
|
+
case this.grip1:
|
|
801
|
+
this.x1 = t.x, this.y1 = t.y;
|
|
802
|
+
break;
|
|
803
|
+
case this.grip2:
|
|
804
|
+
case void 0:
|
|
805
|
+
this.x2 = t.x, this.y2 = t.y;
|
|
806
|
+
}
|
|
807
|
+
this.adjustVisual(), this.adjustControlBox();
|
|
808
|
+
}, e.prototype.select = function() {
|
|
809
|
+
o.prototype.select.call(this), this.adjustControlBox(), this.controlBox.style.display = "";
|
|
810
|
+
}, e.prototype.deselect = function() {
|
|
811
|
+
o.prototype.deselect.call(this), this.controlBox.style.display = "none";
|
|
812
|
+
}, e.prototype.setupControlBox = function() {
|
|
813
|
+
this.controlBox = h.createGroup(), this.container.appendChild(this.controlBox), this.addControlGrips(), this.controlBox.style.display = "none";
|
|
814
|
+
}, e.prototype.adjustControlBox = function() {
|
|
815
|
+
this.positionGrips();
|
|
816
|
+
}, e.prototype.addControlGrips = function() {
|
|
817
|
+
this.grip1 = this.createGrip(), this.grip2 = this.createGrip(), this.positionGrips();
|
|
818
|
+
}, e.prototype.createGrip = function() {
|
|
819
|
+
var t = new _();
|
|
820
|
+
return t.visual.transform.baseVal.appendItem(h.createTransform()), this.controlBox.appendChild(t.visual), t;
|
|
821
|
+
}, e.prototype.positionGrips = function() {
|
|
822
|
+
var t = this.grip1.GRIP_SIZE;
|
|
823
|
+
this.positionGrip(this.grip1.visual, this.x1 - t / 2, this.y1 - t / 2), this.positionGrip(this.grip2.visual, this.x2 - t / 2, this.y2 - t / 2);
|
|
824
|
+
}, e.prototype.positionGrip = function(t, s, r) {
|
|
825
|
+
var i = t.transform.baseVal.getItem(0);
|
|
826
|
+
i.setTranslate(s, r), t.transform.baseVal.replaceItem(i, 0);
|
|
827
|
+
}, e.prototype.getState = function() {
|
|
828
|
+
return Object.assign({ x1: this.x1, y1: this.y1, x2: this.x2, y2: this.y2 }, o.prototype.getState.call(this));
|
|
829
|
+
}, e.prototype.restoreState = function(t) {
|
|
830
|
+
o.prototype.restoreState.call(this, t);
|
|
831
|
+
var s = t;
|
|
832
|
+
this.x1 = s.x1, this.y1 = s.y1, this.x2 = s.x2, this.y2 = s.y2;
|
|
833
|
+
}, e.prototype.scale = function(t, s) {
|
|
834
|
+
o.prototype.scale.call(this, t, s), this.x1 = this.x1 * t, this.y1 = this.y1 * s, this.x2 = this.x2 * t, this.y2 = this.y2 * s, this.adjustVisual(), this.adjustControlBox();
|
|
835
|
+
}, e;
|
|
836
|
+
}(F), I = function(o) {
|
|
837
|
+
function e(t, s, r) {
|
|
838
|
+
var i = o.call(this, t, s, r) || this;
|
|
839
|
+
return i.strokeColor = "transparent", i.strokeWidth = 0, i.strokeDasharray = "", i.setStrokeColor = i.setStrokeColor.bind(i), i.setStrokeWidth = i.setStrokeWidth.bind(i), i.setStrokeDasharray = i.setStrokeDasharray.bind(i), i.strokeColor = r.defaultColor, i.strokeWidth = r.defaultStrokeWidth, i.strokeDasharray = r.defaultStrokeDasharray, i.strokePanel = new f("Line color", r.defaultColorSet, r.defaultColor), i.strokePanel.onColorChanged = i.setStrokeColor, i.strokeWidthPanel = new S("Line width", r.defaultStrokeWidths, r.defaultStrokeWidth), i.strokeWidthPanel.onWidthChanged = i.setStrokeWidth, i.strokeStylePanel = new M("Line style", r.defaultStrokeDasharrays, r.defaultStrokeDasharray), i.strokeStylePanel.onStyleChanged = i.setStrokeDasharray, i;
|
|
840
|
+
}
|
|
841
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
842
|
+
return !(!o.prototype.ownsTarget.call(this, t) && t !== this.visual && t !== this.selectorLine && t !== this.visibleLine);
|
|
843
|
+
}, e.prototype.createVisual = function() {
|
|
844
|
+
this.visual = h.createGroup(), this.selectorLine = h.createLine(this.x1, this.y1, this.x2, this.y2, [["stroke", "transparent"], ["stroke-width", (this.strokeWidth + 10).toString()]]), this.visibleLine = h.createLine(this.x1, this.y1, this.x2, this.y2, [["stroke", this.strokeColor], ["stroke-width", this.strokeWidth.toString()]]), this.visual.appendChild(this.selectorLine), this.visual.appendChild(this.visibleLine), this.addMarkerVisualToContainer(this.visual);
|
|
845
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
846
|
+
o.prototype.pointerDown.call(this, t, s), this.state === "new" && (this.createVisual(), this.adjustVisual(), this._state = "creating");
|
|
847
|
+
}, e.prototype.adjustVisual = function() {
|
|
848
|
+
this.selectorLine && this.visibleLine && (this.selectorLine.setAttribute("x1", this.x1.toString()), this.selectorLine.setAttribute("y1", this.y1.toString()), this.selectorLine.setAttribute("x2", this.x2.toString()), this.selectorLine.setAttribute("y2", this.y2.toString()), this.visibleLine.setAttribute("x1", this.x1.toString()), this.visibleLine.setAttribute("y1", this.y1.toString()), this.visibleLine.setAttribute("x2", this.x2.toString()), this.visibleLine.setAttribute("y2", this.y2.toString()), h.setAttributes(this.visibleLine, [["stroke", this.strokeColor]]), h.setAttributes(this.visibleLine, [["stroke-width", this.strokeWidth.toString()]]), h.setAttributes(this.visibleLine, [["stroke-dasharray", this.strokeDasharray.toString()]]));
|
|
849
|
+
}, e.prototype.setStrokeColor = function(t) {
|
|
850
|
+
this.strokeColor = t, this.adjustVisual(), this.colorChanged(t);
|
|
851
|
+
}, e.prototype.setStrokeWidth = function(t) {
|
|
852
|
+
this.strokeWidth = t, this.adjustVisual();
|
|
853
|
+
}, e.prototype.setStrokeDasharray = function(t) {
|
|
854
|
+
this.strokeDasharray = t, this.adjustVisual(), this.stateChanged();
|
|
855
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
856
|
+
return [this.strokePanel, this.strokeWidthPanel, this.strokeStylePanel];
|
|
857
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
858
|
+
var t = Object.assign({ strokeColor: this.strokeColor, strokeWidth: this.strokeWidth, strokeDasharray: this.strokeDasharray }, o.prototype.getState.call(this));
|
|
859
|
+
return t.typeName = e.typeName, t;
|
|
860
|
+
}, e.prototype.restoreState = function(t) {
|
|
861
|
+
o.prototype.restoreState.call(this, t);
|
|
862
|
+
var s = t;
|
|
863
|
+
this.strokeColor = s.strokeColor, this.strokeWidth = s.strokeWidth, this.strokeDasharray = s.strokeDasharray, this.createVisual(), this.adjustVisual();
|
|
864
|
+
}, e.typeName = "LineMarker", e.title = "Line marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>', e;
|
|
865
|
+
}(U), W = function(o) {
|
|
866
|
+
function e(t, s, r, i, n) {
|
|
867
|
+
var a = o.call(this, t, i || '<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>', n || "font-family-panel") || this;
|
|
868
|
+
return a.fonts = [], a.fontBoxes = [], a.fonts = s, a.currentFont = r, a.setCurrentFont = a.setCurrentFont.bind(a), a;
|
|
869
|
+
}
|
|
870
|
+
return d(e, o), e.prototype.getUi = function() {
|
|
871
|
+
var t = this, s = document.createElement("div");
|
|
872
|
+
return s.style.overflow = "hidden", s.style.flexGrow = "2", this.fonts.forEach(function(r) {
|
|
873
|
+
var i = document.createElement("div");
|
|
874
|
+
i.style.display = "inline-block", i.style.alignItems = "center", i.style.justifyContent = "space-between", i.style.padding = "5px", i.style.borderWidth = "2px", i.style.borderStyle = "solid", i.style.overflow = "hidden", i.style.maxWidth = 100 / t.fonts.length - 5 + "%", i.style.borderColor = r === t.currentFont ? t.uiStyleSettings.toolboxAccentColor : "transparent", i.addEventListener("click", function() {
|
|
875
|
+
t.setCurrentFont(r, i);
|
|
876
|
+
}), s.appendChild(i);
|
|
877
|
+
var n = document.createElement("div");
|
|
878
|
+
n.style.display = "flex", n.style.minHeight = "20px", n.style.flexGrow = "2", n.style.fontFamily = r, n.style.overflow = "hidden";
|
|
879
|
+
var a = document.createElement("div");
|
|
880
|
+
a.style.whiteSpace = "nowrap", a.style.overflow = "hidden", a.style.textOverflow = "ellipsis", a.innerHTML = "The quick brown fox jumps over the lazy dog", n.appendChild(a), i.appendChild(n), t.fontBoxes.push(i);
|
|
881
|
+
}), s;
|
|
882
|
+
}, e.prototype.setCurrentFont = function(t, s) {
|
|
883
|
+
var r = this;
|
|
884
|
+
this.currentFont = t, this.fontBoxes.forEach(function(i) {
|
|
885
|
+
i.style.borderColor = i === s ? r.uiStyleSettings.toolboxAccentColor : "transparent";
|
|
886
|
+
}), this.onFontChanged && this.onFontChanged(this.currentFont);
|
|
887
|
+
}, e;
|
|
888
|
+
}(x), w = function(o) {
|
|
889
|
+
function e(t, s, r) {
|
|
890
|
+
var i, n = o.call(this, t, s, r) || this;
|
|
891
|
+
return n.color = "transparent", n.padding = 5, n.DEFAULT_TEXT = "your text here", n.isMoved = !1, n.color = r.defaultColor, n.fontFamily = r.defaultFontFamily, n.text = (i = r.defaultText) !== null && i !== void 0 ? i : n.DEFAULT_TEXT, n.defaultSize = { x: 100, y: 30 }, n.setColor = n.setColor.bind(n), n.setFont = n.setFont.bind(n), n.renderText = n.renderText.bind(n), n.sizeText = n.sizeText.bind(n), n.textEditDivClicked = n.textEditDivClicked.bind(n), n.showTextEditor = n.showTextEditor.bind(n), n.setSize = n.setSize.bind(n), n.positionTextEditor = n.positionTextEditor.bind(n), n.wrapText = n.wrapText.bind(n), n.colorPanel = new f("Color", r.defaultColorSet, r.defaultColor), n.colorPanel.onColorChanged = n.setColor, n.fontFamilyPanel = new W("Font", r.defaultFontFamilies, r.defaultFontFamily), n.fontFamilyPanel.onFontChanged = n.setFont, n;
|
|
892
|
+
}
|
|
893
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
894
|
+
if (o.prototype.ownsTarget.call(this, t) || t === this.visual || t === this.textElement || t === this.bgRectangle) return !0;
|
|
895
|
+
var s = !1;
|
|
896
|
+
return this.textElement.childNodes.forEach(function(r) {
|
|
897
|
+
r === t && (s = !0);
|
|
898
|
+
}), s;
|
|
899
|
+
}, e.prototype.createVisual = function() {
|
|
900
|
+
this.visual = h.createGroup(), this.bgRectangle = h.createRect(1, 1, [["fill", "transparent"]]), this.visual.appendChild(this.bgRectangle), this.textElement = h.createText([["fill", this.color], ["font-family", this.fontFamily], ["font-size", "16px"], ["x", "0"], ["y", "0"]]), this.textElement.transform.baseVal.appendItem(h.createTransform()), this.textElement.transform.baseVal.appendItem(h.createTransform()), this.visual.appendChild(this.textElement), this.addMarkerVisualToContainer(this.visual), this.renderText();
|
|
901
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
902
|
+
o.prototype.pointerDown.call(this, t, s), this.isMoved = !1, this.pointerDownPoint = t, this.pointerDownTimestamp = Date.now(), this.state === "new" && (this.createVisual(), this.moveVisual(t), this._state = "creating");
|
|
903
|
+
}, e.prototype.wrapText = function() {
|
|
904
|
+
function t(p) {
|
|
905
|
+
var l = p[0].length;
|
|
906
|
+
return p.forEach(function(u) {
|
|
907
|
+
u.length > l && (l = u.length);
|
|
908
|
+
}), 0.35 * l / p.length;
|
|
909
|
+
}
|
|
910
|
+
if (this.text !== "") {
|
|
911
|
+
for (var s = this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/), r = 1 * this.width / this.height, i = new (Array.bind.apply(Array, E([void 0], s)))(), n = t(i), a = Number.MAX_VALUE, c = function() {
|
|
912
|
+
var p = i[0];
|
|
913
|
+
i.forEach(function(l) {
|
|
914
|
+
l.length > p.length && (p = l);
|
|
915
|
+
}), (a = p.lastIndexOf(" ", a - 1)) > 0 ? (i = [], s.forEach(function(l) {
|
|
916
|
+
for (var u = l; u.length > a; ) {
|
|
917
|
+
var g = u.lastIndexOf(" ", a);
|
|
918
|
+
g < 0 && (g = u.indexOf(" ")), g > 0 ? (i.push(u.substring(0, g)), u = u.substring(g).trim()) : (i.push(u), u = "");
|
|
919
|
+
}
|
|
920
|
+
i.push(u);
|
|
921
|
+
}), n = t(i)) : n = -1;
|
|
922
|
+
}; n > r; ) c();
|
|
923
|
+
return i.join(`\r
|
|
924
|
+
`);
|
|
925
|
+
}
|
|
926
|
+
return this.text;
|
|
927
|
+
}, e.prototype.renderText = function() {
|
|
928
|
+
var t = this;
|
|
929
|
+
if (this.textElement) {
|
|
930
|
+
for (; this.textElement.lastChild; ) this.textElement.removeChild(this.textElement.lastChild);
|
|
931
|
+
(this.globalSettings.wrapText ? this.wrapText() : this.text).split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(s) {
|
|
932
|
+
t.textElement.appendChild(h.createTSpan(s.trim() === "" ? " " : s.trim(), [["x", "0"], ["dy", "1.2em"]]));
|
|
933
|
+
}), setTimeout(this.sizeText, 10);
|
|
934
|
+
}
|
|
935
|
+
}, e.prototype.getTextScale = function() {
|
|
936
|
+
var t = this.textElement.getBBox(), s = 1;
|
|
937
|
+
if (t.width > 0 && t.height > 0) {
|
|
938
|
+
var r = (1 * this.width - this.width * this.padding * 2 / 100) / t.width, i = (1 * this.height - this.height * this.padding * 2 / 100) / t.height;
|
|
939
|
+
s = Math.min(r, i);
|
|
940
|
+
}
|
|
941
|
+
return s;
|
|
942
|
+
}, e.prototype.getTextPosition = function(t) {
|
|
943
|
+
var s = window.getComputedStyle(this.textElement).direction === "rtl" ? 1 : -1, r = this.textElement.getBBox(), i = 0, n = 0;
|
|
944
|
+
return r.width > 0 && r.height > 0 && (i = (this.width + s * r.width * t) / 2, n = this.height / 2 - r.height * t / 2), { x: i, y: n };
|
|
945
|
+
}, e.prototype.sizeText = function() {
|
|
946
|
+
var t = this.textElement.getBBox(), s = this.getTextScale(), r = this.getTextPosition(s);
|
|
947
|
+
r.y -= t.y * s, navigator.userAgent.indexOf("Edge/") > -1 ? this.textElement.style.transform = "translate(" + r.x + "px, " + r.y + "px) scale(" + s + ", " + s + ")" : (this.textElement.transform.baseVal.getItem(0).setTranslate(r.x, r.y), this.textElement.transform.baseVal.getItem(1).setScale(s, s));
|
|
948
|
+
}, e.prototype.manipulate = function(t) {
|
|
949
|
+
o.prototype.manipulate.call(this, t), this.pointerDownPoint !== void 0 && (this.isMoved = Math.abs(t.x - this.pointerDownPoint.x) > 5 || Math.abs(t.y - this.pointerDownPoint.y) > 5);
|
|
950
|
+
}, e.prototype.resize = function(t) {
|
|
951
|
+
o.prototype.resize.call(this, t), this.isMoved = !0, this.setSize(), this.globalSettings.wrapText ? this.renderText() : this.sizeText();
|
|
952
|
+
}, e.prototype.setSize = function() {
|
|
953
|
+
o.prototype.setSize.call(this), this.visual && this.bgRectangle && (h.setAttributes(this.visual, [["width", this.width.toString()], ["height", this.height.toString()]]), h.setAttributes(this.bgRectangle, [["width", this.width.toString()], ["height", this.height.toString()]]));
|
|
954
|
+
}, e.prototype.pointerUp = function(t) {
|
|
955
|
+
var s = this.state;
|
|
956
|
+
s === "creating" && (this._suppressMarkerCreateEvent = !0), o.prototype.pointerUp.call(this, t), this.setSize(), (s === "creating" || !this.isMoved && Date.now() - this.pointerDownTimestamp > 500) && this.showTextEditor(), this.pointerDownPoint = void 0;
|
|
957
|
+
}, e.prototype.showTextEditor = function() {
|
|
958
|
+
var t = this;
|
|
959
|
+
this._state = "edit", this.overlayContainer.innerHTML = "", this.textEditDiv = document.createElement("div"), this.textEditDiv.style.flexGrow = "2", this.textEditDiv.style.alignItems = "center", this.textEditDiv.style.justifyContent = "center", this.textEditDiv.style.pointerEvents = "auto", this.textEditDiv.style.overflow = "hidden", this.textEditor = document.createElement("div"), this.textEditor.style.position = "absolute", this.textEditor.style.fontFamily = this.fontFamily, this.textEditor.style.lineHeight = "1em", this.textEditor.innerText = this.text, this.textEditor.contentEditable = "true", this.textEditor.style.color = this.color, this.textEditor.style.whiteSpace = "pre", this.positionTextEditor(), this.textEditor.addEventListener("pointerup", function(s) {
|
|
960
|
+
s.stopPropagation();
|
|
961
|
+
}), this.globalSettings.wrapText || this.textEditor.addEventListener("input", function() {
|
|
962
|
+
for (var s = Number.parseFloat(t.textEditor.style.fontSize); t.textEditor.clientWidth >= Number.parseInt(t.textEditor.style.maxWidth) && s > 0.9; ) s -= 0.1, t.textEditor.style.fontSize = Math.max(s, 0.9) + "em";
|
|
963
|
+
}), this.textEditor.addEventListener("keyup", function(s) {
|
|
964
|
+
s.cancelBubble = !0;
|
|
965
|
+
}), this.textEditor.addEventListener("paste", function(s) {
|
|
966
|
+
if (s.clipboardData) {
|
|
967
|
+
var r = s.clipboardData.getData("text"), i = window.getSelection();
|
|
968
|
+
if (!i.rangeCount) return !1;
|
|
969
|
+
i.deleteFromDocument(), i.getRangeAt(0).insertNode(document.createTextNode(r)), s.preventDefault();
|
|
970
|
+
}
|
|
971
|
+
}), this.textEditDiv.addEventListener("pointerup", function() {
|
|
972
|
+
t.textEditDivClicked(t.textEditor.innerText);
|
|
973
|
+
}), this.textEditDiv.appendChild(this.textEditor), this.overlayContainer.appendChild(this.textEditDiv), this.hideVisual(), this.textEditor.focus(), document.execCommand("selectAll");
|
|
974
|
+
}, e.prototype.positionTextEditor = function() {
|
|
975
|
+
if (this.state === "edit") if (this.textEditor === void 0) this.showTextEditor();
|
|
976
|
+
else if (this.globalSettings.wrapText) this.textEditor.style.left = this.left + this.padding + "px", this.textEditor.style.top = this.top + this.padding + "px", this.textEditor.style.width = this.width - 2 * this.padding + "px", this.textEditor.style.height = this.height - 2 * this.padding + "px", this.textEditor.style.maxHeight = this.textEditor.style.height, this.textEditor.style.whiteSpace = "wrap";
|
|
977
|
+
else {
|
|
978
|
+
this.textElement.style.display = "";
|
|
979
|
+
var t = this.getTextScale(), s = this.rotatePoint({ x: this.left + this.width / 2, y: this.top + this.height / 2 }), r = this.textElement.getBBox(), i = { x: r.width * t, y: r.height * t };
|
|
980
|
+
s.x -= i.x / 2, s.y -= i.y / 2, this.textEditor.style.top = s.y + "px", this.textEditor.style.left = s.x + "px", this.textEditor.style.maxWidth = this.overlayContainer.offsetWidth - s.x + "px", this.textEditor.style.fontSize = Math.max(16 * t, 12) + "px", this.textElement.style.display = "none";
|
|
981
|
+
}
|
|
982
|
+
}, e.prototype.textEditDivClicked = function(t) {
|
|
983
|
+
this.text = t.trim(), this.overlayContainer.innerHTML = "", this.renderText(), this.showVisual(), this._suppressMarkerCreateEvent && (this._suppressMarkerCreateEvent = !1, this.onMarkerCreated && this.onMarkerCreated(this)), this.stateChanged();
|
|
984
|
+
}, e.prototype.select = function() {
|
|
985
|
+
o.prototype.select.call(this), this.state === "edit" && this.textEditDivClicked(this.textEditor.innerText);
|
|
986
|
+
}, e.prototype.deselect = function() {
|
|
987
|
+
this.state === "edit" && this.textEditDivClicked(this.textEditor.innerText), o.prototype.deselect.call(this);
|
|
988
|
+
}, e.prototype.dblClick = function(t, s) {
|
|
989
|
+
o.prototype.dblClick.call(this, t, s), this.showTextEditor();
|
|
990
|
+
}, e.prototype.setColor = function(t) {
|
|
991
|
+
this.textElement && h.setAttributes(this.textElement, [["fill", t]]), this.color = t, this.textEditor && (this.textEditor.style.color = this.color), this.colorChanged(t);
|
|
992
|
+
}, e.prototype.setFont = function(t) {
|
|
993
|
+
this.textElement && h.setAttributes(this.textElement, [["font-family", t]]), this.fontFamily = t, this.textEditor && (this.textEditor.style.fontFamily = this.fontFamily), this.renderText(), this.stateChanged();
|
|
994
|
+
}, e.prototype.hideVisual = function() {
|
|
995
|
+
this.textElement.style.display = "none", this.hideControlBox();
|
|
996
|
+
}, e.prototype.showVisual = function() {
|
|
997
|
+
this.state === "edit" && (this._state = "select"), this.textElement.style.display = "", this.showControlBox();
|
|
998
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
999
|
+
return [this.colorPanel, this.fontFamilyPanel];
|
|
1000
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1001
|
+
var t = Object.assign({ color: this.color, fontFamily: this.fontFamily, padding: this.padding, text: this.text, wrapText: this.globalSettings.wrapText }, o.prototype.getState.call(this));
|
|
1002
|
+
return t.typeName = e.typeName, t;
|
|
1003
|
+
}, e.prototype.restoreState = function(t) {
|
|
1004
|
+
var s = t;
|
|
1005
|
+
this.color = s.color, this.fontFamily = s.fontFamily, this.padding = s.padding, this.text = s.text, this.createVisual(), o.prototype.restoreState.call(this, t), this.setSize(), this.globalSettings.wrapText && this.renderText();
|
|
1006
|
+
}, e.prototype.scale = function(t, s) {
|
|
1007
|
+
o.prototype.scale.call(this, t, s), this.setSize(), this.sizeText(), this.positionTextEditor();
|
|
1008
|
+
}, e.typeName = "TextMarker", e.title = "Text marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>', e;
|
|
1009
|
+
}(B), k = function(o) {
|
|
1010
|
+
function e(t, s, r) {
|
|
1011
|
+
var i = o.call(this, t, s, r) || this;
|
|
1012
|
+
return i.color = "transparent", i.lineWidth = 3, i.drawing = !1, i.pixelRatio = 1, i.color = r.defaultColor, i.lineWidth = r.defaultStrokeWidth, i.pixelRatio = r.freehandPixelRatio, i.setColor = i.setColor.bind(i), i.addCanvas = i.addCanvas.bind(i), i.finishCreation = i.finishCreation.bind(i), i.setLineWidth = i.setLineWidth.bind(i), i.colorPanel = new f("Color", r.defaultColorSet, r.defaultColor), i.colorPanel.onColorChanged = i.setColor, i.lineWidthPanel = new S("Line width", r.defaultStrokeWidths, r.defaultStrokeWidth), i.lineWidthPanel.onWidthChanged = i.setLineWidth, i;
|
|
1013
|
+
}
|
|
1014
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
1015
|
+
return !(!o.prototype.ownsTarget.call(this, t) && t !== this.visual && t !== this.drawingImage);
|
|
1016
|
+
}, e.prototype.createVisual = function() {
|
|
1017
|
+
this.visual = h.createGroup(), this.drawingImage = h.createImage(), this.visual.appendChild(this.drawingImage);
|
|
1018
|
+
var t = h.createTransform();
|
|
1019
|
+
this.visual.transform.baseVal.appendItem(t), this.addMarkerVisualToContainer(this.visual);
|
|
1020
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
1021
|
+
this.state === "new" && (this.addCanvas(), this.createVisual(), this._state = "creating"), this.state === "creating" ? (this.canvasContext.strokeStyle = this.color, this.canvasContext.lineWidth = this.lineWidth, this.canvasContext.beginPath(), this.canvasContext.moveTo(t.x, t.y), this.drawing = !0) : o.prototype.pointerDown.call(this, t, s);
|
|
1022
|
+
}, e.prototype.manipulate = function(t) {
|
|
1023
|
+
this.state === "creating" ? this.drawing && (this.canvasContext.lineTo(t.x, t.y), this.canvasContext.stroke()) : o.prototype.manipulate.call(this, t);
|
|
1024
|
+
}, e.prototype.resize = function(t) {
|
|
1025
|
+
o.prototype.resize.call(this, t), h.setAttributes(this.visual, [["width", this.width.toString()], ["height", this.height.toString()]]), h.setAttributes(this.drawingImage, [["width", this.width.toString()], ["height", this.height.toString()]]);
|
|
1026
|
+
}, e.prototype.pointerUp = function(t) {
|
|
1027
|
+
this._state === "creating" ? this.drawing && (this.canvasContext.closePath(), this.drawing = !1, this.globalSettings.newFreehandMarkerOnPointerUp && this.finishCreation()) : o.prototype.pointerUp.call(this, t);
|
|
1028
|
+
}, e.prototype.addCanvas = function() {
|
|
1029
|
+
this.overlayContainer.innerHTML = "", this.canvasElement = document.createElement("canvas"), this.canvasElement.width = this.overlayContainer.clientWidth * this.pixelRatio, this.canvasElement.height = this.overlayContainer.clientHeight * this.pixelRatio, this.canvasContext = this.canvasElement.getContext("2d"), this.canvasContext.scale(this.pixelRatio, this.pixelRatio), this.overlayContainer.appendChild(this.canvasElement);
|
|
1030
|
+
}, e.prototype.select = function() {
|
|
1031
|
+
this.state === "creating" && this.finishCreation(), o.prototype.select.call(this);
|
|
1032
|
+
}, e.prototype.deselect = function() {
|
|
1033
|
+
this.state === "creating" && this.finishCreation(), o.prototype.deselect.call(this);
|
|
1034
|
+
}, e.prototype.finishCreation = function() {
|
|
1035
|
+
for (var t = this.canvasContext.getImageData(0, 0, this.canvasElement.width, this.canvasElement.height), s = [this.canvasElement.width + 1, this.canvasElement.height + 1, -1, -1], r = s[0], i = s[1], n = s[2], a = s[3], c = !1, p = 0; p < this.canvasElement.height; p++) for (var l = 0; l < this.canvasElement.width; l++)
|
|
1036
|
+
t.data[p * this.canvasElement.width * 4 + 4 * l + 3] > 0 && (c = !0, p < i && (i = p), l < r && (r = l), p > a && (a = p), l > n && (n = l));
|
|
1037
|
+
if (c) {
|
|
1038
|
+
this.left = r / this.pixelRatio, this.top = i / this.pixelRatio, this.width = (n - r) / this.pixelRatio, this.height = (a - i) / this.pixelRatio;
|
|
1039
|
+
var u = document.createElement("canvas");
|
|
1040
|
+
u.width = n - r, u.height = a - i, u.getContext("2d").putImageData(this.canvasContext.getImageData(r, i, n - r, a - i), 0, 0), this.drawingImgUrl = u.toDataURL("image/png"), this.setDrawingImage(), this._state = "select", this.onMarkerCreated && this.onMarkerCreated(this);
|
|
1041
|
+
}
|
|
1042
|
+
this.overlayContainer.innerHTML = "";
|
|
1043
|
+
}, e.prototype.setDrawingImage = function() {
|
|
1044
|
+
h.setAttributes(this.drawingImage, [["width", this.width.toString()], ["height", this.height.toString()]]), h.setAttributes(this.drawingImage, [["href", this.drawingImgUrl]]), this.moveVisual({ x: this.left, y: this.top });
|
|
1045
|
+
}, e.prototype.setColor = function(t) {
|
|
1046
|
+
this.color = t, this.colorChanged(t);
|
|
1047
|
+
}, e.prototype.setLineWidth = function(t) {
|
|
1048
|
+
this.lineWidth = t;
|
|
1049
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1050
|
+
return this.state === "new" || this.state === "creating" ? [this.colorPanel, this.lineWidthPanel] : [];
|
|
1051
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1052
|
+
var t = Object.assign({ drawingImgUrl: this.drawingImgUrl }, o.prototype.getState.call(this));
|
|
1053
|
+
return t.typeName = e.typeName, t;
|
|
1054
|
+
}, e.prototype.restoreState = function(t) {
|
|
1055
|
+
this.createVisual(), o.prototype.restoreState.call(this, t), this.drawingImgUrl = t.drawingImgUrl, this.setDrawingImage();
|
|
1056
|
+
}, e.prototype.scale = function(t, s) {
|
|
1057
|
+
o.prototype.scale.call(this, t, s), this.setDrawingImage();
|
|
1058
|
+
}, e.typeName = "FreehandMarker", e.title = "Freehand marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>', e;
|
|
1059
|
+
}(B), it = function(o) {
|
|
1060
|
+
function e(t, s, r, i) {
|
|
1061
|
+
var n = o.call(this, t, r || '<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>', i || "arrow-type-panel") || this;
|
|
1062
|
+
return n.typeBoxes = [], n.currentType = s, n.setCurrentType = n.setCurrentType.bind(n), n;
|
|
1063
|
+
}
|
|
1064
|
+
return d(e, o), e.prototype.getUi = function() {
|
|
1065
|
+
var t = this, s = document.createElement("div");
|
|
1066
|
+
s.style.display = "flex", s.style.overflow = "hidden", s.style.flexGrow = "2";
|
|
1067
|
+
for (var r = function(a) {
|
|
1068
|
+
var c = "both";
|
|
1069
|
+
switch (a) {
|
|
1070
|
+
case 0:
|
|
1071
|
+
c = "both";
|
|
1072
|
+
break;
|
|
1073
|
+
case 1:
|
|
1074
|
+
c = "start";
|
|
1075
|
+
break;
|
|
1076
|
+
case 2:
|
|
1077
|
+
c = "end";
|
|
1078
|
+
break;
|
|
1079
|
+
case 3:
|
|
1080
|
+
c = "none";
|
|
1081
|
+
}
|
|
1082
|
+
var p = document.createElement("div");
|
|
1083
|
+
if (p.style.display = "flex", p.style.flexGrow = "2", p.style.alignItems = "center", p.style.justifyContent = "space-between", p.style.padding = "5px", p.style.borderWidth = "2px", p.style.borderStyle = "solid", p.style.borderColor = c === i.currentType ? i.uiStyleSettings.toolboxAccentColor : "transparent", p.addEventListener("click", function() {
|
|
1084
|
+
t.setCurrentType(c, p);
|
|
1085
|
+
}), s.appendChild(p), c === "both" || c === "start") {
|
|
1086
|
+
var l = document.createElement("div");
|
|
1087
|
+
l.style.display = "flex", l.style.alignItems = "center", l.style.minHeight = "20px", l.innerHTML = `<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
1088
|
+
<polygon points="0,5 10,0 10,10" fill="` + (i.uiStyleSettings !== void 0 ? i.uiStyleSettings.toolboxColor : "#eeeeee") + `" />
|
|
1089
|
+
</svg>`, l.style.marginLeft = "5px", p.appendChild(l);
|
|
1090
|
+
}
|
|
1091
|
+
var u = document.createElement("div");
|
|
1092
|
+
u.style.display = "flex", u.style.alignItems = "center", u.style.minHeight = "20px", u.style.flexGrow = "2";
|
|
1093
|
+
var g = document.createElement("hr");
|
|
1094
|
+
if (g.style.minWidth = "20px", g.style.border = "0px", g.style.borderTop = "3px solid " + (i.uiStyleSettings !== void 0 ? i.uiStyleSettings.toolboxColor : "#eeeeee"), g.style.flexGrow = "2", u.appendChild(g), p.appendChild(u), c === "both" || c === "end") {
|
|
1095
|
+
var C = document.createElement("div");
|
|
1096
|
+
C.style.display = "flex", C.style.alignItems = "center", C.style.minHeight = "20px", C.innerHTML = `<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
1097
|
+
<polygon points="0,0 10,5 0,10" fill="` + (i.uiStyleSettings !== void 0 ? i.uiStyleSettings.toolboxColor : "#eeeeee") + `" />
|
|
1098
|
+
</svg>`, C.style.marginRight = "5px", p.appendChild(C);
|
|
1099
|
+
}
|
|
1100
|
+
i.typeBoxes.push(p);
|
|
1101
|
+
}, i = this, n = 0; n < 4; n++) r(n);
|
|
1102
|
+
return s;
|
|
1103
|
+
}, e.prototype.setCurrentType = function(t, s) {
|
|
1104
|
+
var r = this;
|
|
1105
|
+
this.currentType = t, this.typeBoxes.forEach(function(i) {
|
|
1106
|
+
i.style.borderColor = i === s ? r.uiStyleSettings !== void 0 ? r.uiStyleSettings.toolboxAccentColor : "#3080c3" : "transparent";
|
|
1107
|
+
}), this.onArrowTypeChanged && this.onArrowTypeChanged(this.currentType);
|
|
1108
|
+
}, e;
|
|
1109
|
+
}(x), L = function(o) {
|
|
1110
|
+
function e(t, s, r) {
|
|
1111
|
+
var i = o.call(this, t, s, r) || this;
|
|
1112
|
+
return i.arrowType = "end", i.arrowBaseHeight = 10, i.arrowBaseWidth = 10, i.getArrowPoints = i.getArrowPoints.bind(i), i.setArrowType = i.setArrowType.bind(i), i.arrowTypePanel = new it("Arrow type", "end"), i.arrowTypePanel.onArrowTypeChanged = i.setArrowType, i;
|
|
1113
|
+
}
|
|
1114
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
1115
|
+
return !(!o.prototype.ownsTarget.call(this, t) && t !== this.arrow1 && t !== this.arrow2);
|
|
1116
|
+
}, e.prototype.getArrowPoints = function(t, s) {
|
|
1117
|
+
var r = this.arrowBaseWidth + 2 * this.strokeWidth, i = this.arrowBaseHeight + 2 * this.strokeWidth;
|
|
1118
|
+
return t - r / 2 + "," + (s + i / 2) + " " + t + "," + (s - i / 2) + " " + (t + r / 2) + "," + (s + i / 2);
|
|
1119
|
+
}, e.prototype.createTips = function() {
|
|
1120
|
+
this.arrow1 = h.createPolygon(this.getArrowPoints(this.x1, this.y1), [["fill", this.strokeColor]]), this.arrow1.transform.baseVal.appendItem(h.createTransform()), this.visual.appendChild(this.arrow1), this.arrow2 = h.createPolygon(this.getArrowPoints(this.x2, this.y2), [["fill", this.strokeColor]]), this.arrow2.transform.baseVal.appendItem(h.createTransform()), this.visual.appendChild(this.arrow2);
|
|
1121
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
1122
|
+
o.prototype.pointerDown.call(this, t, s), this.state === "creating" && this.createTips();
|
|
1123
|
+
}, e.prototype.adjustVisual = function() {
|
|
1124
|
+
if (o.prototype.adjustVisual.call(this), this.arrow1 && this.arrow2) {
|
|
1125
|
+
this.arrow1.style.display = this.arrowType === "both" || this.arrowType === "start" ? "" : "none", this.arrow2.style.display = this.arrowType === "both" || this.arrowType === "end" ? "" : "none", h.setAttributes(this.arrow1, [["points", this.getArrowPoints(this.x1, this.y1)], ["fill", this.strokeColor]]), h.setAttributes(this.arrow2, [["points", this.getArrowPoints(this.x2, this.y2)], ["fill", this.strokeColor]]);
|
|
1126
|
+
var t = 0;
|
|
1127
|
+
Math.abs(this.x1 - this.x2) > 0.1 && (t = 180 * Math.atan((this.y2 - this.y1) / (this.x2 - this.x1)) / Math.PI + 90 * Math.sign(this.x1 - this.x2));
|
|
1128
|
+
var s = this.arrow1.transform.baseVal.getItem(0);
|
|
1129
|
+
s.setRotate(t, this.x1, this.y1), this.arrow1.transform.baseVal.replaceItem(s, 0);
|
|
1130
|
+
var r = this.arrow2.transform.baseVal.getItem(0);
|
|
1131
|
+
r.setRotate(t + 180, this.x2, this.y2), this.arrow2.transform.baseVal.replaceItem(r, 0);
|
|
1132
|
+
}
|
|
1133
|
+
}, e.prototype.setArrowType = function(t) {
|
|
1134
|
+
this.arrowType = t, this.adjustVisual(), this.stateChanged();
|
|
1135
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1136
|
+
return [this.strokePanel, this.strokeWidthPanel, this.strokeStylePanel, this.arrowTypePanel];
|
|
1137
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1138
|
+
var t = Object.assign({ arrowType: this.arrowType }, o.prototype.getState.call(this));
|
|
1139
|
+
return t.typeName = e.typeName, t;
|
|
1140
|
+
}, e.prototype.restoreState = function(t) {
|
|
1141
|
+
o.prototype.restoreState.call(this, t);
|
|
1142
|
+
var s = t;
|
|
1143
|
+
this.arrowType = s.arrowType, this.createTips(), this.adjustVisual();
|
|
1144
|
+
}, e.typeName = "ArrowMarker", e.title = "Arrow marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>', e;
|
|
1145
|
+
}(I), X = function(o) {
|
|
1146
|
+
function e(t, s, r) {
|
|
1147
|
+
var i = o.call(this, t, s, r) || this;
|
|
1148
|
+
return i.fillColor = r.defaultFillColor, i.strokeWidth = 0, i.fillPanel = new f("Color", r.defaultColorSet, r.defaultFillColor), i.fillPanel.onColorChanged = i.setFillColor, i;
|
|
1149
|
+
}
|
|
1150
|
+
return d(e, o), Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1151
|
+
return [this.fillPanel];
|
|
1152
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1153
|
+
var t = o.prototype.getState.call(this);
|
|
1154
|
+
return t.typeName = e.typeName, t;
|
|
1155
|
+
}, e.typeName = "CoverMarker", e.title = "Cover marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>', e;
|
|
1156
|
+
}(j), Y = function(o) {
|
|
1157
|
+
function e(t, s, r, i, n) {
|
|
1158
|
+
var a = o.call(this, t, i || '<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>', n || "opacity-panel") || this;
|
|
1159
|
+
return a.opacities = [], a.opacityBoxes = [], a.opacities = s, a.currentOpacity = r, a.setCurrentOpacity = a.setCurrentOpacity.bind(a), a;
|
|
1160
|
+
}
|
|
1161
|
+
return d(e, o), e.prototype.getUi = function() {
|
|
1162
|
+
var t = this, s = document.createElement("div");
|
|
1163
|
+
return s.style.display = "flex", s.style.overflow = "hidden", s.style.flexGrow = "2", s.style.justifyContent = "space-between", this.opacities.forEach(function(r) {
|
|
1164
|
+
var i = document.createElement("div");
|
|
1165
|
+
i.style.display = "flex", i.style.alignItems = "center", i.style.justifyContent = "center", i.style.padding = "5px", i.style.borderWidth = "2px", i.style.borderStyle = "solid", i.style.borderColor = r === t.currentOpacity ? t.uiStyleSettings.toolboxAccentColor : "transparent", i.addEventListener("click", function() {
|
|
1166
|
+
t.setCurrentOpacity(r, i);
|
|
1167
|
+
}), s.appendChild(i);
|
|
1168
|
+
var n = document.createElement("div");
|
|
1169
|
+
n.innerText = 100 * r + "%", i.appendChild(n), t.opacityBoxes.push(i);
|
|
1170
|
+
}), s;
|
|
1171
|
+
}, e.prototype.setCurrentOpacity = function(t, s) {
|
|
1172
|
+
var r = this;
|
|
1173
|
+
this.currentOpacity = t, this.opacityBoxes.forEach(function(i) {
|
|
1174
|
+
i.style.borderColor = i === s ? r.uiStyleSettings.toolboxAccentColor : "transparent";
|
|
1175
|
+
}), this.onOpacityChanged && this.onOpacityChanged(this.currentOpacity);
|
|
1176
|
+
}, e;
|
|
1177
|
+
}(x), D = function(o) {
|
|
1178
|
+
function e(t, s, r) {
|
|
1179
|
+
var i = o.call(this, t, s, r) || this;
|
|
1180
|
+
return i.setOpacity = i.setOpacity.bind(i), i.fillColor = r.defaultHighlightColor, i.strokeWidth = 0, i.opacity = r.defaultHighlightOpacity, i.fillPanel = new f("Color", r.defaultColorSet, i.fillColor), i.fillPanel.onColorChanged = i.setFillColor, i.opacityPanel = new Y("Opacity", r.defaultOpacitySteps, i.opacity), i.opacityPanel.onOpacityChanged = i.setOpacity, i;
|
|
1181
|
+
}
|
|
1182
|
+
return d(e, o), e.prototype.setOpacity = function(t) {
|
|
1183
|
+
this.opacity = t, this.visual && h.setAttributes(this.visual, [["opacity", this.opacity.toString()]]), this.stateChanged();
|
|
1184
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1185
|
+
return [this.fillPanel, this.opacityPanel];
|
|
1186
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1187
|
+
var t = o.prototype.getState.call(this);
|
|
1188
|
+
return t.typeName = e.typeName, t;
|
|
1189
|
+
}, e.typeName = "HighlightMarker", e.title = "Highlight marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>', e;
|
|
1190
|
+
}(X), Z = '<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>', N = '<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>', V = function(o) {
|
|
1191
|
+
function e(t, s, r) {
|
|
1192
|
+
var i = o.call(this, t, s, r) || this;
|
|
1193
|
+
return i.bgColor = "transparent", i.tipPosition = { x: 0, y: 0 }, i.tipBase1Position = { x: 0, y: 0 }, i.tipBase2Position = { x: 0, y: 0 }, i.tipMoving = !1, i.color = r.defaultStrokeColor, i.bgColor = r.defaultFillColor, i.fontFamily = r.defaultFontFamily, i.defaultSize = { x: 100, y: 30 }, i.setBgColor = i.setBgColor.bind(i), i.getTipPoints = i.getTipPoints.bind(i), i.positionTip = i.positionTip.bind(i), i.setTipPoints = i.setTipPoints.bind(i), i.colorPanel = new f("Text color", r.defaultColorSet, i.color, Z, "text-color-panel"), i.colorPanel.onColorChanged = i.setColor, i.bgColorPanel = new f("Fill color", r.defaultColorSet, i.bgColor, N, "fill-color-panel"), i.bgColorPanel.onColorChanged = i.setBgColor, i.fontFamilyPanel = new W("Font", r.defaultFontFamilies, r.defaultFontFamily), i.fontFamilyPanel.onFontChanged = i.setFont, i.tipGrip = new _(), i.tipGrip.visual.transform.baseVal.appendItem(h.createTransform()), i.controlBox.appendChild(i.tipGrip.visual), i;
|
|
1194
|
+
}
|
|
1195
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
1196
|
+
return o.prototype.ownsTarget.call(this, t) || this.tipGrip.ownsTarget(t) || this.tip === t;
|
|
1197
|
+
}, e.prototype.createTip = function() {
|
|
1198
|
+
h.setAttributes(this.bgRectangle, [["fill", this.bgColor], ["rx", "10px"]]), this.tip = h.createPolygon(this.getTipPoints(), [["fill", this.bgColor]]), this.visual.appendChild(this.tip);
|
|
1199
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
1200
|
+
this.state === "new" && o.prototype.pointerDown.call(this, t, s), this.state === "creating" ? this.createTip() : this.tipGrip.ownsTarget(s) ? (this.manipulationStartLeft = this.left, this.manipulationStartTop = this.top, this.tipMoving = !0) : o.prototype.pointerDown.call(this, t, s);
|
|
1201
|
+
}, e.prototype.pointerUp = function(t) {
|
|
1202
|
+
if (this.tipMoving) this.tipMoving = !1, this.isMoved = !0, o.prototype.pointerUp.call(this, t);
|
|
1203
|
+
else {
|
|
1204
|
+
var s = this.state === "creating";
|
|
1205
|
+
o.prototype.pointerUp.call(this, t), this.setTipPoints(s), this.positionTip();
|
|
1206
|
+
}
|
|
1207
|
+
}, e.prototype.manipulate = function(t) {
|
|
1208
|
+
if (this.tipMoving) {
|
|
1209
|
+
var s = this.unrotatePoint(t);
|
|
1210
|
+
this.tipPosition = { x: s.x - this.manipulationStartLeft, y: s.y - this.manipulationStartTop }, this.positionTip();
|
|
1211
|
+
} else o.prototype.manipulate.call(this, t);
|
|
1212
|
+
}, e.prototype.setBgColor = function(t) {
|
|
1213
|
+
this.bgRectangle && this.tip && (h.setAttributes(this.bgRectangle, [["fill", t]]), h.setAttributes(this.tip, [["fill", t]])), this.bgColor = t, this.fillColorChanged(t);
|
|
1214
|
+
}, e.prototype.getTipPoints = function() {
|
|
1215
|
+
return this.setTipPoints(this.state === "creating"), this.tipBase1Position.x + "," + this.tipBase1Position.y + " " + this.tipBase2Position.x + "," + this.tipBase2Position.y + " " + this.tipPosition.x + "," + this.tipPosition.y;
|
|
1216
|
+
}, e.prototype.setTipPoints = function(t) {
|
|
1217
|
+
t === void 0 && (t = !1);
|
|
1218
|
+
var s = Math.min(this.height / 2, 15), r = this.height / 5;
|
|
1219
|
+
t && (this.tipPosition = { x: s + r / 2, y: this.height + 20 });
|
|
1220
|
+
var i = Math.atan(this.height / 2 / (this.width / 2));
|
|
1221
|
+
this.tipPosition.x < this.width / 2 && this.tipPosition.y < this.height / 2 ? i < Math.atan((this.height / 2 - this.tipPosition.y) / (this.width / 2 - this.tipPosition.x)) ? (r = this.width / 5, s = Math.min(this.width / 2, 15), this.tipBase1Position = { x: s, y: 0 }, this.tipBase2Position = { x: s + r, y: 0 }) : (this.tipBase1Position = { x: 0, y: s }, this.tipBase2Position = { x: 0, y: s + r }) : this.tipPosition.x >= this.width / 2 && this.tipPosition.y < this.height / 2 ? i < Math.atan((this.height / 2 - this.tipPosition.y) / (this.tipPosition.x - this.width / 2)) ? (r = this.width / 5, s = Math.min(this.width / 2, 15), this.tipBase1Position = { x: this.width - s - r, y: 0 }, this.tipBase2Position = { x: this.width - s, y: 0 }) : (this.tipBase1Position = { x: this.width, y: s }, this.tipBase2Position = { x: this.width, y: s + r }) : this.tipPosition.x >= this.width / 2 && this.tipPosition.y >= this.height / 2 ? i < Math.atan((this.tipPosition.y - this.height / 2) / (this.tipPosition.x - this.width / 2)) ? (r = this.width / 5, s = Math.min(this.width / 2, 15), this.tipBase1Position = { x: this.width - s - r, y: this.height }, this.tipBase2Position = { x: this.width - s, y: this.height }) : (this.tipBase1Position = { x: this.width, y: this.height - s - r }, this.tipBase2Position = { x: this.width, y: this.height - s }) : i < Math.atan((this.tipPosition.y - this.height / 2) / (this.width / 2 - this.tipPosition.x)) ? (r = this.width / 5, s = Math.min(this.width / 2, 15), this.tipBase1Position = { x: s, y: this.height }, this.tipBase2Position = { x: s + r, y: this.height }) : (this.tipBase1Position = { x: 0, y: this.height - s }, this.tipBase2Position = { x: 0, y: this.height - s - r });
|
|
1222
|
+
}, e.prototype.resize = function(t) {
|
|
1223
|
+
o.prototype.resize.call(this, t), this.positionTip();
|
|
1224
|
+
}, e.prototype.positionTip = function() {
|
|
1225
|
+
h.setAttributes(this.tip, [["points", this.getTipPoints()]]);
|
|
1226
|
+
var t = this.tipGrip.visual.transform.baseVal.getItem(0);
|
|
1227
|
+
t.setTranslate(this.tipPosition.x, this.tipPosition.y), this.tipGrip.visual.transform.baseVal.replaceItem(t, 0);
|
|
1228
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1229
|
+
return [this.colorPanel, this.bgColorPanel, this.fontFamilyPanel];
|
|
1230
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.select = function() {
|
|
1231
|
+
this.positionTip(), o.prototype.select.call(this);
|
|
1232
|
+
}, e.prototype.getState = function() {
|
|
1233
|
+
var t = Object.assign({ bgColor: this.bgColor, tipPosition: this.tipPosition }, o.prototype.getState.call(this));
|
|
1234
|
+
return t.typeName = e.typeName, t;
|
|
1235
|
+
}, e.prototype.restoreState = function(t) {
|
|
1236
|
+
var s = t;
|
|
1237
|
+
this.bgColor = s.bgColor, this.tipPosition = s.tipPosition, o.prototype.restoreState.call(this, t), this.createTip(), this.setTipPoints();
|
|
1238
|
+
}, e.prototype.scale = function(t, s) {
|
|
1239
|
+
o.prototype.scale.call(this, t, s), this.tipPosition = { x: this.tipPosition.x * t, y: this.tipPosition.y * s }, this.positionTip();
|
|
1240
|
+
}, e.typeName = "CalloutMarker", e.title = "Callout marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>', e;
|
|
1241
|
+
}(w), A = function(o) {
|
|
1242
|
+
function e(t, s, r) {
|
|
1243
|
+
var i = o.call(this, t, s, r) || this;
|
|
1244
|
+
return i.fillColor = "transparent", i.strokeColor = "transparent", i.strokeWidth = 0, i.strokeDasharray = "", i.opacity = 1, i.strokeColor = r.defaultColor, i.strokeWidth = r.defaultStrokeWidth, i.strokeDasharray = r.defaultStrokeDasharray, i.fillColor = r.defaultFillColor, i.setStrokeColor = i.setStrokeColor.bind(i), i.setFillColor = i.setFillColor.bind(i), i.setStrokeWidth = i.setStrokeWidth.bind(i), i.setStrokeDasharray = i.setStrokeDasharray.bind(i), i.setOpacity = i.setOpacity.bind(i), i.createVisual = i.createVisual.bind(i), i.strokePanel = new f("Line color", E(r.defaultColorSet, ["transparent"]), r.defaultColor, void 0, "stroke-color-panel"), i.strokePanel.onColorChanged = i.setStrokeColor, i.fillPanel = new f("Fill color", E(r.defaultColorSet, ["transparent"]), i.fillColor, N, "fill-color-panel"), i.fillPanel.onColorChanged = i.setFillColor, i.strokeWidthPanel = new S("Line width", r.defaultStrokeWidths, r.defaultStrokeWidth), i.strokeWidthPanel.onWidthChanged = i.setStrokeWidth, i.strokeStylePanel = new M("Line style", r.defaultStrokeDasharrays, r.defaultStrokeDasharray), i.strokeStylePanel.onStyleChanged = i.setStrokeDasharray, i.opacityPanel = new Y("Opacity", r.defaultOpacitySteps, i.opacity), i.opacityPanel.onOpacityChanged = i.setOpacity, i;
|
|
1245
|
+
}
|
|
1246
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
1247
|
+
return !(!o.prototype.ownsTarget.call(this, t) && t !== this.visual);
|
|
1248
|
+
}, e.prototype.createVisual = function() {
|
|
1249
|
+
this.visual = h.createEllipse(this.width / 2, this.height / 2, [["fill", this.fillColor], ["stroke", this.strokeColor], ["stroke-width", this.strokeWidth.toString()], ["stroke-dasharray", this.strokeDasharray], ["opacity", this.opacity.toString()]]), this.addMarkerVisualToContainer(this.visual);
|
|
1250
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
1251
|
+
o.prototype.pointerDown.call(this, t, s), this.state === "new" && (this.createVisual(), this.moveVisual(t), this._state = "creating");
|
|
1252
|
+
}, e.prototype.manipulate = function(t) {
|
|
1253
|
+
o.prototype.manipulate.call(this, t);
|
|
1254
|
+
}, e.prototype.resize = function(t) {
|
|
1255
|
+
o.prototype.resize.call(this, t), this.setSize();
|
|
1256
|
+
}, e.prototype.setSize = function() {
|
|
1257
|
+
o.prototype.setSize.call(this), h.setAttributes(this.visual, [["cx", (this.width / 2).toString()], ["cy", (this.height / 2).toString()], ["rx", (this.width / 2).toString()], ["ry", (this.height / 2).toString()]]);
|
|
1258
|
+
}, e.prototype.pointerUp = function(t) {
|
|
1259
|
+
o.prototype.pointerUp.call(this, t), this.setSize();
|
|
1260
|
+
}, e.prototype.setStrokeColor = function(t) {
|
|
1261
|
+
this.strokeColor = t, this.visual && h.setAttributes(this.visual, [["stroke", this.strokeColor]]), this.colorChanged(t), this.stateChanged();
|
|
1262
|
+
}, e.prototype.setFillColor = function(t) {
|
|
1263
|
+
this.fillColor = t, this.visual && h.setAttributes(this.visual, [["fill", this.fillColor]]), this.fillColorChanged(t), this.stateChanged();
|
|
1264
|
+
}, e.prototype.setStrokeWidth = function(t) {
|
|
1265
|
+
this.strokeWidth = t, this.visual && h.setAttributes(this.visual, [["stroke-width", this.strokeWidth.toString()]]), this.stateChanged();
|
|
1266
|
+
}, e.prototype.setStrokeDasharray = function(t) {
|
|
1267
|
+
this.strokeDasharray = t, this.visual && h.setAttributes(this.visual, [["stroke-dasharray", this.strokeDasharray]]), this.stateChanged();
|
|
1268
|
+
}, e.prototype.setOpacity = function(t) {
|
|
1269
|
+
this.opacity = t, this.visual && h.setAttributes(this.visual, [["opacity", this.opacity.toString()]]), this.stateChanged();
|
|
1270
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1271
|
+
return [this.strokePanel, this.fillPanel, this.strokeWidthPanel, this.strokeStylePanel, this.opacityPanel];
|
|
1272
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1273
|
+
var t = Object.assign({ fillColor: this.fillColor, strokeColor: this.strokeColor, strokeWidth: this.strokeWidth, strokeDasharray: this.strokeDasharray, opacity: this.opacity }, o.prototype.getState.call(this));
|
|
1274
|
+
return t.typeName = e.typeName, t;
|
|
1275
|
+
}, e.prototype.restoreState = function(t) {
|
|
1276
|
+
var s = t;
|
|
1277
|
+
this.fillColor = s.fillColor, this.strokeColor = s.strokeColor, this.strokeWidth = s.strokeWidth, this.strokeDasharray = s.strokeDasharray, this.opacity = s.opacity, this.createVisual(), o.prototype.restoreState.call(this, t), this.setSize();
|
|
1278
|
+
}, e.prototype.scale = function(t, s) {
|
|
1279
|
+
o.prototype.scale.call(this, t, s), this.setSize();
|
|
1280
|
+
}, e.typeName = "EllipseMarker", e.title = "Ellipse marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>', e;
|
|
1281
|
+
}(B), st = function(o) {
|
|
1282
|
+
function e(t, s, r) {
|
|
1283
|
+
return o.call(this, t, s, r) || this;
|
|
1284
|
+
}
|
|
1285
|
+
return d(e, o), Object.defineProperty(e.prototype, "tipLength", { get: function() {
|
|
1286
|
+
return 10 + 3 * this.strokeWidth;
|
|
1287
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.ownsTarget = function(t) {
|
|
1288
|
+
return !(!o.prototype.ownsTarget.call(this, t) && t !== this.tip1 && t !== this.tip2);
|
|
1289
|
+
}, e.prototype.createTips = function() {
|
|
1290
|
+
this.tip1 = h.createLine(this.x1 - this.tipLength / 2, this.y1, this.x1 + this.tipLength / 2, this.y1, [["stroke", this.strokeColor], ["stroke-width", this.strokeWidth.toString()]]), this.tip1.transform.baseVal.appendItem(h.createTransform()), this.visual.appendChild(this.tip1), this.tip2 = h.createLine(this.x2 - this.tipLength / 2, this.y2, this.x2 + this.tipLength / 2, this.y2, [["stroke", this.strokeColor], ["stroke-width", this.strokeWidth.toString()]]), this.tip2.transform.baseVal.appendItem(h.createTransform()), this.visual.appendChild(this.tip2);
|
|
1291
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
1292
|
+
o.prototype.pointerDown.call(this, t, s), this.state === "creating" && this.createTips();
|
|
1293
|
+
}, e.prototype.adjustVisual = function() {
|
|
1294
|
+
if (o.prototype.adjustVisual.call(this), this.tip1 && this.tip2 && (h.setAttributes(this.tip1, [["x1", (this.x1 - this.tipLength / 2).toString()], ["y1", this.y1.toString()], ["x2", (this.x1 + this.tipLength / 2).toString()], ["y2", this.y1.toString()], ["stroke", this.strokeColor], ["stroke-width", this.strokeWidth.toString()]]), h.setAttributes(this.tip2, [["x1", (this.x2 - this.tipLength / 2).toString()], ["y1", this.y2.toString()], ["x2", (this.x2 + this.tipLength / 2).toString()], ["y2", this.y2.toString()], ["stroke", this.strokeColor], ["stroke-width", this.strokeWidth.toString()]]), Math.abs(this.x1 - this.x2) > 0.1)) {
|
|
1295
|
+
var t = 180 * Math.atan((this.y2 - this.y1) / (this.x2 - this.x1)) / Math.PI + 90 * Math.sign(this.x1 - this.x2), s = this.tip1.transform.baseVal.getItem(0);
|
|
1296
|
+
s.setRotate(t, this.x1, this.y1), this.tip1.transform.baseVal.replaceItem(s, 0);
|
|
1297
|
+
var r = this.tip2.transform.baseVal.getItem(0);
|
|
1298
|
+
r.setRotate(t + 180, this.x2, this.y2), this.tip2.transform.baseVal.replaceItem(r, 0);
|
|
1299
|
+
}
|
|
1300
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1301
|
+
return [this.strokePanel, this.strokeWidthPanel, this.strokeStylePanel];
|
|
1302
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1303
|
+
var t = o.prototype.getState.call(this);
|
|
1304
|
+
return t.typeName = e.typeName, t;
|
|
1305
|
+
}, e.prototype.restoreState = function(t) {
|
|
1306
|
+
o.prototype.restoreState.call(this, t), this.createTips(), this.adjustVisual();
|
|
1307
|
+
}, e.typeName = "MeasurementMarker", e.title = "Measurement marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>', e;
|
|
1308
|
+
}(I), ot = function(o) {
|
|
1309
|
+
function e(t, s, r) {
|
|
1310
|
+
var i = o.call(this, t, s, r) || this;
|
|
1311
|
+
return i.strokePanel.colors = r.defaultColorSet, i.fillColor = "transparent", i;
|
|
1312
|
+
}
|
|
1313
|
+
return d(e, o), Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1314
|
+
return [this.strokePanel, this.strokeWidthPanel, this.strokeStylePanel];
|
|
1315
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1316
|
+
var t = o.prototype.getState.call(this);
|
|
1317
|
+
return t.typeName = e.typeName, t;
|
|
1318
|
+
}, e.typeName = "EllipseFrameMarker", e.title = "Ellipse frame marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>', e;
|
|
1319
|
+
}(A), rt = function() {
|
|
1320
|
+
function o() {
|
|
1321
|
+
this.undoStack = [], this.redoStack = [];
|
|
1322
|
+
}
|
|
1323
|
+
return Object.defineProperty(o.prototype, "isUndoPossible", { get: function() {
|
|
1324
|
+
return this.undoStack.length > 0;
|
|
1325
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "isRedoPossible", { get: function() {
|
|
1326
|
+
return this.redoStack.length > 0;
|
|
1327
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "undoStepCount", { get: function() {
|
|
1328
|
+
return this.undoStack.length;
|
|
1329
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "redoStepCount", { get: function() {
|
|
1330
|
+
return this.redoStack.length;
|
|
1331
|
+
}, enumerable: !1, configurable: !0 }), o.prototype.addUndoStep = function(e) {
|
|
1332
|
+
this.undoStack.length !== 0 && JSON.stringify(this.undoStack[this.undoStack.length - 1]) === JSON.stringify(e) || (this.undoStack.push(e), JSON.stringify(this.lastRedoStep) !== JSON.stringify(e) && this.redoStack.splice(0, this.redoStack.length));
|
|
1333
|
+
}, o.prototype.replaceLastUndoStep = function(e) {
|
|
1334
|
+
this.undoStack.length > 0 && (this.undoStack[this.undoStack.length - 1] = e);
|
|
1335
|
+
}, o.prototype.getLastUndoStep = function() {
|
|
1336
|
+
return this.undoStack.length > 0 ? this.undoStack[this.undoStack.length - 1] : void 0;
|
|
1337
|
+
}, o.prototype.undo = function() {
|
|
1338
|
+
if (this.undoStack.length > 1) {
|
|
1339
|
+
var e = this.undoStack.pop();
|
|
1340
|
+
return e !== void 0 && this.redoStack.push(e), this.undoStack.length > 0 ? this.undoStack[this.undoStack.length - 1] : void 0;
|
|
1341
|
+
}
|
|
1342
|
+
}, o.prototype.redo = function() {
|
|
1343
|
+
return this.lastRedoStep = this.redoStack.pop(), this.lastRedoStep;
|
|
1344
|
+
}, o;
|
|
1345
|
+
}(), nt = function(o) {
|
|
1346
|
+
function e(t, s, r) {
|
|
1347
|
+
var i = o.call(this, t, s, r) || this;
|
|
1348
|
+
return i.strokeColor = "transparent", i.strokeWidth = 0, i.strokeDasharray = "", i.curveX = 0, i.curveY = 0, i.manipulationStartCurveX = 0, i.manipulationStartCurveY = 0, i.setStrokeColor = i.setStrokeColor.bind(i), i.setStrokeWidth = i.setStrokeWidth.bind(i), i.setStrokeDasharray = i.setStrokeDasharray.bind(i), i.positionGrips = i.positionGrips.bind(i), i.addControlGrips = i.addControlGrips.bind(i), i.adjustVisual = i.adjustVisual.bind(i), i.setupControlBox = i.setupControlBox.bind(i), i.resize = i.resize.bind(i), i.strokeColor = r.defaultColor, i.strokeWidth = r.defaultStrokeWidth, i.strokeDasharray = r.defaultStrokeDasharray, i.strokePanel = new f("Line color", r.defaultColorSet, r.defaultColor), i.strokePanel.onColorChanged = i.setStrokeColor, i.strokeWidthPanel = new S("Line width", r.defaultStrokeWidths, r.defaultStrokeWidth), i.strokeWidthPanel.onWidthChanged = i.setStrokeWidth, i.strokeStylePanel = new M("Line style", r.defaultStrokeDasharrays, r.defaultStrokeDasharray), i.strokeStylePanel.onStyleChanged = i.setStrokeDasharray, i;
|
|
1349
|
+
}
|
|
1350
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
1351
|
+
return !(!o.prototype.ownsTarget.call(this, t) && t !== this.visual && t !== this.selectorCurve && t !== this.visibleCurve && !this.curveGrip.ownsTarget(t));
|
|
1352
|
+
}, e.prototype.getPathD = function() {
|
|
1353
|
+
return "M " + this.x1 + " " + this.y1 + " Q " + this.curveX + " " + this.curveY + ", " + this.x2 + " " + this.y2;
|
|
1354
|
+
}, e.prototype.createVisual = function() {
|
|
1355
|
+
this.visual = h.createGroup(), this.selectorCurve = h.createPath(this.getPathD(), [["stroke", "transparent"], ["stroke-width", (this.strokeWidth + 10).toString()], ["fill", "transparent"]]), this.visibleCurve = h.createPath(this.getPathD(), [["stroke", this.strokeColor], ["stroke-width", this.strokeWidth.toString()], ["fill", "transparent"]]), this.visual.appendChild(this.selectorCurve), this.visual.appendChild(this.visibleCurve), this.addMarkerVisualToContainer(this.visual);
|
|
1356
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
1357
|
+
o.prototype.pointerDown.call(this, t, s), this.manipulationStartCurveX = this.curveX, this.manipulationStartCurveY = this.curveY, this.state === "new" && (this.curveX = t.x, this.curveY = t.y), this.state === "new" ? (this.createVisual(), this.adjustVisual(), this._state = "creating") : this.curveGrip.ownsTarget(s) && (this.activeGrip = this.curveGrip, this._state = "resize");
|
|
1358
|
+
}, e.prototype.adjustVisual = function() {
|
|
1359
|
+
this.selectorCurve && this.visibleCurve && (this.selectorCurve.setAttribute("d", this.getPathD()), this.visibleCurve.setAttribute("d", this.getPathD()), h.setAttributes(this.visibleCurve, [["stroke", this.strokeColor]]), h.setAttributes(this.visibleCurve, [["stroke-width", this.strokeWidth.toString()]]), h.setAttributes(this.visibleCurve, [["stroke-dasharray", this.strokeDasharray.toString()]]));
|
|
1360
|
+
}, e.prototype.setupControlBox = function() {
|
|
1361
|
+
o.prototype.setupControlBox.call(this), this.curveControlLine1 = h.createLine(this.x1, this.y1, this.curveX, this.curveY, [["stroke", "black"], ["stroke-width", "1"], ["stroke-opacity", "0.5"], ["stroke-dasharray", "3, 2"]]), this.curveControlLine2 = h.createLine(this.x2, this.y2, this.curveX, this.curveY, [["stroke", "black"], ["stroke-width", "1"], ["stroke-opacity", "0.5"], ["stroke-dasharray", "3, 2"]]), this.controlBox.insertBefore(this.curveControlLine1, this.controlBox.firstChild), this.controlBox.insertBefore(this.curveControlLine2, this.controlBox.firstChild);
|
|
1362
|
+
}, e.prototype.addControlGrips = function() {
|
|
1363
|
+
this.curveGrip = this.createGrip(), this.curveX = 0, this.curveY = 0, o.prototype.addControlGrips.call(this);
|
|
1364
|
+
}, e.prototype.positionGrips = function() {
|
|
1365
|
+
o.prototype.positionGrips.call(this);
|
|
1366
|
+
var t = this.curveGrip.GRIP_SIZE;
|
|
1367
|
+
this.positionGrip(this.curveGrip.visual, this.curveX - t / 2, this.curveY - t / 2), this.curveControlLine1 && this.curveControlLine2 && (this.curveControlLine1.setAttribute("x1", this.x1.toString()), this.curveControlLine1.setAttribute("y1", this.y1.toString()), this.curveControlLine1.setAttribute("x2", this.curveX.toString()), this.curveControlLine1.setAttribute("y2", this.curveY.toString()), this.curveControlLine2.setAttribute("x1", this.x2.toString()), this.curveControlLine2.setAttribute("y1", this.y2.toString()), this.curveControlLine2.setAttribute("x2", this.curveX.toString()), this.curveControlLine2.setAttribute("y2", this.curveY.toString()));
|
|
1368
|
+
}, e.prototype.manipulate = function(t) {
|
|
1369
|
+
this.state === "move" && (this.curveX = this.manipulationStartCurveX + t.x - this.manipulationStartX, this.curveY = this.manipulationStartCurveY + t.y - this.manipulationStartY), o.prototype.manipulate.call(this, t);
|
|
1370
|
+
}, e.prototype.resize = function(t) {
|
|
1371
|
+
this.activeGrip === this.curveGrip && (this.curveX = t.x, this.curveY = t.y), o.prototype.resize.call(this, t), this.state === "creating" && (this.curveX = this.x1 + (this.x2 - this.x1) / 2, this.curveY = this.y1 + (this.y2 - this.y1) / 2);
|
|
1372
|
+
}, e.prototype.setStrokeColor = function(t) {
|
|
1373
|
+
this.strokeColor = t, this.adjustVisual(), this.colorChanged(t);
|
|
1374
|
+
}, e.prototype.setStrokeWidth = function(t) {
|
|
1375
|
+
this.strokeWidth = t, this.adjustVisual();
|
|
1376
|
+
}, e.prototype.setStrokeDasharray = function(t) {
|
|
1377
|
+
this.strokeDasharray = t, this.adjustVisual();
|
|
1378
|
+
}, e.prototype.scale = function(t, s) {
|
|
1379
|
+
this.curveX = this.curveX * t, this.curveY = this.curveY * s, o.prototype.scale.call(this, t, s);
|
|
1380
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1381
|
+
return [this.strokePanel, this.strokeWidthPanel, this.strokeStylePanel];
|
|
1382
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1383
|
+
var t = Object.assign({ strokeColor: this.strokeColor, strokeWidth: this.strokeWidth, strokeDasharray: this.strokeDasharray, curveX: this.curveX, curveY: this.curveY }, o.prototype.getState.call(this));
|
|
1384
|
+
return t.typeName = e.typeName, t;
|
|
1385
|
+
}, e.prototype.restoreState = function(t) {
|
|
1386
|
+
o.prototype.restoreState.call(this, t);
|
|
1387
|
+
var s = t;
|
|
1388
|
+
this.strokeColor = s.strokeColor, this.strokeWidth = s.strokeWidth, this.strokeDasharray = s.strokeDasharray, this.curveX = s.curveX, this.curveY = s.curveY, this.createVisual(), this.adjustVisual();
|
|
1389
|
+
}, e.typeName = "CurveMarker", e.title = "Curve marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>', e;
|
|
1390
|
+
}(U), at = function(o) {
|
|
1391
|
+
function e(t, s, r) {
|
|
1392
|
+
var i = o.call(this, t, s, r) || this;
|
|
1393
|
+
return i.fillColor = "transparent", i.strokeColor = "transparent", i.strokeWidth = 0, i.strokeDasharray = "", i.textColor = "transparent", i.fontSize = "1rem", i.isMoved = !1, i.captionText = "Caption", i.PADDING = 5, i.captionBoxWidth = 0, i.captionBoxHeight = 0, i.strokeColor = r.defaultColor, i.strokeWidth = r.defaultStrokeWidth, i.strokeDasharray = r.defaultStrokeDasharray, i.fillColor = r.defaultFillColor, i.textColor = r.defaultStrokeColor, i.fontFamily = r.defaultFontFamily, i.fontSize = r.defaultCaptionFontSize, i.captionText = r.defaultCaptionText, i.setStrokeColor = i.setStrokeColor.bind(i), i.setFillColor = i.setFillColor.bind(i), i.setStrokeWidth = i.setStrokeWidth.bind(i), i.setStrokeDasharray = i.setStrokeDasharray.bind(i), i.createVisual = i.createVisual.bind(i), i.sizeCaption = i.sizeCaption.bind(i), i.setCaptionText = i.setCaptionText.bind(i), i.showTextEditor = i.showTextEditor.bind(i), i.positionTextEditor = i.positionTextEditor.bind(i), i.finishTextEditing = i.finishTextEditing.bind(i), i.setFont = i.setFont.bind(i), i.setTextColor = i.setTextColor.bind(i), i.strokePanel = new f("Line color", E(r.defaultColorSet, ["transparent"]), i.strokeColor, void 0, "stroke-color-panel"), i.strokePanel.onColorChanged = i.setStrokeColor, i.fillPanel = new f("Fill color", E(r.defaultColorSet, ["transparent"]), i.fillColor, N, "fill-color-panel"), i.fillPanel.onColorChanged = i.setFillColor, i.strokeWidthPanel = new S("Line width", r.defaultStrokeWidths, r.defaultStrokeWidth), i.strokeWidthPanel.onWidthChanged = i.setStrokeWidth, i.strokeStylePanel = new M("Line style", r.defaultStrokeDasharrays, r.defaultStrokeDasharray), i.strokeStylePanel.onStyleChanged = i.setStrokeDasharray, i.fontFamilyPanel = new W("Font", r.defaultFontFamilies, r.defaultFontFamily), i.fontFamilyPanel.onFontChanged = i.setFont, i.textColorPanel = new f("Text color", r.defaultColorSet, i.textColor, Z, "text-color-panel"), i.textColorPanel.onColorChanged = i.setTextColor, i;
|
|
1394
|
+
}
|
|
1395
|
+
return d(e, o), e.prototype.ownsTarget = function(t) {
|
|
1396
|
+
return !(!o.prototype.ownsTarget.call(this, t) && t !== this.visual && t !== this.frame && t !== this.captionBg && t !== this.captionElement);
|
|
1397
|
+
}, e.prototype.createVisual = function() {
|
|
1398
|
+
this.visual = h.createGroup(), this.addMarkerVisualToContainer(this.visual), this.captionBg = h.createRect(1, 1, [["fill", this.fillColor]]), this.visual.appendChild(this.captionBg), this.captionElement = h.createText([["fill", this.textColor], ["font-family", this.fontFamily]]), this.captionElement.style.fontSize = this.fontSize, this.captionElement.style.textAnchor = "start", this.captionElement.style.dominantBaseline = "text-before-edge", this.captionElement.textContent = this.captionText, this.visual.appendChild(this.captionElement), this.frame = h.createRect(this.width, this.height, [["fill", "transparent"], ["stroke", this.strokeColor], ["stroke-width", this.strokeWidth.toString()], ["stroke-dasharray", this.strokeDasharray]]), this.visual.appendChild(this.frame), this.sizeCaption();
|
|
1399
|
+
}, e.prototype.setCaptionText = function(t) {
|
|
1400
|
+
this.captionText = t, this.captionElement.textContent = this.captionText, this.sizeCaption();
|
|
1401
|
+
}, e.prototype.pointerDown = function(t, s) {
|
|
1402
|
+
o.prototype.pointerDown.call(this, t, s), this.isMoved = !1, this.pointerDownPoint = t, this.pointerDownTimestamp = Date.now(), this.state === "new" && (this.createVisual(), this.moveVisual(t), this._state = "creating");
|
|
1403
|
+
}, e.prototype.manipulate = function(t) {
|
|
1404
|
+
o.prototype.manipulate.call(this, t), this.pointerDownPoint !== void 0 && (this.isMoved = Math.abs(t.x - this.pointerDownPoint.x) > 5 || Math.abs(t.y - this.pointerDownPoint.y) > 5);
|
|
1405
|
+
}, e.prototype.resize = function(t) {
|
|
1406
|
+
o.prototype.resize.call(this, t), this.setSize();
|
|
1407
|
+
}, e.prototype.sizeCaption = function() {
|
|
1408
|
+
var t = this.captionElement.getBBox();
|
|
1409
|
+
this.captionText.trim() !== "" ? (this.captionBoxWidth = t.width + 2 * this.PADDING, this.captionBoxHeight = t.height + 2 * this.PADDING) : (this.captionBoxWidth = 0, this.captionBoxHeight = 0), h.setAttributes(this.captionBg, [["width", this.captionBoxWidth.toString()], ["height", this.captionBoxHeight.toString()], ["clip-path", "path('M0,0 H" + this.width + " V" + this.height + " H" + -this.width + " Z')"]]), h.setAttributes(this.captionElement, [["x", this.PADDING.toString()], ["y", this.PADDING.toString()], ["clip-path", "path('M0,0 H" + (this.width - this.PADDING) + " V" + this.height + " H" + (-this.width - this.PADDING) + " Z')"]]);
|
|
1410
|
+
}, e.prototype.showTextEditor = function() {
|
|
1411
|
+
var t = this;
|
|
1412
|
+
this._state = "edit", this.overlayContainer.innerHTML = "", this.textEditDiv = document.createElement("div"), this.textEditDiv.style.flexGrow = "2", this.textEditDiv.style.alignItems = "center", this.textEditDiv.style.justifyContent = "center", this.textEditDiv.style.pointerEvents = "auto", this.textEditDiv.style.overflow = "hidden", this.textEditBox = document.createElement("input"), this.textEditBox.style.position = "absolute", this.textEditBox.style.width = this.width + "px", this.captionBoxHeight > 0 && (this.textEditBox.style.height = this.captionBoxHeight + "px"), this.textEditBox.style.fontSize = this.fontSize, this.textEditBox.style.fontFamily = this.fontFamily, this.textEditBox.style.backgroundColor = this.fillColor, this.textEditBox.style.color = this.textColor, this.textEditBox.style.borderWidth = "0", this.textEditBox.setAttribute("value", this.captionText), this.textEditBox.select(), this.textEditDiv.appendChild(this.textEditBox), this.overlayContainer.appendChild(this.textEditDiv), this.textEditBox.addEventListener("pointerup", function(s) {
|
|
1413
|
+
s.stopPropagation();
|
|
1414
|
+
}), this.textEditBox.addEventListener("keypress", function(s) {
|
|
1415
|
+
s.key === "Enter" && t.finishTextEditing(t.textEditBox.value);
|
|
1416
|
+
}), this.textEditBox.addEventListener("keyup", function(s) {
|
|
1417
|
+
s.cancelBubble = !0;
|
|
1418
|
+
}), this.textEditBox.addEventListener("blur", function() {
|
|
1419
|
+
t.finishTextEditing(t.textEditBox.value);
|
|
1420
|
+
}), this.textEditDiv.addEventListener("pointerup", function() {
|
|
1421
|
+
t.finishTextEditing(t.textEditBox.value);
|
|
1422
|
+
}), this.positionTextEditor(), this.textEditBox.focus();
|
|
1423
|
+
}, e.prototype.positionTextEditor = function() {
|
|
1424
|
+
this.state === "edit" && (this.textEditBox === void 0 ? this.showTextEditor() : (this.textEditBox.style.left = this.left + "px", this.textEditBox.style.top = this.top + "px", this.textEditBox.style.transform = "rotate(" + this.rotationAngle + "deg)", this.textEditBox.style.transformOrigin = this.width / 2 + "px " + this.height / 2 + "px"));
|
|
1425
|
+
}, e.prototype.finishTextEditing = function(t) {
|
|
1426
|
+
this.setCaptionText(t.trim()), this.overlayContainer.innerHTML = "", this.stateChanged();
|
|
1427
|
+
}, e.prototype.setFont = function(t) {
|
|
1428
|
+
this.captionElement && h.setAttributes(this.captionElement, [["font-family", t]]), this.fontFamily = t, this.textEditBox && (this.textEditBox.style.fontFamily = this.fontFamily), this.sizeCaption(), this.stateChanged();
|
|
1429
|
+
}, e.prototype.setTextColor = function(t) {
|
|
1430
|
+
this.captionElement && h.setAttributes(this.captionElement, [["fill", t]]), this.textColor = t, this.textEditBox && (this.textEditBox.style.color = this.textColor), this.stateChanged();
|
|
1431
|
+
}, e.prototype.setSize = function() {
|
|
1432
|
+
o.prototype.setSize.call(this), h.setAttributes(this.frame, [["width", this.width.toString()], ["height", this.height.toString()]]), this.sizeCaption();
|
|
1433
|
+
}, e.prototype.pointerUp = function(t) {
|
|
1434
|
+
o.prototype.pointerUp.call(this, t), this.setSize(), !this.isMoved && Date.now() - this.pointerDownTimestamp > 500 && this.showTextEditor(), this.pointerDownPoint = void 0;
|
|
1435
|
+
}, e.prototype.dblClick = function(t, s) {
|
|
1436
|
+
o.prototype.dblClick.call(this, t, s), this.showTextEditor();
|
|
1437
|
+
}, e.prototype.setStrokeColor = function(t) {
|
|
1438
|
+
this.strokeColor = t, this.frame && h.setAttributes(this.frame, [["stroke", this.strokeColor]]), this.colorChanged(t), this.stateChanged();
|
|
1439
|
+
}, e.prototype.setFillColor = function(t) {
|
|
1440
|
+
this.fillColor = t, this.captionBg && h.setAttributes(this.captionBg, [["fill", this.fillColor]]), this.fillColorChanged(t), this.stateChanged();
|
|
1441
|
+
}, e.prototype.setStrokeWidth = function(t) {
|
|
1442
|
+
this.strokeWidth = t, this.frame && h.setAttributes(this.frame, [["stroke-width", this.strokeWidth.toString()]]), this.stateChanged();
|
|
1443
|
+
}, e.prototype.setStrokeDasharray = function(t) {
|
|
1444
|
+
this.strokeDasharray = t, this.frame && h.setAttributes(this.frame, [["stroke-dasharray", this.strokeDasharray]]), this.stateChanged();
|
|
1445
|
+
}, Object.defineProperty(e.prototype, "toolboxPanels", { get: function() {
|
|
1446
|
+
return [this.strokePanel, this.fillPanel, this.strokeWidthPanel, this.strokeStylePanel, this.fontFamilyPanel, this.textColorPanel];
|
|
1447
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.getState = function() {
|
|
1448
|
+
var t = Object.assign({ fillColor: this.fillColor, strokeColor: this.strokeColor, strokeWidth: this.strokeWidth, strokeDasharray: this.strokeDasharray, opacity: 1, textColor: this.textColor, fontFamily: this.fontFamily, fontSize: this.fontSize, captionText: this.captionText }, o.prototype.getState.call(this));
|
|
1449
|
+
return t.typeName = this.typeName, t;
|
|
1450
|
+
}, e.prototype.restoreState = function(t) {
|
|
1451
|
+
var s = t;
|
|
1452
|
+
this.fillColor = s.fillColor, this.strokeColor = s.strokeColor, this.strokeWidth = s.strokeWidth, this.strokeDasharray = s.strokeDasharray, this.textColor = s.textColor, this.fontFamily = s.fontFamily, this.captionText = s.captionText, this.fontSize = s.fontSize, this.createVisual(), o.prototype.restoreState.call(this, t), this.setSize();
|
|
1453
|
+
}, e.prototype.scale = function(t, s) {
|
|
1454
|
+
o.prototype.scale.call(this, t, s), this.setSize();
|
|
1455
|
+
}, e.typeName = "CaptionFrameMarker", e.title = "Caption frame marker", e.icon = '<svg viewBox="0 0 24 24"><path d="M5 3c-1.11 0-2 .89-2 2v14c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2H5m0 2h14v14H5V5m2 2v2h10V7H7z"/></svg>', e;
|
|
1456
|
+
}(B), v = function() {
|
|
1457
|
+
function o(e, t) {
|
|
1458
|
+
t === void 0 && (t = !1), this.cancelable = !1, this._defaultPrevented = !1, this.markerArea = e, this.cancelable = t;
|
|
1459
|
+
}
|
|
1460
|
+
return Object.defineProperty(o.prototype, "defaultPrevented", { get: function() {
|
|
1461
|
+
return this._defaultPrevented;
|
|
1462
|
+
}, enumerable: !1, configurable: !0 }), o.prototype.preventDefault = function() {
|
|
1463
|
+
this._defaultPrevented = !0;
|
|
1464
|
+
}, o;
|
|
1465
|
+
}(), ht = function(o) {
|
|
1466
|
+
function e(t, s, r) {
|
|
1467
|
+
var i = o.call(this, t, !1) || this;
|
|
1468
|
+
return i.dataUrl = s, i.state = r, i;
|
|
1469
|
+
}
|
|
1470
|
+
return d(e, o), e;
|
|
1471
|
+
}(v), b = function(o) {
|
|
1472
|
+
function e(t, s, r) {
|
|
1473
|
+
r === void 0 && (r = !1);
|
|
1474
|
+
var i = o.call(this, t, r) || this;
|
|
1475
|
+
return i.marker = s, i;
|
|
1476
|
+
}
|
|
1477
|
+
return d(e, o), e;
|
|
1478
|
+
}(v), lt = function() {
|
|
1479
|
+
function o() {
|
|
1480
|
+
this.render = [], this.beforeclose = [], this.close = [], this.show = [], this.restorestate = [], this.statechange = [], this.markerselect = [], this.markerdeselect = [], this.markercreating = [], this.markercreate = [], this.markerbeforedelete = [], this.markerdelete = [], this.markerchange = [], this.focus = [], this.blur = [];
|
|
1481
|
+
}
|
|
1482
|
+
return o.prototype.addEventListener = function(e, t) {
|
|
1483
|
+
this[e].push(t);
|
|
1484
|
+
}, o.prototype.removeEventListener = function(e, t) {
|
|
1485
|
+
var s = this[e].indexOf(t);
|
|
1486
|
+
s > -1 && this[e].splice(s, 1);
|
|
1487
|
+
}, o;
|
|
1488
|
+
}(), pt = function() {
|
|
1489
|
+
function o(e) {
|
|
1490
|
+
this.touchPoints = 0, this._availableMarkerTypes = this.DEFAULT_MARKER_TYPES, this.mode = "select", this.markers = [], this.isDragging = !1, this.renderEventListeners = [], this.closeEventListeners = [], this.settings = new et(), this._isOpen = !1, this.undoRedoManager = new rt(), this.renderAtNaturalSize = !1, this.renderImageType = "image/png", this.renderMarkersOnly = !1, this.zoomSteps = [1, 1.5, 2, 4], this._zoomLevel = 1, this._isResizing = !1, this.prevPanPoint = { x: 0, y: 0 }, this.eventListeners = new lt(), this._silentRenderMode = !1, this._isFocused = !1, this._instanceNo = o.instanceCounter++, this.styles = new Q(this.instanceNo), this.uiStyleSettings = this.styles.settings, this.target = e, this.targetRoot = document.body, this.width = e.clientWidth, this.height = e.clientHeight, this.styles.removeStyleSheet(), this.open = this.open.bind(this), this.setTopLeft = this.setTopLeft.bind(this), this.toolbarButtonClicked = this.toolbarButtonClicked.bind(this), this.createNewMarker = this.createNewMarker.bind(this), this.addNewMarker = this.addNewMarker.bind(this), this.markerCreated = this.markerCreated.bind(this), this.setCurrentMarker = this.setCurrentMarker.bind(this), this.onPointerDown = this.onPointerDown.bind(this), this.onDblClick = this.onDblClick.bind(this), this.onPointerMove = this.onPointerMove.bind(this), this.onPointerUp = this.onPointerUp.bind(this), this.onPointerOut = this.onPointerOut.bind(this), this.onKeyUp = this.onKeyUp.bind(this), this.overrideOverflow = this.overrideOverflow.bind(this), this.restoreOverflow = this.restoreOverflow.bind(this), this.close = this.close.bind(this), this.closeUI = this.closeUI.bind(this), this.addCloseEventListener = this.addCloseEventListener.bind(this), this.removeCloseEventListener = this.removeCloseEventListener.bind(this), this.addRenderEventListener = this.addRenderEventListener.bind(this), this.removeRenderEventListener = this.removeRenderEventListener.bind(this), this.clientToLocalCoordinates = this.clientToLocalCoordinates.bind(this), this.onWindowResize = this.onWindowResize.bind(this), this.deleteSelectedMarker = this.deleteSelectedMarker.bind(this), this.setWindowHeight = this.setWindowHeight.bind(this), this.removeMarker = this.removeMarker.bind(this), this.colorChanged = this.colorChanged.bind(this), this.fillColorChanged = this.fillColorChanged.bind(this), this.onPopupTargetResize = this.onPopupTargetResize.bind(this), this.showNotesEditor = this.showNotesEditor.bind(this), this.hideNotesEditor = this.hideNotesEditor.bind(this), this.stepZoom = this.stepZoom.bind(this), this.focus = this.focus.bind(this), this.blur = this.blur.bind(this), this.markerStateChanged = this.markerStateChanged.bind(this), this.switchToSelectMode = this.switchToSelectMode.bind(this), this.addDefs = this.addDefs.bind(this), this.addDefsToImage = this.addDefsToImage.bind(this), this.addMarkerEvents = this.addMarkerEvents.bind(this);
|
|
1491
|
+
}
|
|
1492
|
+
return Object.defineProperty(o.prototype, "ALL_MARKER_TYPES", { get: function() {
|
|
1493
|
+
return [P, k, L, w, ot, A, D, V, st, X, I, nt, at];
|
|
1494
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "DEFAULT_MARKER_TYPES", { get: function() {
|
|
1495
|
+
return [P, k, L, w, A, D, V];
|
|
1496
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "BASIC_MARKER_TYPES", { get: function() {
|
|
1497
|
+
return [P, k, L, w, D];
|
|
1498
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "availableMarkerTypes", { get: function() {
|
|
1499
|
+
return this._availableMarkerTypes;
|
|
1500
|
+
}, set: function(e) {
|
|
1501
|
+
var t = this;
|
|
1502
|
+
this._availableMarkerTypes.splice(0), e.forEach(function(s) {
|
|
1503
|
+
if (typeof s == "string") {
|
|
1504
|
+
var r = t.ALL_MARKER_TYPES.find(function(i) {
|
|
1505
|
+
return i.typeName === s;
|
|
1506
|
+
});
|
|
1507
|
+
r !== void 0 && t._availableMarkerTypes.push(r);
|
|
1508
|
+
} else t._availableMarkerTypes.push(s);
|
|
1509
|
+
});
|
|
1510
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "currentMarker", { get: function() {
|
|
1511
|
+
return this._currentMarker;
|
|
1512
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "isOpen", { get: function() {
|
|
1513
|
+
return this._isOpen;
|
|
1514
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "isUndoPossible", { get: function() {
|
|
1515
|
+
return !(!this.undoRedoManager || !this.undoRedoManager.isUndoPossible);
|
|
1516
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "isRedoPossible", { get: function() {
|
|
1517
|
+
return !(!this.undoRedoManager || !this.undoRedoManager.isRedoPossible);
|
|
1518
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "zoomLevel", { get: function() {
|
|
1519
|
+
return this._zoomLevel;
|
|
1520
|
+
}, set: function(e) {
|
|
1521
|
+
this._zoomLevel = e, this.editorCanvas && this.contentDiv && (this.editorCanvas.style.transform = "scale(" + this._zoomLevel + ")", this.contentDiv.scrollTo({ left: (this.editorCanvas.clientWidth * this._zoomLevel - this.contentDiv.clientWidth) / 2, top: (this.editorCanvas.clientHeight * this._zoomLevel - this.contentDiv.clientHeight) / 2 }));
|
|
1522
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(o.prototype, "instanceNo", { get: function() {
|
|
1523
|
+
return this._instanceNo;
|
|
1524
|
+
}, enumerable: !1, configurable: !0 }), o.prototype.open = function() {
|
|
1525
|
+
this.setupResizeObserver(), this.setEditingTarget(), this.setTopLeft(), this.initMarkerCanvas(), this.initOverlay(), this.attachEvents(), this.settings.displayMode === "popup" && this.onPopupTargetResize(), R.isLicensed || this.addLogo(), this._isOpen = !0, this._isFocused = !0;
|
|
1526
|
+
}, o.prototype.show = function() {
|
|
1527
|
+
var e = this;
|
|
1528
|
+
this.styles.styleSheetRoot === void 0 && O.styleSheetRoot !== void 0 && (this.styles.styleSheetRoot = O.styleSheetRoot), this.markers.splice(0), this.setWindowHeight(), this.showUI(), this.open(), this.eventListeners.show.forEach(function(t) {
|
|
1529
|
+
return t(new v(e));
|
|
1530
|
+
});
|
|
1531
|
+
}, o.prototype.render = function() {
|
|
1532
|
+
return H(this, void 0, void 0, function() {
|
|
1533
|
+
var e;
|
|
1534
|
+
return z(this, function(t) {
|
|
1535
|
+
switch (t.label) {
|
|
1536
|
+
case 0:
|
|
1537
|
+
return this.setCurrentMarker(), (e = new J()).naturalSize = this.renderAtNaturalSize, e.imageType = this.renderImageType, e.imageQuality = this.renderImageQuality, e.markersOnly = this.renderMarkersOnly, e.width = this.renderWidth, e.height = this.renderHeight, [4, e.rasterize(this.target instanceof HTMLImageElement ? this.target : null, this.markerImage, this.renderTarget)];
|
|
1538
|
+
case 1:
|
|
1539
|
+
return t.sent(), [4, e.rasterize(this.target instanceof HTMLImageElement ? this.target : null, this.markerImage, this.renderTarget)];
|
|
1540
|
+
case 2:
|
|
1541
|
+
return [2, t.sent()];
|
|
1542
|
+
}
|
|
1543
|
+
});
|
|
1544
|
+
});
|
|
1545
|
+
}, o.prototype.close = function(e) {
|
|
1546
|
+
var t = this;
|
|
1547
|
+
if (e === void 0 && (e = !1), this.isOpen) {
|
|
1548
|
+
var s = !1;
|
|
1549
|
+
e || this.eventListeners.beforeclose.forEach(function(r) {
|
|
1550
|
+
var i = new v(t, !0);
|
|
1551
|
+
r(i), i.defaultPrevented && (s = !0);
|
|
1552
|
+
}), s || (this.coverDiv && this.closeUI(), this.targetObserver && (this.targetObserver.unobserve(this.target), this.targetObserver.unobserve(this.editorCanvas)), this.settings.displayMode === "popup" && window.removeEventListener("resize", this.setWindowHeight), this.eventListeners.close.forEach(function(r) {
|
|
1553
|
+
return r(new v(t));
|
|
1554
|
+
}), this.detachEvents(), this._isOpen = !1);
|
|
1555
|
+
}
|
|
1556
|
+
}, o.prototype.addMarkersToToolbar = function() {
|
|
1557
|
+
for (var e, t = [], s = 0; s < arguments.length; s++) t[s] = arguments[s];
|
|
1558
|
+
(e = this._availableMarkerTypes).push.apply(e, t);
|
|
1559
|
+
}, o.prototype.addRenderEventListener = function(e) {
|
|
1560
|
+
this.addEventListener("render", function(t) {
|
|
1561
|
+
e(t.dataUrl, t.state);
|
|
1562
|
+
});
|
|
1563
|
+
}, o.prototype.removeRenderEventListener = function(e) {
|
|
1564
|
+
}, o.prototype.addCloseEventListener = function(e) {
|
|
1565
|
+
this.addEventListener("close", function() {
|
|
1566
|
+
e();
|
|
1567
|
+
});
|
|
1568
|
+
}, o.prototype.removeCloseEventListener = function(e) {
|
|
1569
|
+
}, o.prototype.setupResizeObserver = function() {
|
|
1570
|
+
var e = this;
|
|
1571
|
+
this.settings.displayMode === "inline" ? window.ResizeObserver && (this.targetObserver = new ResizeObserver(function() {
|
|
1572
|
+
e.resize(e.target.clientWidth, e.target.clientHeight);
|
|
1573
|
+
}), this.targetObserver.observe(this.target)) : this.settings.displayMode === "popup" && (window.ResizeObserver && (this.targetObserver = new ResizeObserver(function() {
|
|
1574
|
+
return e.onPopupTargetResize();
|
|
1575
|
+
}), this.targetObserver.observe(this.editorCanvas)), window.addEventListener("resize", this.setWindowHeight));
|
|
1576
|
+
}, o.prototype.onPopupTargetResize = function() {
|
|
1577
|
+
var e = 1 * this.target.clientWidth / this.target.clientHeight, t = this.editorCanvas.clientWidth / e > this.editorCanvas.clientHeight ? this.editorCanvas.clientHeight * e : this.editorCanvas.clientWidth, s = t < this.editorCanvas.clientWidth ? this.editorCanvas.clientHeight : this.editorCanvas.clientWidth / e;
|
|
1578
|
+
this.resize(t, s);
|
|
1579
|
+
}, o.prototype.setWindowHeight = function() {
|
|
1580
|
+
this.windowHeight = window.innerHeight;
|
|
1581
|
+
}, o.prototype.resize = function(e, t) {
|
|
1582
|
+
this._isResizing = !0;
|
|
1583
|
+
var s = e / this.imageWidth, r = t / this.imageHeight;
|
|
1584
|
+
this.imageWidth = Math.round(e), this.imageHeight = Math.round(t), this.target instanceof HTMLImageElement && this.editingTarget instanceof HTMLImageElement && (this.editingTarget.src = this.target.src), this.editingTarget.width = this.imageWidth, this.editingTarget.height = this.imageHeight, this.editingTarget.style.width = this.imageWidth + "px", this.editingTarget.style.height = this.imageHeight + "px", this.markerImage.setAttribute("width", this.imageWidth.toString()), this.markerImage.setAttribute("height", this.imageHeight.toString()), this.markerImage.setAttribute("viewBox", "0 0 " + this.imageWidth.toString() + " " + this.imageHeight.toString()), this.markerImageHolder.style.width = this.imageWidth + "px", this.markerImageHolder.style.height = this.imageHeight + "px", this.overlayContainer.style.width = this.imageWidth + "px", this.overlayContainer.style.height = this.imageHeight + "px", this.settings.displayMode !== "popup" ? this.coverDiv.style.width = this.imageWidth.toString() + "px" : (this.setTopLeft(), this.positionMarkerImage()), this.toolbar !== void 0 && this.toolbar.adjustLayout(), this.positionLogo(), this.scaleMarkers(s, r), this._isResizing = !1;
|
|
1585
|
+
}, o.prototype.scaleMarkers = function(e, t) {
|
|
1586
|
+
var s, r = this;
|
|
1587
|
+
this._currentMarker && this._currentMarker instanceof w ? this._currentMarker.scale(e, t) : (s = this._currentMarker, this.setCurrentMarker()), this.markers.forEach(function(i) {
|
|
1588
|
+
i !== r._currentMarker && i.scale(e, t);
|
|
1589
|
+
}), s !== void 0 && this.setCurrentMarker(s);
|
|
1590
|
+
}, o.prototype.setEditingTarget = function() {
|
|
1591
|
+
this.imageWidth = Math.round(this.target.clientWidth), this.imageHeight = Math.round(this.target.clientHeight), this.target instanceof HTMLImageElement && this.editingTarget instanceof HTMLImageElement && (this.editingTarget.src = this.target.src), this.editingTarget.width = this.imageWidth, this.editingTarget.height = this.imageHeight, this.editingTarget.style.width = this.imageWidth + "px", this.editingTarget.style.height = this.imageHeight + "px";
|
|
1592
|
+
}, o.prototype.setTopLeft = function() {
|
|
1593
|
+
var e = this.editingTarget.getBoundingClientRect(), t = this.editorCanvas.getBoundingClientRect();
|
|
1594
|
+
this.left = e.left - t.left, this.top = e.top - t.top;
|
|
1595
|
+
}, o.prototype.initMarkerCanvas = function() {
|
|
1596
|
+
this.markerImageHolder = document.createElement("div"), this.markerImageHolder.style.setProperty("touch-action", "pinch-zoom"), this.markerImage = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.markerImage.setAttribute("xmlns", "http://www.w3.org/2000/svg"), this.markerImage.setAttribute("width", this.imageWidth.toString()), this.markerImage.setAttribute("height", this.imageHeight.toString()), this.markerImage.setAttribute("viewBox", "0 0 " + this.imageWidth.toString() + " " + this.imageHeight.toString()), this.markerImage.style.pointerEvents = "auto", this.markerImageHolder.style.position = "absolute", this.markerImageHolder.style.width = this.imageWidth + "px", this.markerImageHolder.style.height = this.imageHeight + "px", this.markerImageHolder.style.transformOrigin = "top left", this.positionMarkerImage(), this.markerImageHolder.appendChild(this.markerImage), this.editorCanvas.appendChild(this.markerImageHolder);
|
|
1597
|
+
}, o.prototype.addDefs = function() {
|
|
1598
|
+
for (var e, t = [], s = 0; s < arguments.length; s++) t[s] = arguments[s];
|
|
1599
|
+
this.defs = h.createDefs(), this.addDefsToImage(), (e = this.defs).append.apply(e, t);
|
|
1600
|
+
}, o.prototype.addDefsToImage = function() {
|
|
1601
|
+
this.defs && this.markerImage.insertBefore(this.defs, this.markerImage.firstChild);
|
|
1602
|
+
}, o.prototype.initOverlay = function() {
|
|
1603
|
+
this.overlayContainer = document.createElement("div"), this.overlayContainer.style.position = "absolute", this.overlayContainer.style.left = "0px", this.overlayContainer.style.top = "0px", this.overlayContainer.style.width = this.imageWidth + "px", this.overlayContainer.style.height = this.imageHeight + "px", this.overlayContainer.style.display = "flex", this.markerImageHolder.appendChild(this.overlayContainer);
|
|
1604
|
+
}, o.prototype.positionMarkerImage = function() {
|
|
1605
|
+
this.markerImageHolder.style.top = this.top / this.zoomLevel + "px", this.markerImageHolder.style.left = this.left / this.zoomLevel + "px";
|
|
1606
|
+
}, o.prototype.attachEvents = function() {
|
|
1607
|
+
this.markerImage.addEventListener("pointerdown", this.onPointerDown), this.markerImage.addEventListener("touchmove", function(e) {
|
|
1608
|
+
return e.preventDefault();
|
|
1609
|
+
}), this.markerImage.addEventListener("dblclick", this.onDblClick), this.attachWindowEvents();
|
|
1610
|
+
}, o.prototype.attachWindowEvents = function() {
|
|
1611
|
+
window.addEventListener("pointermove", this.onPointerMove), window.addEventListener("pointerup", this.onPointerUp), window.addEventListener("pointercancel", this.onPointerOut), window.addEventListener("pointerout", this.onPointerOut), window.addEventListener("pointerleave", this.onPointerUp), window.addEventListener("resize", this.onWindowResize), window.addEventListener("keyup", this.onKeyUp);
|
|
1612
|
+
}, o.prototype.detachEvents = function() {
|
|
1613
|
+
this.markerImage.removeEventListener("pointerdown", this.onPointerDown), this.markerImage.removeEventListener("dblclick", this.onDblClick), this.detachWindowEvents();
|
|
1614
|
+
}, o.prototype.detachWindowEvents = function() {
|
|
1615
|
+
window.removeEventListener("pointermove", this.onPointerMove), window.removeEventListener("pointerup", this.onPointerUp), window.removeEventListener("pointercancel", this.onPointerOut), window.removeEventListener("pointerout", this.onPointerOut), window.removeEventListener("pointerleave", this.onPointerUp), window.removeEventListener("resize", this.onWindowResize), window.removeEventListener("keyup", this.onKeyUp);
|
|
1616
|
+
}, o.prototype.addLogo = function() {
|
|
1617
|
+
this.logoUI = document.createElement("div"), this.logoUI.style.display = "inline-block", this.logoUI.style.margin = "0px", this.logoUI.style.padding = "0px", this.logoUI.style.fill = "#333333";
|
|
1618
|
+
var e = document.createElement("a");
|
|
1619
|
+
e.href = "https://markerjs.com/", e.target = "_blank", e.innerHTML = '<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>', e.title = "Powered by marker.js", e.style.display = "grid", e.style.alignItems = "center", e.style.justifyItems = "center", e.style.padding = "3px", e.style.width = "20px", e.style.height = "20px", this.logoUI.appendChild(e), this.editorCanvas.appendChild(this.logoUI), this.logoUI.style.position = "absolute", this.logoUI.style.pointerEvents = "all", this.positionLogo();
|
|
1620
|
+
}, o.prototype.positionLogo = function() {
|
|
1621
|
+
this.logoUI && (this.uiStyleSettings.logoPosition !== "right" ? this.logoUI.style.left = this.markerImageHolder.offsetLeft + 10 + "px" : this.logoUI.style.left = this.markerImageHolder.offsetLeft + this.markerImageHolder.offsetWidth - this.logoUI.clientWidth - 10 + "px", this.logoUI.style.top = this.markerImageHolder.offsetTop + this.markerImageHolder.offsetHeight - this.logoUI.clientHeight - 10 + "px");
|
|
1622
|
+
}, o.prototype.overrideOverflow = function() {
|
|
1623
|
+
this.scrollXState = window.scrollX, this.scrollYState = window.scrollY, this.bodyOverflowState = document.body.style.overflow, window.scroll({ top: 0, left: 0 }), document.body.style.overflow = "hidden";
|
|
1624
|
+
}, o.prototype.restoreOverflow = function() {
|
|
1625
|
+
document.body.style.overflow = this.bodyOverflowState, window.scroll({ top: this.scrollYState, left: this.scrollXState });
|
|
1626
|
+
}, o.prototype.showUI = function() {
|
|
1627
|
+
var e;
|
|
1628
|
+
switch (this.settings.displayMode === "popup" && this.overrideOverflow(), this.coverDiv = document.createElement("div"), this.coverDiv.style.visibility = this._silentRenderMode ? "hidden" : "visible", this.coverDiv.className = this.styles.classNamePrefixBase + " " + this.styles.classNamePrefix, this.coverDiv.style.fontSize = "16px", this.coverDiv.style.userSelect = "none", this.settings.displayMode) {
|
|
1629
|
+
case "inline":
|
|
1630
|
+
this.coverDiv.style.position = "absolute";
|
|
1631
|
+
var t = this.settings.uiOffsetTop !== void 0 ? this.target.offsetTop + this.settings.uiOffsetTop : this.target.offsetTop > this.styles.settings.toolbarHeight ? this.target.offsetTop - this.styles.settings.toolbarHeight : 0, s = this.target.offsetLeft + ((e = this.settings.uiOffsetLeft) !== null && e !== void 0 ? e : 0);
|
|
1632
|
+
this.coverDiv.style.top = t + "px", this.coverDiv.style.left = s + "px", this.coverDiv.style.width = this.target.offsetWidth.toString() + "px", this.coverDiv.style.zIndex = this.uiStyleSettings.zIndex !== void 0 ? this.uiStyleSettings.zIndex : "5";
|
|
1633
|
+
break;
|
|
1634
|
+
case "popup":
|
|
1635
|
+
this.coverDiv.style.position = "fixed", this.coverDiv.style.top = "0px", this.coverDiv.style.left = "0px", this.coverDiv.style.width = "100vw", this.coverDiv.style.height = window.innerHeight + "px", this.coverDiv.style.backgroundColor = "rgba(0, 0, 0, 0.75)", this.coverDiv.style.zIndex = this.uiStyleSettings.zIndex !== void 0 ? this.uiStyleSettings.zIndex : "1000", this.coverDiv.style.display = "flex";
|
|
1636
|
+
}
|
|
1637
|
+
this.targetRoot.appendChild(this.coverDiv), this.uiDiv = document.createElement("div"), this.uiDiv.style.display = "flex", this.uiDiv.style.flexDirection = "column", this.uiDiv.style.flexGrow = "2", this.uiDiv.style.margin = this.settings.displayMode === "popup" ? this.settings.popupMargin + "px" : "0px", this.settings.displayMode === "popup" && (this.uiDiv.style.maxWidth = "calc(100vw - " + 2 * this.settings.popupMargin + "px"), this.uiDiv.style.border = "0px", this.coverDiv.appendChild(this.uiDiv), this.toolbar = new q(this.uiDiv, this.settings.displayMode, this._availableMarkerTypes, this.uiStyleSettings, this.styles), this.toolbar.addButtonClickListener(this.toolbarButtonClicked), this.toolbar.show(this._silentRenderMode || this.uiStyleSettings.hideToolbar ? "hidden" : "visible"), this.contentDiv = document.createElement("div"), this.contentDiv.style.display = "flex", this.contentDiv.style.flexDirection = "row", this.contentDiv.style.flexGrow = "2", this.contentDiv.style.flexShrink = "1", this.settings.displayMode === "popup" && (this.contentDiv.style.backgroundColor = this.uiStyleSettings.canvasBackgroundColor, this.contentDiv.style.maxHeight = this.windowHeight - 2 * this.settings.popupMargin - 3.5 * this.uiStyleSettings.toolbarHeight + "px", this.contentDiv.style.maxWidth = "calc(100vw - " + 2 * this.settings.popupMargin + "px)"), this.contentDiv.style.overflow = "auto", this.uiDiv.appendChild(this.contentDiv), this.editorCanvas = document.createElement("div"), this.editorCanvas.style.flexGrow = "2", this.editorCanvas.style.flexShrink = "1", this.editorCanvas.style.position = "relative", this.editorCanvas.style.overflow = "hidden", this.editorCanvas.style.display = "flex", this.settings.displayMode === "popup" && (this.editorCanvas.style.alignItems = "center", this.editorCanvas.style.justifyContent = "center"), this.editorCanvas.style.pointerEvents = "none", this.editorCanvas.style.transformOrigin = "left top", this.editorCanvas.style.transform = "scale(" + this.zoomLevel + ")", this.contentDiv.appendChild(this.editorCanvas), this.editingTarget = this.target instanceof HTMLImageElement ? document.createElement("img") : document.createElement("canvas"), this.settings.displayMode === "inline" && this.settings.uiOffsetTop === void 0 && this.target.offsetTop < this.styles.settings.toolbarHeight && (this.editingTarget.style.marginTop = this.target.offsetTop - this.styles.settings.toolbarHeight + "px"), this.editorCanvas.appendChild(this.editingTarget), this.toolbox = new $(this.uiDiv, this.settings.displayMode, this.uiStyleSettings, this.styles), this.toolbox.show(this._silentRenderMode || this.uiStyleSettings.hideToolbox ? "hidden" : "visible");
|
|
1638
|
+
}, o.prototype.closeUI = function() {
|
|
1639
|
+
this.settings.displayMode === "popup" && this.restoreOverflow(), this.targetRoot.removeChild(this.coverDiv), this.coverDiv.remove(), this.coverDiv = null;
|
|
1640
|
+
}, o.prototype.removeMarker = function(e) {
|
|
1641
|
+
this.markerImage.removeChild(e.container), this.markers.indexOf(e) > -1 && this.markers.splice(this.markers.indexOf(e), 1), e.dispose();
|
|
1642
|
+
}, o.prototype.switchToSelectMode = function() {
|
|
1643
|
+
this.mode = "select", this.hideNotesEditor(), this._currentMarker !== void 0 && (this._currentMarker.state !== "new" ? this._currentMarker.select() : (this.removeMarker(this._currentMarker), this.setCurrentMarker(), this.markerImage.style.cursor = "default"), this.addUndoStep()), this.toolbar.setSelectMode();
|
|
1644
|
+
}, o.prototype.toolbarButtonClicked = function(e, t) {
|
|
1645
|
+
if (e === "marker" && t !== void 0) this.createNewMarker(t);
|
|
1646
|
+
else if (e === "action") switch (t) {
|
|
1647
|
+
case "select":
|
|
1648
|
+
this.switchToSelectMode(), this.switchToSelectMode();
|
|
1649
|
+
break;
|
|
1650
|
+
case "delete":
|
|
1651
|
+
this.deleteSelectedMarker();
|
|
1652
|
+
break;
|
|
1653
|
+
case "clear":
|
|
1654
|
+
this.clear();
|
|
1655
|
+
break;
|
|
1656
|
+
case "undo":
|
|
1657
|
+
this.undo();
|
|
1658
|
+
break;
|
|
1659
|
+
case "redo":
|
|
1660
|
+
this.redo();
|
|
1661
|
+
break;
|
|
1662
|
+
case "zoom":
|
|
1663
|
+
this.stepZoom();
|
|
1664
|
+
break;
|
|
1665
|
+
case "zoom-out":
|
|
1666
|
+
this.zoomLevel = 1;
|
|
1667
|
+
break;
|
|
1668
|
+
case "notes":
|
|
1669
|
+
this.notesArea === void 0 ? (this.switchToSelectMode(), this.zoomLevel = 1, this.showNotesEditor()) : this.switchToSelectMode();
|
|
1670
|
+
break;
|
|
1671
|
+
case "close":
|
|
1672
|
+
this.close();
|
|
1673
|
+
break;
|
|
1674
|
+
case "render":
|
|
1675
|
+
this.switchToSelectMode(), this.startRenderAndClose();
|
|
1676
|
+
}
|
|
1677
|
+
}, o.prototype.deleteSelectedMarker = function() {
|
|
1678
|
+
var e = this;
|
|
1679
|
+
if (this._currentMarker !== void 0 && this._currentMarker.state === "select") {
|
|
1680
|
+
var t = !1;
|
|
1681
|
+
if (this.eventListeners.markerbeforedelete.forEach(function(r) {
|
|
1682
|
+
var i = new b(e, e._currentMarker, !0);
|
|
1683
|
+
r(i), i.defaultPrevented && (t = !0);
|
|
1684
|
+
}), !t) {
|
|
1685
|
+
var s = this._currentMarker;
|
|
1686
|
+
this._currentMarker.dispose(), this.markerImage.removeChild(this._currentMarker.container), this.markers.splice(this.markers.indexOf(this._currentMarker), 1), this.setCurrentMarker(), this.addUndoStep(), this.eventListeners.markerdelete.forEach(function(r) {
|
|
1687
|
+
return r(new b(e, s));
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}, o.prototype.clear = function() {
|
|
1692
|
+
var e = this, t = !1;
|
|
1693
|
+
if (this.markers.length > 0 && (this.eventListeners.markerbeforedelete.forEach(function(n) {
|
|
1694
|
+
var a = new b(e, void 0, !0);
|
|
1695
|
+
n(a), a.defaultPrevented && (t = !0);
|
|
1696
|
+
}), !t)) {
|
|
1697
|
+
this.setCurrentMarker();
|
|
1698
|
+
for (var s = function(n) {
|
|
1699
|
+
var a = r.markers[n];
|
|
1700
|
+
r.setCurrentMarker(r.markers[n]), r._currentMarker.dispose(), r.markerImage.removeChild(r._currentMarker.container), r.markers.splice(r.markers.indexOf(r._currentMarker), 1), r.eventListeners.markerdelete.forEach(function(c) {
|
|
1701
|
+
return c(new b(e, a));
|
|
1702
|
+
});
|
|
1703
|
+
}, r = this, i = this.markers.length - 1; i >= 0; i--) s(i);
|
|
1704
|
+
this.addUndoStep();
|
|
1705
|
+
}
|
|
1706
|
+
}, Object.defineProperty(o.prototype, "isNotesAreaOpen", { get: function() {
|
|
1707
|
+
return this.notesArea !== void 0;
|
|
1708
|
+
}, enumerable: !1, configurable: !0 }), o.prototype.showNotesEditor = function() {
|
|
1709
|
+
var e;
|
|
1710
|
+
this._currentMarker !== void 0 && (this.overlayContainer.innerHTML = "", this.notesArea = document.createElement("textarea"), this.notesArea.className = this.uiStyleSettings.notesAreaStyleClassName, this.notesArea.style.pointerEvents = "auto", this.notesArea.style.alignSelf = "stretch", this.notesArea.style.width = "100%", this.notesArea.style.margin = this.uiStyleSettings.toolbarHeight / 4 + "px", this.notesArea.value = (e = this._currentMarker.notes) !== null && e !== void 0 ? e : "", this.overlayContainer.appendChild(this.notesArea));
|
|
1711
|
+
}, o.prototype.hideNotesEditor = function() {
|
|
1712
|
+
this.isNotesAreaOpen && (this._currentMarker !== void 0 && (this._currentMarker.notes = this.notesArea.value.trim() !== "" ? this.notesArea.value : void 0), this.overlayContainer.removeChild(this.notesArea), this.notesArea = void 0);
|
|
1713
|
+
}, o.prototype.selectLastMarker = function() {
|
|
1714
|
+
this.markers.length > 0 ? this.setCurrentMarker(this.markers[this.markers.length - 1]) : this.setCurrentMarker();
|
|
1715
|
+
}, o.prototype.addUndoStep = function() {
|
|
1716
|
+
var e = this;
|
|
1717
|
+
if (this._currentMarker === void 0 || this._currentMarker.state !== "edit") {
|
|
1718
|
+
var t = this.getState(), s = this.undoRedoManager.getLastUndoStep();
|
|
1719
|
+
if (!s || s.width === t.width && s.height === t.height) {
|
|
1720
|
+
var r = this.undoRedoManager.undoStepCount;
|
|
1721
|
+
this.undoRedoManager.addUndoStep(t), r < this.undoRedoManager.undoStepCount && this.eventListeners.statechange.forEach(function(i) {
|
|
1722
|
+
return i(new v(e));
|
|
1723
|
+
});
|
|
1724
|
+
} else this.undoRedoManager.replaceLastUndoStep(t);
|
|
1725
|
+
}
|
|
1726
|
+
}, o.prototype.undo = function() {
|
|
1727
|
+
this.switchToSelectMode(), this.addUndoStep(), this.undoStep();
|
|
1728
|
+
}, o.prototype.undoStep = function() {
|
|
1729
|
+
var e = this, t = this.undoRedoManager.undo();
|
|
1730
|
+
t !== void 0 && (this.restoreState(t), this.addDefsToImage(), this.selectLastMarker(), this.eventListeners.statechange.forEach(function(s) {
|
|
1731
|
+
return s(new v(e));
|
|
1732
|
+
}));
|
|
1733
|
+
}, o.prototype.redo = function() {
|
|
1734
|
+
this.switchToSelectMode(), this.redoStep();
|
|
1735
|
+
}, o.prototype.redoStep = function() {
|
|
1736
|
+
var e = this, t = this.undoRedoManager.redo();
|
|
1737
|
+
t !== void 0 && (this.restoreState(t), this.addDefsToImage(), this.selectLastMarker(), this.eventListeners.statechange.forEach(function(s) {
|
|
1738
|
+
return s(new v(e));
|
|
1739
|
+
}));
|
|
1740
|
+
}, o.prototype.stepZoom = function() {
|
|
1741
|
+
var e = this.zoomSteps.indexOf(this.zoomLevel);
|
|
1742
|
+
this.zoomLevel = e < this.zoomSteps.length - 1 ? this.zoomSteps[e + 1] : this.zoomSteps[0];
|
|
1743
|
+
}, o.prototype.panTo = function(e) {
|
|
1744
|
+
this.contentDiv.scrollBy({ left: this.prevPanPoint.x - e.x, top: this.prevPanPoint.y - e.y }), this.prevPanPoint = e;
|
|
1745
|
+
}, o.prototype.startRenderAndClose = function() {
|
|
1746
|
+
return H(this, void 0, void 0, function() {
|
|
1747
|
+
var e, t, s = this;
|
|
1748
|
+
return z(this, function(r) {
|
|
1749
|
+
switch (r.label) {
|
|
1750
|
+
case 0:
|
|
1751
|
+
return [4, this.render()];
|
|
1752
|
+
case 1:
|
|
1753
|
+
return e = r.sent(), t = this.getState(), this.eventListeners.render.forEach(function(i) {
|
|
1754
|
+
return i(new ht(s, e, t));
|
|
1755
|
+
}), this.close(!0), [2];
|
|
1756
|
+
}
|
|
1757
|
+
});
|
|
1758
|
+
});
|
|
1759
|
+
}, o.prototype.getState = function(e) {
|
|
1760
|
+
e === !0 && this.setCurrentMarker();
|
|
1761
|
+
var t = { width: this.imageWidth, height: this.imageHeight, markers: [] };
|
|
1762
|
+
return this.markers.forEach(function(s) {
|
|
1763
|
+
return t.markers.push(s.getState());
|
|
1764
|
+
}), t;
|
|
1765
|
+
}, o.prototype.restoreState = function(e) {
|
|
1766
|
+
var t = this;
|
|
1767
|
+
for (this.markers.splice(0); this.markerImage.lastChild; ) this.markerImage.removeChild(this.markerImage.lastChild);
|
|
1768
|
+
e.markers.forEach(function(s) {
|
|
1769
|
+
var r = t._availableMarkerTypes.find(function(n) {
|
|
1770
|
+
return n.typeName === s.typeName;
|
|
1771
|
+
});
|
|
1772
|
+
if (r !== void 0) {
|
|
1773
|
+
var i = t.addNewMarker(r);
|
|
1774
|
+
i.restoreState(s), t.addMarkerEvents(i), t.markers.push(i);
|
|
1775
|
+
}
|
|
1776
|
+
}), e.width && e.height && (e.width !== this.imageWidth || e.height !== this.imageHeight) && this.scaleMarkers(this.imageWidth / e.width, this.imageHeight / e.height), this.eventListeners.restorestate.forEach(function(s) {
|
|
1777
|
+
return s(new v(t));
|
|
1778
|
+
});
|
|
1779
|
+
}, o.prototype.addNewMarker = function(e) {
|
|
1780
|
+
var t = h.createGroup();
|
|
1781
|
+
return this.markerImage.appendChild(t), new e(t, this.overlayContainer, this.settings);
|
|
1782
|
+
}, o.prototype.createNewMarker = function(e) {
|
|
1783
|
+
var t, s = this;
|
|
1784
|
+
(t = typeof e == "string" ? this._availableMarkerTypes.find(function(r) {
|
|
1785
|
+
return r.typeName === e;
|
|
1786
|
+
}) : e) && (this.setCurrentMarker(), this.addUndoStep(), this._currentMarker = this.addNewMarker(t), this.addMarkerEvents(this._currentMarker), this.markerImage.style.cursor = "crosshair", this.toolbar.setActiveMarkerButton(t.typeName), this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels), this.eventListeners.markercreating.forEach(function(r) {
|
|
1787
|
+
return r(new b(s, s._currentMarker));
|
|
1788
|
+
}));
|
|
1789
|
+
}, o.prototype.addMarkerEvents = function(e) {
|
|
1790
|
+
e.onMarkerCreated = this.markerCreated, e.onColorChanged = this.colorChanged, e.onFillColorChanged = this.fillColorChanged, e.onStateChanged = this.markerStateChanged;
|
|
1791
|
+
}, o.prototype.markerCreated = function(e) {
|
|
1792
|
+
var t = this;
|
|
1793
|
+
this.mode = "select", this.markerImage.style.cursor = "default", this.markers.push(e), this.setCurrentMarker(e), e instanceof k && this.settings.newFreehandMarkerOnPointerUp ? this.createNewMarker(k) : this.toolbar.setSelectMode(), this.addUndoStep(), this.eventListeners.markercreate.forEach(function(s) {
|
|
1794
|
+
return s(new b(t, e));
|
|
1795
|
+
});
|
|
1796
|
+
}, o.prototype.colorChanged = function(e) {
|
|
1797
|
+
this.settings.defaultColorsFollowCurrentColors && (this.settings.defaultColor = e, this.settings.defaultStrokeColor = e);
|
|
1798
|
+
}, o.prototype.fillColorChanged = function(e) {
|
|
1799
|
+
this.settings.defaultColorsFollowCurrentColors && (this.settings.defaultFillColor = e);
|
|
1800
|
+
}, o.prototype.markerStateChanged = function(e) {
|
|
1801
|
+
var t = this;
|
|
1802
|
+
this.eventListeners.markerchange.forEach(function(s) {
|
|
1803
|
+
return s(new b(t, e));
|
|
1804
|
+
});
|
|
1805
|
+
}, o.prototype.setCurrentMarker = function(e) {
|
|
1806
|
+
var t = this;
|
|
1807
|
+
this._currentMarker !== e && this._currentMarker !== void 0 && (this._currentMarker.deselect(), this.toolbar.setCurrentMarker(), this.toolbox.setPanelButtons([]), this._isResizing || this.eventListeners.markerdeselect.forEach(function(s) {
|
|
1808
|
+
return s(new b(t, t._currentMarker));
|
|
1809
|
+
})), this._currentMarker = e, this._currentMarker === void 0 || this._currentMarker.isSelected || (this._currentMarker.state !== "new" && this._currentMarker.select(), this.toolbar.setCurrentMarker(this._currentMarker), this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels), this._isResizing || this.eventListeners.markerselect.forEach(function(s) {
|
|
1810
|
+
return s(new b(t, t._currentMarker));
|
|
1811
|
+
}));
|
|
1812
|
+
}, o.prototype.onPointerDown = function(e) {
|
|
1813
|
+
if (this._isFocused || this.focus(), this.touchPoints++, this.touchPoints === 1 || e.pointerType !== "touch") if (this._currentMarker === void 0 || this._currentMarker.state !== "new" && this._currentMarker.state !== "creating") {
|
|
1814
|
+
if (this.mode === "select") {
|
|
1815
|
+
var t = this.markers.find(function(s) {
|
|
1816
|
+
return s.ownsTarget(e.target);
|
|
1817
|
+
});
|
|
1818
|
+
t !== void 0 ? (this.setCurrentMarker(t), this.isDragging = !0, this._currentMarker.pointerDown(this.clientToLocalCoordinates(e.clientX, e.clientY), e.target)) : (this.setCurrentMarker(), this.isDragging = !0, this.prevPanPoint = { x: e.clientX, y: e.clientY });
|
|
1819
|
+
}
|
|
1820
|
+
} else this.isDragging = !0, this._currentMarker.pointerDown(this.clientToLocalCoordinates(e.clientX, e.clientY));
|
|
1821
|
+
}, o.prototype.onDblClick = function(e) {
|
|
1822
|
+
if (this._isFocused || this.focus(), this.mode === "select") {
|
|
1823
|
+
var t = this.markers.find(function(s) {
|
|
1824
|
+
return s.ownsTarget(e.target);
|
|
1825
|
+
});
|
|
1826
|
+
t !== void 0 && t !== this._currentMarker && this.setCurrentMarker(t), this._currentMarker !== void 0 ? this._currentMarker.dblClick(this.clientToLocalCoordinates(e.clientX, e.clientY), e.target) : this.setCurrentMarker();
|
|
1827
|
+
}
|
|
1828
|
+
}, o.prototype.onPointerMove = function(e) {
|
|
1829
|
+
this.touchPoints !== 1 && e.pointerType === "touch" || (this._currentMarker !== void 0 || this.isDragging) && (this._currentMarker !== void 0 && this._currentMarker.state === "edit" || e.preventDefault(), this._currentMarker !== void 0 ? this._currentMarker.manipulate(this.clientToLocalCoordinates(e.clientX, e.clientY)) : this.zoomLevel > 1 && this.panTo({ x: e.clientX, y: e.clientY }));
|
|
1830
|
+
}, o.prototype.onPointerUp = function(e) {
|
|
1831
|
+
this.touchPoints > 0 && this.touchPoints--, this.touchPoints === 0 && (this.isDragging && this._currentMarker !== void 0 && this._currentMarker.pointerUp(this.clientToLocalCoordinates(e.clientX, e.clientY)), this.isDragging = !1, this.addUndoStep());
|
|
1832
|
+
}, o.prototype.onPointerOut = function() {
|
|
1833
|
+
this.touchPoints > 0 && this.touchPoints--;
|
|
1834
|
+
}, o.prototype.onKeyUp = function(e) {
|
|
1835
|
+
this._currentMarker === void 0 || this.notesArea !== void 0 || e.key !== "Delete" && e.key !== "Backspace" || this.deleteSelectedMarker();
|
|
1836
|
+
}, o.prototype.clientToLocalCoordinates = function(e, t) {
|
|
1837
|
+
var s = this.markerImage.getBoundingClientRect(), r = s.width / this.imageWidth / this.zoomLevel, i = s.height / this.imageHeight / this.zoomLevel;
|
|
1838
|
+
return { x: (e - s.left) / this.zoomLevel / r, y: (t - s.top) / this.zoomLevel / i };
|
|
1839
|
+
}, o.prototype.onWindowResize = function() {
|
|
1840
|
+
this.positionUI();
|
|
1841
|
+
}, o.prototype.positionUI = function() {
|
|
1842
|
+
switch (this.setTopLeft(), this.settings.displayMode) {
|
|
1843
|
+
case "inline":
|
|
1844
|
+
var e = this.target.getClientRects(), t = e.length > 0 && e.item(0) && e.item(0).y > this.styles.settings.toolbarHeight ? this.target.offsetTop - this.styles.settings.toolbarHeight : 0;
|
|
1845
|
+
this.coverDiv.style.top = t + "px", this.coverDiv.style.left = this.target.offsetLeft.toString() + "px";
|
|
1846
|
+
break;
|
|
1847
|
+
case "popup":
|
|
1848
|
+
this.coverDiv.style.top = "0px", this.coverDiv.style.left = "0px", this.coverDiv.style.width = "100vw", this.coverDiv.style.height = this.windowHeight + "px", this.contentDiv.style.maxHeight = this.windowHeight - 2 * this.settings.popupMargin - 3.5 * this.styles.settings.toolbarHeight + "px";
|
|
1849
|
+
}
|
|
1850
|
+
this.positionMarkerImage(), this.positionLogo();
|
|
1851
|
+
}, o.prototype.addLicenseKey = function(e) {
|
|
1852
|
+
R.addKey(e);
|
|
1853
|
+
}, o.prototype.addEventListener = function(e, t) {
|
|
1854
|
+
this.eventListeners.addEventListener(e, t);
|
|
1855
|
+
}, o.prototype.removeEventListener = function(e, t) {
|
|
1856
|
+
this.eventListeners.removeEventListener(e, t);
|
|
1857
|
+
}, o.prototype.renderState = function(e) {
|
|
1858
|
+
this._silentRenderMode = !0, this.settings.displayMode = "inline", this.isOpen || this.show(), this.restoreState(e), this.startRenderAndClose(), this._silentRenderMode = !1;
|
|
1859
|
+
}, Object.defineProperty(o.prototype, "isFocused", { get: function() {
|
|
1860
|
+
return this._isFocused;
|
|
1861
|
+
}, enumerable: !1, configurable: !0 }), o.prototype.focus = function() {
|
|
1862
|
+
var e = this;
|
|
1863
|
+
this._isFocused || (this.attachWindowEvents(), this._isFocused = !0, this._previousCurrentMarker !== void 0 && this.setCurrentMarker(this._previousCurrentMarker), this.eventListeners.focus.forEach(function(t) {
|
|
1864
|
+
return t(new v(e));
|
|
1865
|
+
}));
|
|
1866
|
+
}, o.prototype.blur = function() {
|
|
1867
|
+
var e = this;
|
|
1868
|
+
this._isFocused && (this.detachWindowEvents(), this._isFocused = !1, this._previousCurrentMarker = this._currentMarker, this.setCurrentMarker(), this.eventListeners.blur.forEach(function(t) {
|
|
1869
|
+
return t(new v(e));
|
|
1870
|
+
}));
|
|
1871
|
+
}, o.instanceCounter = 0, o;
|
|
1872
|
+
}();
|
|
1873
|
+
export {
|
|
1874
|
+
R as Activator,
|
|
1875
|
+
L as ArrowMarker,
|
|
1876
|
+
it as ArrowTypePanel,
|
|
1877
|
+
V as CalloutMarker,
|
|
1878
|
+
at as CaptionFrameMarker,
|
|
1879
|
+
f as ColorPickerPanel,
|
|
1880
|
+
X as CoverMarker,
|
|
1881
|
+
nt as CurveMarker,
|
|
1882
|
+
ot as EllipseFrameMarker,
|
|
1883
|
+
A as EllipseMarker,
|
|
1884
|
+
lt as EventListenerRepository,
|
|
1885
|
+
W as FontFamilyPanel,
|
|
1886
|
+
P as FrameMarker,
|
|
1887
|
+
k as FreehandMarker,
|
|
1888
|
+
D as HighlightMarker,
|
|
1889
|
+
I as LineMarker,
|
|
1890
|
+
M as LineStylePanel,
|
|
1891
|
+
S as LineWidthPanel,
|
|
1892
|
+
U as LinearMarkerBase,
|
|
1893
|
+
pt as MarkerArea,
|
|
1894
|
+
v as MarkerAreaEvent,
|
|
1895
|
+
ht as MarkerAreaRenderEvent,
|
|
1896
|
+
F as MarkerBase,
|
|
1897
|
+
b as MarkerEvent,
|
|
1898
|
+
st as MeasurementMarker,
|
|
1899
|
+
Y as OpacityPanel,
|
|
1900
|
+
j as RectangleMarker,
|
|
1901
|
+
B as RectangularBoxMarkerBase,
|
|
1902
|
+
tt as RectangularBoxMarkerGrips,
|
|
1903
|
+
_ as ResizeGrip,
|
|
1904
|
+
et as Settings,
|
|
1905
|
+
O as Style,
|
|
1906
|
+
y as StyleClass,
|
|
1907
|
+
Q as StyleManager,
|
|
1908
|
+
h as SvgHelper,
|
|
1909
|
+
w as TextMarker,
|
|
1910
|
+
x as ToolboxPanel,
|
|
1911
|
+
T as TransformMatrix
|
|
1912
|
+
};
|