@mlightcad/cad-simple-viewer 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +103 -98
- package/dist/index.umd.cjs +4 -4
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +2 -2
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js +3 -3
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts +4 -0
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.js +13 -3
- package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +9 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.js +16 -15
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1527,7 +1527,7 @@ class e0 extends nr {
|
|
|
1527
1527
|
* @param message - The prompt message shown to the user.
|
|
1528
1528
|
*/
|
|
1529
1529
|
constructor(e) {
|
|
1530
|
-
super(e), this._useBasePoint = !
|
|
1530
|
+
super(e), this._useBasePoint = !0, this._useDashedLine = !0, this._useAngleBase = !1, this._defaultValue = 0, this._useDefaultValue = !1, this._allowZero = !0, this._allowNegative = !1;
|
|
1531
1531
|
}
|
|
1532
1532
|
/**
|
|
1533
1533
|
* Gets or sets the base point for the angle prompt.
|
|
@@ -1690,7 +1690,7 @@ class ml extends ys {
|
|
|
1690
1690
|
* @param message - The message shown to the user in the prompt.
|
|
1691
1691
|
*/
|
|
1692
1692
|
constructor(e) {
|
|
1693
|
-
super(e), this._useBasePoint = !
|
|
1693
|
+
super(e), this._useBasePoint = !0, this._useDashedLine = !0, this._only2d = !0, this.allowNegative = !1;
|
|
1694
1694
|
}
|
|
1695
1695
|
/**
|
|
1696
1696
|
* Gets or sets the base point for the distance prompt.
|
|
@@ -2189,6 +2189,81 @@ class vl {
|
|
|
2189
2189
|
return this.validateFn({ x: e, y: t });
|
|
2190
2190
|
}
|
|
2191
2191
|
}
|
|
2192
|
+
class xl {
|
|
2193
|
+
constructor(e) {
|
|
2194
|
+
this.container = null, this.baseLine = null, this.perpLineAtBase = null, this.perpLineAtCursor = null, this.connectorLine = null, this.labelEl = null, this.angleLabelEl = null, this.xAxisLine = null, this.angleSvg = null, this.anglePath = null, this.options = {}, this.view = e;
|
|
2195
|
+
}
|
|
2196
|
+
/** Returns the parent container element that holds all rubber-band HTML elements. */
|
|
2197
|
+
get element() {
|
|
2198
|
+
return this.container;
|
|
2199
|
+
}
|
|
2200
|
+
/**
|
|
2201
|
+
* Starts the rubber-band preview.
|
|
2202
|
+
* @param basePoint The starting point in world coordinates.
|
|
2203
|
+
*/
|
|
2204
|
+
start(e, t) {
|
|
2205
|
+
this.basePoint = new He(e), this.options = t || {};
|
|
2206
|
+
const n = this.options.color || "#0f0";
|
|
2207
|
+
this.container = document.createElement("div"), this.container.style.position = "fixed", this.container.style.left = "0", this.container.style.top = "0", this.container.style.pointerEvents = "none", this.container.style.zIndex = "99999", document.body.appendChild(this.container), this.baseLine = document.createElement("div"), this.baseLine.style.position = "fixed", this.baseLine.style.borderTop = `1px solid ${n}`, this.container.appendChild(this.baseLine);
|
|
2208
|
+
const s = () => {
|
|
2209
|
+
const i = document.createElement("div");
|
|
2210
|
+
return i.style.position = "fixed", i.style.borderTop = `1px dashed ${n}`, this.container.appendChild(i), i;
|
|
2211
|
+
};
|
|
2212
|
+
this.options.showBaseLineOnly || (this.perpLineAtBase = s(), this.perpLineAtCursor = s(), this.connectorLine = s(), this.labelEl = document.createElement("div"), this.labelEl.style.position = "fixed", this.labelEl.style.color = n, this.labelEl.style.fontSize = "12px", this.labelEl.style.padding = "2px 4px", this.labelEl.style.borderRadius = "4px", this.container.appendChild(this.labelEl), this.xAxisLine = document.createElement("div"), this.xAxisLine.style.position = "fixed", this.xAxisLine.style.borderTop = `1px solid ${n}`, this.container.appendChild(this.xAxisLine), this.angleSvg = document.createElementNS(
|
|
2213
|
+
"http://www.w3.org/2000/svg",
|
|
2214
|
+
"svg"
|
|
2215
|
+
), this.angleSvg.setAttribute(
|
|
2216
|
+
"style",
|
|
2217
|
+
"position:absolute; overflow:visible; pointer-events:none;"
|
|
2218
|
+
), this.anglePath = document.createElementNS(
|
|
2219
|
+
"http://www.w3.org/2000/svg",
|
|
2220
|
+
"path"
|
|
2221
|
+
), this.anglePath.setAttribute("fill", "none"), this.anglePath.setAttribute("stroke", n), this.anglePath.setAttribute("stroke-width", "1"), this.anglePath.setAttribute("stroke-dasharray", "4 4"), this.angleSvg.appendChild(this.anglePath), this.container.appendChild(this.angleSvg), this.angleLabelEl = document.createElement("div"), this.angleLabelEl.style.position = "fixed", this.angleLabelEl.style.color = n, this.angleLabelEl.style.fontSize = "12px", this.angleLabelEl.style.padding = "2px 4px", this.angleLabelEl.style.borderRadius = "4px", this.container.appendChild(this.angleLabelEl));
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* Updates the rubber-band lines to a new target point.
|
|
2225
|
+
* @param targetPoint The current cursor position in world coordinates.
|
|
2226
|
+
*/
|
|
2227
|
+
update(e) {
|
|
2228
|
+
if (!this.container || !this.basePoint || !this.baseLine) return;
|
|
2229
|
+
const t = this.view.canvas.getBoundingClientRect(), n = this.view.wcs2Cwcs(this.basePoint), s = this.view.wcs2Cwcs(e), i = t.left, a = t.top, o = (x, v, w) => {
|
|
2230
|
+
const S = w.x - v.x, _ = w.y - v.y, T = Math.sqrt(S * S + _ * _), k = Math.atan2(_, S) * (180 / Math.PI);
|
|
2231
|
+
x.style.width = `${T}px`, x.style.transformOrigin = "0 0", x.style.transform = `translate(${v.x + i}px, ${v.y + a}px) rotate(${k}deg)`;
|
|
2232
|
+
};
|
|
2233
|
+
if (o(this.baseLine, n, s), this.options.showBaseLineOnly || !this.perpLineAtBase || !this.perpLineAtCursor || !this.connectorLine)
|
|
2234
|
+
return;
|
|
2235
|
+
const c = s.x - n.x, l = s.y - n.y, h = Math.sqrt(c * c + l * l);
|
|
2236
|
+
if (h === 0) {
|
|
2237
|
+
this.perpLineAtBase && (this.perpLineAtBase.style.width = "0px"), this.perpLineAtCursor && (this.perpLineAtCursor.style.width = "0px"), this.connectorLine && (this.connectorLine.style.width = "0px"), this.xAxisLine && (this.xAxisLine.style.width = "0px"), this.anglePath && this.anglePath.setAttribute("d", ""), this.angleLabelEl && (this.angleLabelEl.style.display = "none");
|
|
2238
|
+
return;
|
|
2239
|
+
}
|
|
2240
|
+
const d = this.options.perpendicularLength ?? 50, u = -l / h, f = c / h, y = { x: n.x + u * d, y: n.y + f * d }, m = { x: s.x + u * d, y: s.y + f * d };
|
|
2241
|
+
if (o(this.perpLineAtBase, n, y), o(this.perpLineAtCursor, s, m), o(this.connectorLine, y, m), this.labelEl) {
|
|
2242
|
+
const x = (y.x + m.x) / 2 + i, v = (y.y + m.y) / 2 + a - 24, w = Math.sqrt(
|
|
2243
|
+
(e.x - this.basePoint.x) ** 2 + (e.y - this.basePoint.y) ** 2
|
|
2244
|
+
);
|
|
2245
|
+
this.labelEl.textContent = w.toFixed(3), this.labelEl.style.left = `${x - 20}px`, this.labelEl.style.top = `${v}px`, this.labelEl.style.display = "";
|
|
2246
|
+
}
|
|
2247
|
+
if (this.xAxisLine) {
|
|
2248
|
+
const x = { x: n.x + h, y: n.y };
|
|
2249
|
+
o(this.xAxisLine, n, x);
|
|
2250
|
+
}
|
|
2251
|
+
if (this.angleSvg && this.anglePath && this.angleLabelEl) {
|
|
2252
|
+
const x = h, v = n.x + i, w = n.y + a, S = Math.atan2(s.y - n.y, s.x - n.x), _ = S * 180 / Math.PI, T = S / 2, k = v - x, B = w - x, A = x * 2;
|
|
2253
|
+
this.angleSvg.style.left = `${k}px`, this.angleSvg.style.top = `${B}px`, this.angleSvg.setAttribute("width", `${A}`), this.angleSvg.setAttribute("height", `${A}`), this.angleSvg.setAttribute("viewBox", `0 0 ${A} ${A}`);
|
|
2254
|
+
const G = x, j = x, Y = G + x, he = j, ne = G + x * Math.cos(S), H = j + x * Math.sin(S), $ = Math.abs(S) > Math.PI ? "1" : "0", q = S >= 0 ? "1" : "0", K = `M ${Y} ${he} A ${x} ${x} 0 ${$} ${q} ${ne} ${H}`;
|
|
2255
|
+
this.anglePath.setAttribute("d", K);
|
|
2256
|
+
const J = `${Math.abs(_).toFixed(1)}°`, ie = v + x * Math.cos(T), z = w + x * Math.sin(T);
|
|
2257
|
+
this.angleLabelEl.textContent = J;
|
|
2258
|
+
const V = 40;
|
|
2259
|
+
this.angleLabelEl.style.left = `${ie - V / 2}px`, this.angleLabelEl.style.top = `${z - 12}px`, this.angleLabelEl.style.display = "";
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
/** Disposes all HTML elements associated with this rubber-band. */
|
|
2263
|
+
dispose() {
|
|
2264
|
+
this.container && this.container.remove(), this.container = null, this.baseLine = null, this.perpLineAtBase = null, this.perpLineAtCursor = null, this.connectorLine = null, this.labelEl = null, this.angleLabelEl = null, this.xAxisLine = null, this.angleSvg = null, this.anglePath = null;
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2192
2267
|
const rn = class rn {
|
|
2193
2268
|
// ---------------------------------------------------------------------------
|
|
2194
2269
|
// CONSTRUCTOR
|
|
@@ -2201,7 +2276,10 @@ const rn = class rn {
|
|
|
2201
2276
|
* validation, and display mode.
|
|
2202
2277
|
*/
|
|
2203
2278
|
constructor(e, t) {
|
|
2204
|
-
this.lastPoint = null, this.visible = !1, this.disposed = !1, this.view = e, t.disableOSnap || (this.osnapMarkerManager = new bl(e)),
|
|
2279
|
+
this.lastPoint = null, this.visible = !1, this.disposed = !1, this.view = e, t.disableOSnap || (this.osnapMarkerManager = new bl(e)), t.basePoint && (this.rubberBand = new xl(this.view), this.rubberBand.start(t.basePoint, {
|
|
2280
|
+
color: "#0f0",
|
|
2281
|
+
showBaseLineOnly: t.showBaseLineOnly
|
|
2282
|
+
})), this.parent = t.parent ?? document.body, this.validateFn = t.validate, this.getDynamicValue = t.getDynamicValue, this.drawPreview = t.drawPreview, this.onCommit = t.onCommit, this.onChange = t.onChange, this.onCancel = t.onCancel, this.container = document.createElement("div"), this.container.className = "ml-floating-input";
|
|
2205
2283
|
const n = document.createElement("span");
|
|
2206
2284
|
n.className = "ml-floating-input-label", n.textContent = t.message ?? "", this.container.appendChild(n), this.inputs = new vl({
|
|
2207
2285
|
parent: this.container,
|
|
@@ -2290,8 +2368,8 @@ const rn = class rn {
|
|
|
2290
2368
|
* Safe to call multiple times; subsequent calls have no effect.
|
|
2291
2369
|
*/
|
|
2292
2370
|
dispose() {
|
|
2293
|
-
var e;
|
|
2294
|
-
this.disposed || (this.disposed = !0, (e = this.osnapMarkerManager) == null || e.clear(), this.inputs.dispose(), this.removeListener(!0), this.container.remove());
|
|
2371
|
+
var e, t;
|
|
2372
|
+
this.disposed || (this.disposed = !0, (e = this.osnapMarkerManager) == null || e.clear(), this.inputs.dispose(), (t = this.rubberBand) == null || t.dispose(), this.removeListener(!0), this.container.remove());
|
|
2295
2373
|
}
|
|
2296
2374
|
/**
|
|
2297
2375
|
* Sets position of this floating input
|
|
@@ -2338,10 +2416,10 @@ const rn = class rn {
|
|
|
2338
2416
|
* @param e The mouse move event containing the current cursor position.
|
|
2339
2417
|
*/
|
|
2340
2418
|
handleMouseMove(e) {
|
|
2341
|
-
var s;
|
|
2419
|
+
var s, i;
|
|
2342
2420
|
if (!this.visible) return;
|
|
2343
2421
|
const t = this.getPosition(e), n = this.getDynamicValue(t);
|
|
2344
|
-
this.inputs.setValue(n.raw), this.inputs.focused || this.inputs.focus(), (
|
|
2422
|
+
this.inputs.setValue(n.raw), (s = this.rubberBand) == null || s.update(t), this.inputs.focused || this.inputs.focus(), (i = this.drawPreview) == null || i.call(this, t);
|
|
2345
2423
|
}
|
|
2346
2424
|
/**
|
|
2347
2425
|
* Handles click events to commit inputs.
|
|
@@ -2431,81 +2509,6 @@ const rn = class rn {
|
|
|
2431
2509
|
};
|
|
2432
2510
|
rn.stylesInjected = !1;
|
|
2433
2511
|
let Wr = rn;
|
|
2434
|
-
class xl {
|
|
2435
|
-
constructor(e) {
|
|
2436
|
-
this.container = null, this.baseLine = null, this.perpLineAtBase = null, this.perpLineAtCursor = null, this.connectorLine = null, this.labelEl = null, this.angleLabelEl = null, this.xAxisLine = null, this.angleSvg = null, this.anglePath = null, this.options = {}, this.view = e;
|
|
2437
|
-
}
|
|
2438
|
-
/** Returns the parent container element that holds all rubber-band HTML elements. */
|
|
2439
|
-
get element() {
|
|
2440
|
-
return this.container;
|
|
2441
|
-
}
|
|
2442
|
-
/**
|
|
2443
|
-
* Starts the rubber-band preview.
|
|
2444
|
-
* @param basePoint The starting point in world coordinates.
|
|
2445
|
-
*/
|
|
2446
|
-
start(e, t) {
|
|
2447
|
-
this.basePoint = new He(e), this.options = t || {};
|
|
2448
|
-
const n = this.options.color || "#0f0";
|
|
2449
|
-
this.container = document.createElement("div"), this.container.style.position = "fixed", this.container.style.left = "0", this.container.style.top = "0", this.container.style.pointerEvents = "none", this.container.style.zIndex = "99999", document.body.appendChild(this.container), this.baseLine = document.createElement("div"), this.baseLine.style.position = "fixed", this.baseLine.style.borderTop = `1px solid ${n}`, this.container.appendChild(this.baseLine);
|
|
2450
|
-
const s = () => {
|
|
2451
|
-
const i = document.createElement("div");
|
|
2452
|
-
return i.style.position = "fixed", i.style.borderTop = `1px dashed ${n}`, this.container.appendChild(i), i;
|
|
2453
|
-
};
|
|
2454
|
-
this.options.showBaseLineOnly || (this.perpLineAtBase = s(), this.perpLineAtCursor = s(), this.connectorLine = s(), this.labelEl = document.createElement("div"), this.labelEl.style.position = "fixed", this.labelEl.style.color = n, this.labelEl.style.fontSize = "12px", this.labelEl.style.padding = "2px 4px", this.labelEl.style.borderRadius = "4px", this.container.appendChild(this.labelEl), this.xAxisLine = document.createElement("div"), this.xAxisLine.style.position = "fixed", this.xAxisLine.style.borderTop = `1px solid ${n}`, this.container.appendChild(this.xAxisLine), this.angleSvg = document.createElementNS(
|
|
2455
|
-
"http://www.w3.org/2000/svg",
|
|
2456
|
-
"svg"
|
|
2457
|
-
), this.angleSvg.setAttribute(
|
|
2458
|
-
"style",
|
|
2459
|
-
"position:absolute; overflow:visible; pointer-events:none;"
|
|
2460
|
-
), this.anglePath = document.createElementNS(
|
|
2461
|
-
"http://www.w3.org/2000/svg",
|
|
2462
|
-
"path"
|
|
2463
|
-
), this.anglePath.setAttribute("fill", "none"), this.anglePath.setAttribute("stroke", n), this.anglePath.setAttribute("stroke-width", "1"), this.anglePath.setAttribute("stroke-dasharray", "4 4"), this.angleSvg.appendChild(this.anglePath), this.container.appendChild(this.angleSvg), this.angleLabelEl = document.createElement("div"), this.angleLabelEl.style.position = "fixed", this.angleLabelEl.style.color = n, this.angleLabelEl.style.fontSize = "12px", this.angleLabelEl.style.padding = "2px 4px", this.angleLabelEl.style.borderRadius = "4px", this.container.appendChild(this.angleLabelEl));
|
|
2464
|
-
}
|
|
2465
|
-
/**
|
|
2466
|
-
* Updates the rubber-band lines to a new target point.
|
|
2467
|
-
* @param targetPoint The current cursor position in world coordinates.
|
|
2468
|
-
*/
|
|
2469
|
-
update(e) {
|
|
2470
|
-
if (!this.container || !this.basePoint || !this.baseLine) return;
|
|
2471
|
-
const t = this.view.canvas.getBoundingClientRect(), n = this.view.wcs2Cwcs(this.basePoint), s = this.view.wcs2Cwcs(e), i = t.left, a = t.top, o = (x, v, w) => {
|
|
2472
|
-
const S = w.x - v.x, _ = w.y - v.y, T = Math.sqrt(S * S + _ * _), k = Math.atan2(_, S) * (180 / Math.PI);
|
|
2473
|
-
x.style.width = `${T}px`, x.style.transformOrigin = "0 0", x.style.transform = `translate(${v.x + i}px, ${v.y + a}px) rotate(${k}deg)`;
|
|
2474
|
-
};
|
|
2475
|
-
if (o(this.baseLine, n, s), this.options.showBaseLineOnly || !this.perpLineAtBase || !this.perpLineAtCursor || !this.connectorLine)
|
|
2476
|
-
return;
|
|
2477
|
-
const c = s.x - n.x, l = s.y - n.y, h = Math.sqrt(c * c + l * l);
|
|
2478
|
-
if (h === 0) {
|
|
2479
|
-
this.perpLineAtBase && (this.perpLineAtBase.style.width = "0px"), this.perpLineAtCursor && (this.perpLineAtCursor.style.width = "0px"), this.connectorLine && (this.connectorLine.style.width = "0px"), this.xAxisLine && (this.xAxisLine.style.width = "0px"), this.anglePath && this.anglePath.setAttribute("d", ""), this.angleLabelEl && (this.angleLabelEl.style.display = "none");
|
|
2480
|
-
return;
|
|
2481
|
-
}
|
|
2482
|
-
const d = this.options.perpendicularLength ?? 50, u = -l / h, f = c / h, y = { x: n.x + u * d, y: n.y + f * d }, m = { x: s.x + u * d, y: s.y + f * d };
|
|
2483
|
-
if (o(this.perpLineAtBase, n, y), o(this.perpLineAtCursor, s, m), o(this.connectorLine, y, m), this.labelEl) {
|
|
2484
|
-
const x = (y.x + m.x) / 2 + i, v = (y.y + m.y) / 2 + a - 24, w = Math.sqrt(
|
|
2485
|
-
(e.x - this.basePoint.x) ** 2 + (e.y - this.basePoint.y) ** 2
|
|
2486
|
-
);
|
|
2487
|
-
this.labelEl.textContent = w.toFixed(3), this.labelEl.style.left = `${x - 20}px`, this.labelEl.style.top = `${v}px`, this.labelEl.style.display = "";
|
|
2488
|
-
}
|
|
2489
|
-
if (this.xAxisLine) {
|
|
2490
|
-
const x = { x: n.x + h, y: n.y };
|
|
2491
|
-
o(this.xAxisLine, n, x);
|
|
2492
|
-
}
|
|
2493
|
-
if (this.angleSvg && this.anglePath && this.angleLabelEl) {
|
|
2494
|
-
const x = h, v = n.x + i, w = n.y + a, S = Math.atan2(s.y - n.y, s.x - n.x), _ = S * 180 / Math.PI, T = S / 2, k = v - x, B = w - x, A = x * 2;
|
|
2495
|
-
this.angleSvg.style.left = `${k}px`, this.angleSvg.style.top = `${B}px`, this.angleSvg.setAttribute("width", `${A}`), this.angleSvg.setAttribute("height", `${A}`), this.angleSvg.setAttribute("viewBox", `0 0 ${A} ${A}`);
|
|
2496
|
-
const G = x, j = x, Y = G + x, he = j, ne = G + x * Math.cos(S), H = j + x * Math.sin(S), $ = Math.abs(S) > Math.PI ? "1" : "0", q = S >= 0 ? "1" : "0", K = `M ${Y} ${he} A ${x} ${x} 0 ${$} ${q} ${ne} ${H}`;
|
|
2497
|
-
this.anglePath.setAttribute("d", K);
|
|
2498
|
-
const J = `${Math.abs(_).toFixed(1)}°`, ie = v + x * Math.cos(T), z = w + x * Math.sin(T);
|
|
2499
|
-
this.angleLabelEl.textContent = J;
|
|
2500
|
-
const V = 40;
|
|
2501
|
-
this.angleLabelEl.style.left = `${ie - V / 2}px`, this.angleLabelEl.style.top = `${z - 12}px`, this.angleLabelEl.style.display = "";
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
/** Disposes all HTML elements associated with this rubber-band. */
|
|
2505
|
-
dispose() {
|
|
2506
|
-
this.container && this.container.remove(), this.container = null, this.baseLine = null, this.perpLineAtBase = null, this.perpLineAtCursor = null, this.connectorLine = null, this.labelEl = null, this.angleLabelEl = null, this.xAxisLine = null, this.angleSvg = null, this.anglePath = null;
|
|
2507
|
-
}
|
|
2508
|
-
}
|
|
2509
2512
|
const sn = class sn {
|
|
2510
2513
|
/**
|
|
2511
2514
|
* Construct the manager and attach mousemove listener used for floating input
|
|
@@ -2606,8 +2609,9 @@ const sn = class sn {
|
|
|
2606
2609
|
message: e.message,
|
|
2607
2610
|
twoInputs: !1,
|
|
2608
2611
|
jig: e.jig,
|
|
2609
|
-
showBaseLineOnly: !
|
|
2612
|
+
showBaseLineOnly: !e.useDashedLine,
|
|
2610
2613
|
useBasePoint: !0,
|
|
2614
|
+
basePoint: e.basePoint,
|
|
2611
2615
|
handler: n,
|
|
2612
2616
|
getDynamicValue: t
|
|
2613
2617
|
});
|
|
@@ -2625,8 +2629,9 @@ const sn = class sn {
|
|
|
2625
2629
|
message: e.message,
|
|
2626
2630
|
twoInputs: !1,
|
|
2627
2631
|
jig: e.jig,
|
|
2628
|
-
showBaseLineOnly: !
|
|
2632
|
+
showBaseLineOnly: !e.useDashedLine,
|
|
2629
2633
|
useBasePoint: !0,
|
|
2634
|
+
basePoint: e.basePoint,
|
|
2630
2635
|
handler: n,
|
|
2631
2636
|
getDynamicValue: t
|
|
2632
2637
|
});
|
|
@@ -2700,6 +2705,7 @@ const sn = class sn {
|
|
|
2700
2705
|
jig: e.jig,
|
|
2701
2706
|
showBaseLineOnly: !e.useDashedLine,
|
|
2702
2707
|
useBasePoint: e.useBasePoint,
|
|
2708
|
+
basePoint: e.basePoint,
|
|
2703
2709
|
cleanup: t,
|
|
2704
2710
|
handler: i,
|
|
2705
2711
|
getDynamicValue: s,
|
|
@@ -2722,11 +2728,16 @@ const sn = class sn {
|
|
|
2722
2728
|
isValid: u != null,
|
|
2723
2729
|
value: u ?? void 0
|
|
2724
2730
|
};
|
|
2725
|
-
}
|
|
2731
|
+
};
|
|
2732
|
+
let i;
|
|
2733
|
+
e.useBasePoint && (e.basePoint ? i = e.basePoint : this.lastPoint && (i = { x: this.lastPoint.x, y: this.lastPoint.y }));
|
|
2734
|
+
const a = new Wr(this.view, {
|
|
2726
2735
|
parent: this.view.canvas,
|
|
2727
2736
|
twoInputs: e.twoInputs,
|
|
2728
2737
|
message: e.message,
|
|
2729
2738
|
disableOSnap: e.disableOSnap,
|
|
2739
|
+
showBaseLineOnly: e.showBaseLineOnly,
|
|
2740
|
+
basePoint: i,
|
|
2730
2741
|
validate: s,
|
|
2731
2742
|
getDynamicValue: e.getDynamicValue,
|
|
2732
2743
|
drawPreview: (d) => {
|
|
@@ -2735,24 +2746,18 @@ const sn = class sn {
|
|
|
2735
2746
|
const f = e.getDynamicValue(d);
|
|
2736
2747
|
e.jig.update(f.value), e.jig.render();
|
|
2737
2748
|
}
|
|
2738
|
-
|
|
2749
|
+
(u = e.drawPreview) == null || u.call(e, d);
|
|
2739
2750
|
},
|
|
2740
2751
|
onCommit: (d) => {
|
|
2741
|
-
c(d),
|
|
2742
|
-
x:
|
|
2743
|
-
y:
|
|
2752
|
+
c(d), a.lastPoint && (this.lastPoint = {
|
|
2753
|
+
x: a.lastPoint.x,
|
|
2754
|
+
y: a.lastPoint.y
|
|
2744
2755
|
});
|
|
2745
2756
|
},
|
|
2746
2757
|
onCancel: () => l()
|
|
2747
|
-
})
|
|
2748
|
-
let a;
|
|
2749
|
-
this.lastPoint && e.useBasePoint && (a = new xl(this.view), a.start(this.lastPoint, {
|
|
2750
|
-
color: "#0f0",
|
|
2751
|
-
showBaseLineOnly: e.showBaseLineOnly
|
|
2752
|
-
}));
|
|
2753
|
-
const o = () => {
|
|
2758
|
+
}), o = () => {
|
|
2754
2759
|
var d, u;
|
|
2755
|
-
this.active = !1, (d = e.cleanup) == null || d.call(e), (u = e.jig) == null || u.end(), document.removeEventListener("keydown", h), a
|
|
2760
|
+
this.active = !1, (d = e.cleanup) == null || d.call(e), (u = e.jig) == null || u.end(), document.removeEventListener("keydown", h), a.dispose();
|
|
2756
2761
|
}, c = (d) => {
|
|
2757
2762
|
o(), t(d);
|
|
2758
2763
|
}, l = () => {
|
|
@@ -2760,7 +2765,7 @@ const sn = class sn {
|
|
|
2760
2765
|
}, h = (d) => {
|
|
2761
2766
|
d.key === "Escape" && l();
|
|
2762
2767
|
};
|
|
2763
|
-
document.addEventListener("keydown", h),
|
|
2768
|
+
document.addEventListener("keydown", h), a.showAt(this.view.curMousePos);
|
|
2764
2769
|
});
|
|
2765
2770
|
}
|
|
2766
2771
|
};
|