@mlightcad/cad-simple-viewer 1.4.10 → 1.4.11
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/LICENSE +21 -21
- package/README.md +88 -88
- package/dist/index.js +16659 -11788
- package/dist/index.umd.cjs +156 -32
- package/dist/libredwg-parser-worker.js +78 -31
- package/dist/mtext-renderer-worker.js +28725 -28097
- package/lib/app/AcApContext.d.ts.map +1 -1
- package/lib/app/AcApContext.js +3 -3
- package/lib/app/AcApContext.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts +23 -1
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +61 -12
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApDocument.d.ts.map +1 -1
- package/lib/app/AcApDocument.js +2 -2
- package/lib/app/AcApDocument.js.map +1 -1
- package/lib/command/AcApClearMeasurementsCmd.d.ts +13 -0
- package/lib/command/AcApClearMeasurementsCmd.d.ts.map +1 -0
- package/lib/command/AcApClearMeasurementsCmd.js +86 -0
- package/lib/command/AcApClearMeasurementsCmd.js.map +1 -0
- package/lib/command/AcApLogCmd.js +3 -3
- package/lib/command/AcApLogCmd.js.map +1 -1
- package/lib/command/AcApMTextCmd.d.ts +12 -0
- package/lib/command/AcApMTextCmd.d.ts.map +1 -0
- package/lib/command/AcApMTextCmd.js +120 -0
- package/lib/command/AcApMTextCmd.js.map +1 -0
- package/lib/command/AcApMeasureAngleCmd.d.ts +15 -0
- package/lib/command/AcApMeasureAngleCmd.d.ts.map +1 -0
- package/lib/command/AcApMeasureAngleCmd.js +358 -0
- package/lib/command/AcApMeasureAngleCmd.js.map +1 -0
- package/lib/command/AcApMeasureArcCmd.d.ts +25 -0
- package/lib/command/AcApMeasureArcCmd.d.ts.map +1 -0
- package/lib/command/AcApMeasureArcCmd.js +411 -0
- package/lib/command/AcApMeasureArcCmd.js.map +1 -0
- package/lib/command/AcApMeasureAreaCmd.d.ts +21 -0
- package/lib/command/AcApMeasureAreaCmd.d.ts.map +1 -0
- package/lib/command/AcApMeasureAreaCmd.js +379 -0
- package/lib/command/AcApMeasureAreaCmd.js.map +1 -0
- package/lib/command/AcApMeasureDistanceCmd.d.ts +34 -0
- package/lib/command/AcApMeasureDistanceCmd.d.ts.map +1 -0
- package/lib/command/AcApMeasureDistanceCmd.js +179 -0
- package/lib/command/AcApMeasureDistanceCmd.js.map +1 -0
- package/lib/command/AcApSwitchBgCmd.js +2 -2
- package/lib/command/AcApSwitchBgCmd.js.map +1 -1
- package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
- package/lib/command/AcApSysVarCmd.js +16 -6
- package/lib/command/AcApSysVarCmd.js.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.d.ts +1 -1
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.js +6 -3
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
- package/lib/command/index.d.ts +6 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +6 -0
- package/lib/command/index.js.map +1 -1
- package/lib/editor/global/AcEdConditionWaiter.d.ts +1 -1
- package/lib/editor/global/AcEdConditionWaiter.d.ts.map +1 -1
- package/lib/editor/global/AcEdConditionWaiter.js +3 -2
- package/lib/editor/global/AcEdConditionWaiter.js.map +1 -1
- package/lib/editor/input/AcEdCursorManager.js +2 -2
- package/lib/editor/input/AcEdCursorManager.js.map +1 -1
- package/lib/editor/input/AcEditor.d.ts +2 -2
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +2 -2
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.d.ts +20 -0
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.js +80 -0
- package/lib/editor/input/prompt/AcEdPromptBoxOptions.js.map +1 -0
- package/lib/editor/input/prompt/index.d.ts +1 -0
- package/lib/editor/input/prompt/index.d.ts.map +1 -1
- package/lib/editor/input/prompt/index.js +1 -0
- package/lib/editor/input/prompt/index.js.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.d.ts +2 -2
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.js +8 -7
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
- package/lib/editor/input/ui/AcEdMTextEditor.d.ts +79 -0
- package/lib/editor/input/ui/AcEdMTextEditor.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdMTextEditor.js +157 -0
- package/lib/editor/input/ui/AcEdMTextEditor.js.map +1 -0
- package/lib/editor/input/ui/index.d.ts +2 -0
- package/lib/editor/input/ui/index.d.ts.map +1 -1
- package/lib/editor/input/ui/index.js +1 -0
- package/lib/editor/input/ui/index.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +15 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +3 -1
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/i18n/en/command.d.ts +6 -0
- package/lib/i18n/en/command.d.ts.map +1 -1
- package/lib/i18n/en/command.js +6 -0
- package/lib/i18n/en/command.js.map +1 -1
- package/lib/i18n/en/jig.d.ts +21 -0
- package/lib/i18n/en/jig.d.ts.map +1 -1
- package/lib/i18n/en/jig.js +21 -0
- package/lib/i18n/en/jig.js.map +1 -1
- package/lib/i18n/zh/command.d.ts +6 -0
- package/lib/i18n/zh/command.d.ts.map +1 -1
- package/lib/i18n/zh/command.js +6 -0
- package/lib/i18n/zh/command.js.map +1 -1
- package/lib/i18n/zh/jig.d.ts +21 -0
- package/lib/i18n/zh/jig.d.ts.map +1 -1
- package/lib/i18n/zh/jig.js +21 -0
- package/lib/i18n/zh/jig.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/plugin/AcApPluginExample.d.ts.map +1 -1
- package/lib/plugin/AcApPluginExample.js +7 -6
- package/lib/plugin/AcApPluginExample.js.map +1 -1
- package/lib/plugin/AcApPluginManager.d.ts +4 -4
- package/lib/plugin/AcApPluginManager.d.ts.map +1 -1
- package/lib/plugin/AcApPluginManager.js +7 -6
- package/lib/plugin/AcApPluginManager.js.map +1 -1
- package/lib/util/AcApMeasurementUtils.d.ts +12 -0
- package/lib/util/AcApMeasurementUtils.d.ts.map +1 -0
- package/lib/util/AcApMeasurementUtils.js +36 -0
- package/lib/util/AcApMeasurementUtils.js.map +1 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/lib/view/AcTrLayout.d.ts +14 -0
- package/lib/view/AcTrLayout.d.ts.map +1 -1
- package/lib/view/AcTrLayout.js +21 -0
- package/lib/view/AcTrLayout.js.map +1 -1
- package/lib/view/AcTrLayoutView.d.ts +5 -0
- package/lib/view/AcTrLayoutView.d.ts.map +1 -1
- package/lib/view/AcTrLayoutView.js +10 -0
- package/lib/view/AcTrLayoutView.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +7 -1
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +16 -2
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +16 -1
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +64 -15
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +7 -6
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
27
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
import { AcDbMText } from '@mlightcad/data-model';
|
|
53
|
+
import { AcApDocManager } from '../app';
|
|
54
|
+
import { AcEdCommand, AcEdMTextEditor, AcEdOpenMode, AcEdPromptBoxOptions } from '../editor';
|
|
55
|
+
import { AcApI18n } from '../i18n';
|
|
56
|
+
/**
|
|
57
|
+
* Command to create one mtext entity.
|
|
58
|
+
*/
|
|
59
|
+
var AcApMTextCmd = /** @class */ (function (_super) {
|
|
60
|
+
__extends(AcApMTextCmd, _super);
|
|
61
|
+
function AcApMTextCmd() {
|
|
62
|
+
var _this = _super.call(this) || this;
|
|
63
|
+
_this.mtextEditor = new AcEdMTextEditor();
|
|
64
|
+
_this.mode = AcEdOpenMode.Write;
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
AcApMTextCmd.prototype.execute = function (context) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
var boxPrompt, box, width, view, textHeight, location, toolbarFontFamilies, result, contents, mtext;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
boxPrompt = new AcEdPromptBoxOptions(AcApI18n.t('main.inputManager.firstCorner'), AcApI18n.t('main.inputManager.secondCorner'));
|
|
74
|
+
boxPrompt.useBasePoint = false;
|
|
75
|
+
boxPrompt.useDashedLine = false;
|
|
76
|
+
return [4 /*yield*/, AcApDocManager.instance.editor.getBox(boxPrompt)];
|
|
77
|
+
case 1:
|
|
78
|
+
box = _a.sent();
|
|
79
|
+
width = Math.max(Math.abs(box.max.x - box.min.x), 1e-4);
|
|
80
|
+
view = context.view;
|
|
81
|
+
textHeight = this.pixelsToWorldY(view, 24);
|
|
82
|
+
location = { x: box.min.x, y: box.max.y, z: 0 };
|
|
83
|
+
toolbarFontFamilies = Array.from(new Set(AcApDocManager.instance.avaiableFonts
|
|
84
|
+
.flatMap(function (fontInfo) { return fontInfo.name; })
|
|
85
|
+
.map(function (fontName) { return fontName.trim(); })
|
|
86
|
+
.filter(function (fontName) { return fontName.length > 0; })));
|
|
87
|
+
return [4 /*yield*/, this.mtextEditor.open({
|
|
88
|
+
view: view,
|
|
89
|
+
location: location,
|
|
90
|
+
width: width,
|
|
91
|
+
textHeight: textHeight,
|
|
92
|
+
toolbarFontFamilies: toolbarFontFamilies
|
|
93
|
+
})];
|
|
94
|
+
case 2:
|
|
95
|
+
result = _a.sent();
|
|
96
|
+
if (!result)
|
|
97
|
+
return [2 /*return*/];
|
|
98
|
+
contents = result.contents.trim();
|
|
99
|
+
if (!contents)
|
|
100
|
+
return [2 /*return*/];
|
|
101
|
+
mtext = new AcDbMText();
|
|
102
|
+
mtext.location = location;
|
|
103
|
+
mtext.contents = result.contents;
|
|
104
|
+
mtext.width = result.width;
|
|
105
|
+
mtext.height = result.height;
|
|
106
|
+
context.doc.database.tables.blockTable.modelSpace.appendEntity(mtext);
|
|
107
|
+
return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
AcApMTextCmd.prototype.pixelsToWorldY = function (view, pixels) {
|
|
113
|
+
var p0 = view.screenToWorld({ x: 0, y: 0 });
|
|
114
|
+
var p1 = view.screenToWorld({ x: 0, y: pixels });
|
|
115
|
+
return Math.max(Math.abs(p1.y - p0.y), 1e-4);
|
|
116
|
+
};
|
|
117
|
+
return AcApMTextCmd;
|
|
118
|
+
}(AcEdCommand));
|
|
119
|
+
export { AcApMTextCmd };
|
|
120
|
+
//# sourceMappingURL=AcApMTextCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApMTextCmd.js","sourceRoot":"","sources":["../../src/command/AcApMTextCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,OAAO,EAAe,cAAc,EAAE,MAAM,QAAQ,CAAA;AACpD,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,oBAAoB,EACrB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGlC;;GAEG;AACH;IAAkC,gCAAW;IAG3C;QACE,YAAA,MAAK,WAAE,SAAA;QAHQ,iBAAW,GAAG,IAAI,eAAe,EAAE,CAAA;QAIlD,KAAI,CAAC,IAAI,GAAG,YAAY,CAAC,KAAK,CAAA;;IAChC,CAAC;IAEK,8BAAO,GAAb,UAAc,OAAoB;;;;;;wBAC1B,SAAS,GAAG,IAAI,oBAAoB,CACxC,QAAQ,CAAC,CAAC,CAAC,+BAA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ACpB,CAAC,EAAA;;wBANI,MAAM,GAAG,SAMb;wBACF,IAAI,CAAC,MAAM;4BAAE,sBAAM;wBAEb,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;wBACvC,IAAI,CAAC,QAAQ;4BAAE,sBAAM;wBAEf,KAAK,GAAG,IAAI,SAAS,EAAE,CAAA;wBAC7B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;wBACzB,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;wBAChC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;wBAC1B,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;wBAE5B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;;;;;KACtE;IAEO,qCAAc,GAAtB,UAAuB,IAAgB,EAAE,MAAc;QACrD,IAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;QAC7C,IAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;QAClD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;IAC9C,CAAC;IACH,mBAAC;AAAD,CAAC,AAvDD,CAAkC,WAAW,GAuD5C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AcApContext } from '../app';
|
|
2
|
+
import { AcEdCommand } from '../editor';
|
|
3
|
+
/**
|
|
4
|
+
* Command that measures the angle between two arms sharing a common vertex.
|
|
5
|
+
*
|
|
6
|
+
* Prompts the user to pick three world points: the vertex, a point on the
|
|
7
|
+
* first arm, and a point on the second arm. After the second arm is confirmed,
|
|
8
|
+
* transient CAD lines are added for both arms and persistent DOM overlays
|
|
9
|
+
* (arc canvas + dots + badge) are placed via {@link AcTrHtmlTransientManager}.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AcApMeasureAngleCmd extends AcEdCommand {
|
|
12
|
+
constructor();
|
|
13
|
+
execute(context: AcApContext): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=AcApMeasureAngleCmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApMeasureAngleCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApMeasureAngleCmd.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAkB,MAAM,QAAQ,CAAA;AACpD,OAAO,EAEL,WAAW,EAIZ,MAAM,WAAW,CAAA;AAyNlB;;;;;;;GAOG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;;IAM5C,OAAO,CAAC,OAAO,EAAE,WAAW;CAgInC"}
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
27
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
import { AcDbLine, AcGiLineWeight } from '@mlightcad/data-model';
|
|
53
|
+
import { AcApDocManager } from '../app';
|
|
54
|
+
import { AcEdCommand, AcEdOpenMode, AcEdPreviewJig, AcEdPromptPointOptions } from '../editor';
|
|
55
|
+
import { AcApI18n } from '../i18n';
|
|
56
|
+
import { colorToCss, makeBadge, makeDot, measurementColor } from '../util';
|
|
57
|
+
import { registerMeasurementCleanup } from './AcApClearMeasurementsCmd';
|
|
58
|
+
/** Returns the angle in degrees between two arms sharing a common vertex. */
|
|
59
|
+
function calcAngleDeg(vertex, arm1, arm2) {
|
|
60
|
+
var dx1 = arm1.x - vertex.x;
|
|
61
|
+
var dy1 = arm1.y - vertex.y;
|
|
62
|
+
var dx2 = arm2.x - vertex.x;
|
|
63
|
+
var dy2 = arm2.y - vertex.y;
|
|
64
|
+
var dot = dx1 * dx2 + dy1 * dy2;
|
|
65
|
+
var cross = dx1 * dy2 - dy1 * dx2;
|
|
66
|
+
var rad = Math.atan2(Math.abs(cross), dot);
|
|
67
|
+
return (rad * 180) / Math.PI;
|
|
68
|
+
}
|
|
69
|
+
/** Normalises an angle into [0, 2pi). */
|
|
70
|
+
var normaliseAngle = function (a) {
|
|
71
|
+
return ((a % (2 * Math.PI)) + 2 * Math.PI) % (2 * Math.PI);
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Draws the first arm (vertex->arm1) as a dashed line on a canvas overlay,
|
|
75
|
+
* used during second arm selection so the user can see the first arm.
|
|
76
|
+
*/
|
|
77
|
+
function drawArm1OnCanvas(canvas, view, vertex, arm1, color) {
|
|
78
|
+
var rect = view.canvas.getBoundingClientRect();
|
|
79
|
+
var dpr = window.devicePixelRatio || 1;
|
|
80
|
+
var w = Math.round(rect.width);
|
|
81
|
+
var h = Math.round(rect.height);
|
|
82
|
+
canvas.style.left = "".concat(rect.left, "px");
|
|
83
|
+
canvas.style.top = "".concat(rect.top, "px");
|
|
84
|
+
canvas.style.width = "".concat(w, "px");
|
|
85
|
+
canvas.style.height = "".concat(h, "px");
|
|
86
|
+
if (canvas.width !== w * dpr || canvas.height !== h * dpr) {
|
|
87
|
+
canvas.width = w * dpr;
|
|
88
|
+
canvas.height = h * dpr;
|
|
89
|
+
}
|
|
90
|
+
var ctx = canvas.getContext('2d');
|
|
91
|
+
if (!ctx)
|
|
92
|
+
return;
|
|
93
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
94
|
+
ctx.save();
|
|
95
|
+
ctx.scale(dpr, dpr);
|
|
96
|
+
var sv = view.worldToScreen(vertex);
|
|
97
|
+
var sa = view.worldToScreen(arm1);
|
|
98
|
+
ctx.beginPath();
|
|
99
|
+
ctx.moveTo(sv.x, sv.y);
|
|
100
|
+
ctx.lineTo(sa.x, sa.y);
|
|
101
|
+
ctx.strokeStyle = colorToCss(color);
|
|
102
|
+
ctx.lineWidth = 2;
|
|
103
|
+
ctx.setLineDash([8, 5]);
|
|
104
|
+
ctx.stroke();
|
|
105
|
+
ctx.setLineDash([]);
|
|
106
|
+
ctx.restore();
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Draws an arc between two arms on a canvas overlay for the persistent
|
|
110
|
+
* angle visualization.
|
|
111
|
+
*/
|
|
112
|
+
function drawAngleArcOnCanvas(canvas, view, vertex, arm1, arm2, color) {
|
|
113
|
+
var rect = view.canvas.getBoundingClientRect();
|
|
114
|
+
var dpr = window.devicePixelRatio || 1;
|
|
115
|
+
var w = Math.round(rect.width);
|
|
116
|
+
var h = Math.round(rect.height);
|
|
117
|
+
canvas.style.left = "".concat(rect.left, "px");
|
|
118
|
+
canvas.style.top = "".concat(rect.top, "px");
|
|
119
|
+
canvas.style.width = "".concat(w, "px");
|
|
120
|
+
canvas.style.height = "".concat(h, "px");
|
|
121
|
+
if (canvas.width !== w * dpr || canvas.height !== h * dpr) {
|
|
122
|
+
canvas.width = w * dpr;
|
|
123
|
+
canvas.height = h * dpr;
|
|
124
|
+
}
|
|
125
|
+
var ctx = canvas.getContext('2d');
|
|
126
|
+
if (!ctx)
|
|
127
|
+
return;
|
|
128
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
129
|
+
ctx.save();
|
|
130
|
+
ctx.scale(dpr, dpr);
|
|
131
|
+
var sv = view.worldToScreen(vertex);
|
|
132
|
+
var sa1 = view.worldToScreen(arm1);
|
|
133
|
+
var sa2 = view.worldToScreen(arm2);
|
|
134
|
+
var len1 = Math.hypot(sa1.x - sv.x, sa1.y - sv.y);
|
|
135
|
+
var len2 = Math.hypot(sa2.x - sv.x, sa2.y - sv.y);
|
|
136
|
+
var arcR = Math.max(Math.min(len1, len2) * 0.3, 15);
|
|
137
|
+
var startAngle = Math.atan2(sa1.y - sv.y, sa1.x - sv.x);
|
|
138
|
+
var endAngle = Math.atan2(sa2.y - sv.y, sa2.x - sv.x);
|
|
139
|
+
var antiClockwise = normaliseAngle(endAngle - startAngle) > Math.PI;
|
|
140
|
+
ctx.beginPath();
|
|
141
|
+
ctx.arc(sv.x, sv.y, arcR, startAngle, endAngle, antiClockwise);
|
|
142
|
+
ctx.strokeStyle = colorToCss(color);
|
|
143
|
+
ctx.lineWidth = 2;
|
|
144
|
+
ctx.stroke();
|
|
145
|
+
ctx.restore();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Simple rubber-band jig for picking arm1: draws a transient line
|
|
149
|
+
* from vertex to cursor.
|
|
150
|
+
*/
|
|
151
|
+
var AcApMeasureArm1Jig = /** @class */ (function (_super) {
|
|
152
|
+
__extends(AcApMeasureArm1Jig, _super);
|
|
153
|
+
function AcApMeasureArm1Jig(view, vertex, color) {
|
|
154
|
+
var _this = _super.call(this, view) || this;
|
|
155
|
+
_this._line = new AcDbLine(vertex, vertex);
|
|
156
|
+
_this._line.color = color;
|
|
157
|
+
_this._line.lineWeight = AcGiLineWeight.LineWeight070;
|
|
158
|
+
return _this;
|
|
159
|
+
}
|
|
160
|
+
Object.defineProperty(AcApMeasureArm1Jig.prototype, "entity", {
|
|
161
|
+
get: function () {
|
|
162
|
+
return this._line;
|
|
163
|
+
},
|
|
164
|
+
enumerable: false,
|
|
165
|
+
configurable: true
|
|
166
|
+
});
|
|
167
|
+
AcApMeasureArm1Jig.prototype.update = function (p) {
|
|
168
|
+
this._line.endPoint = p;
|
|
169
|
+
};
|
|
170
|
+
return AcApMeasureArm1Jig;
|
|
171
|
+
}(AcEdPreviewJig));
|
|
172
|
+
/**
|
|
173
|
+
* Preview jig for picking arm2: draws a transient line from vertex to
|
|
174
|
+
* cursor, redraws the first arm as a dashed canvas line, and shows a live
|
|
175
|
+
* angle badge.
|
|
176
|
+
*/
|
|
177
|
+
var AcApMeasureAngleJig = /** @class */ (function (_super) {
|
|
178
|
+
__extends(AcApMeasureAngleJig, _super);
|
|
179
|
+
function AcApMeasureAngleJig(view, vertex, arm1, canvas, color) {
|
|
180
|
+
var _this = _super.call(this, view) || this;
|
|
181
|
+
_this._vertex = vertex;
|
|
182
|
+
_this._arm1 = arm1;
|
|
183
|
+
_this._view = view;
|
|
184
|
+
_this._canvas = canvas;
|
|
185
|
+
_this._color = color;
|
|
186
|
+
_this._line = new AcDbLine(vertex, vertex);
|
|
187
|
+
_this._line.color = color;
|
|
188
|
+
_this._line.lineWeight = AcGiLineWeight.LineWeight070;
|
|
189
|
+
_this._badge = document.createElement('div');
|
|
190
|
+
_this._badge.style.cssText =
|
|
191
|
+
"position:fixed;background:rgba(255,255,255,0.95);color:".concat(colorToCss(color), ";") +
|
|
192
|
+
'font-size:13px;font-family:sans-serif;font-weight:500;' +
|
|
193
|
+
'padding:3px 14px;border-radius:20px;pointer-events:none;' +
|
|
194
|
+
'transform:translate(-50%,-50%);white-space:nowrap;' +
|
|
195
|
+
'box-shadow:0 1px 4px rgba(0,0,0,0.2);z-index:99999;display:none;';
|
|
196
|
+
document.body.appendChild(_this._badge);
|
|
197
|
+
return _this;
|
|
198
|
+
}
|
|
199
|
+
Object.defineProperty(AcApMeasureAngleJig.prototype, "entity", {
|
|
200
|
+
get: function () {
|
|
201
|
+
return this._line;
|
|
202
|
+
},
|
|
203
|
+
enumerable: false,
|
|
204
|
+
configurable: true
|
|
205
|
+
});
|
|
206
|
+
AcApMeasureAngleJig.prototype.update = function (p) {
|
|
207
|
+
this._line.endPoint = p;
|
|
208
|
+
// Redraw the first arm dashed line (stays in sync with pan/zoom)
|
|
209
|
+
drawArm1OnCanvas(this._canvas, this._view, this._vertex, this._arm1, this._color);
|
|
210
|
+
var deg = calcAngleDeg(this._vertex, this._arm1, p);
|
|
211
|
+
this._badge.textContent = "~ ".concat(deg.toFixed(2), "\u00B0");
|
|
212
|
+
this._badge.style.display = 'block';
|
|
213
|
+
var rect = this._view.canvas.getBoundingClientRect();
|
|
214
|
+
var sv = this._view.worldToScreen(this._vertex);
|
|
215
|
+
this._badge.style.left = "".concat(sv.x + rect.left, "px");
|
|
216
|
+
this._badge.style.top = "".concat(sv.y + rect.top - 30, "px");
|
|
217
|
+
};
|
|
218
|
+
AcApMeasureAngleJig.prototype.end = function () {
|
|
219
|
+
_super.prototype.end.call(this);
|
|
220
|
+
this._badge.remove();
|
|
221
|
+
};
|
|
222
|
+
return AcApMeasureAngleJig;
|
|
223
|
+
}(AcEdPreviewJig));
|
|
224
|
+
/**
|
|
225
|
+
* Command that measures the angle between two arms sharing a common vertex.
|
|
226
|
+
*
|
|
227
|
+
* Prompts the user to pick three world points: the vertex, a point on the
|
|
228
|
+
* first arm, and a point on the second arm. After the second arm is confirmed,
|
|
229
|
+
* transient CAD lines are added for both arms and persistent DOM overlays
|
|
230
|
+
* (arc canvas + dots + badge) are placed via {@link AcTrHtmlTransientManager}.
|
|
231
|
+
*/
|
|
232
|
+
var AcApMeasureAngleCmd = /** @class */ (function (_super) {
|
|
233
|
+
__extends(AcApMeasureAngleCmd, _super);
|
|
234
|
+
function AcApMeasureAngleCmd() {
|
|
235
|
+
var _this = _super.call(this) || this;
|
|
236
|
+
_this.mode = AcEdOpenMode.Read;
|
|
237
|
+
return _this;
|
|
238
|
+
}
|
|
239
|
+
AcApMeasureAngleCmd.prototype.execute = function (context) {
|
|
240
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
241
|
+
var editor, color, vertexPrompt, vertex, arm1Prompt, arm1, armCanvas, redrawOnViewChange, arm2Prompt, arm2, _a, degrees, line1, line2, persistCanvas, redrawPersist, htManager, id, dx1, dy1, dx2, dy2, wLen1, wLen2, u1x, u1y, u2x, u2y, bx, by, bLen, badgeOffset, badgeWorld;
|
|
242
|
+
return __generator(this, function (_b) {
|
|
243
|
+
switch (_b.label) {
|
|
244
|
+
case 0:
|
|
245
|
+
editor = AcApDocManager.instance.editor;
|
|
246
|
+
color = measurementColor(context.doc.database);
|
|
247
|
+
vertexPrompt = new AcEdPromptPointOptions(AcApI18n.t('jig.measureAngle.vertex'));
|
|
248
|
+
return [4 /*yield*/, editor.getPoint(vertexPrompt)
|
|
249
|
+
// Pick first arm endpoint (jig provides preview line from vertex)
|
|
250
|
+
];
|
|
251
|
+
case 1:
|
|
252
|
+
vertex = _b.sent();
|
|
253
|
+
arm1Prompt = new AcEdPromptPointOptions(AcApI18n.t('jig.measureAngle.arm1'));
|
|
254
|
+
arm1Prompt.useBasePoint = true;
|
|
255
|
+
arm1Prompt.jig = new AcApMeasureArm1Jig(context.view, vertex, color);
|
|
256
|
+
return [4 /*yield*/, editor.getPoint(arm1Prompt)
|
|
257
|
+
// Construction-phase canvas for the first arm dashed line
|
|
258
|
+
];
|
|
259
|
+
case 2:
|
|
260
|
+
arm1 = _b.sent();
|
|
261
|
+
armCanvas = document.createElement('canvas');
|
|
262
|
+
armCanvas.style.cssText =
|
|
263
|
+
'position:fixed;pointer-events:none;z-index:99997;';
|
|
264
|
+
document.body.appendChild(armCanvas);
|
|
265
|
+
drawArm1OnCanvas(armCanvas, context.view, vertex, arm1, color);
|
|
266
|
+
redrawOnViewChange = function () {
|
|
267
|
+
return drawArm1OnCanvas(armCanvas, context.view, vertex, arm1, color);
|
|
268
|
+
};
|
|
269
|
+
context.view.events.viewChanged.addEventListener(redrawOnViewChange);
|
|
270
|
+
arm2Prompt = new AcEdPromptPointOptions(AcApI18n.t('jig.measureAngle.arm2'));
|
|
271
|
+
arm2Prompt.jig = new AcApMeasureAngleJig(context.view, vertex, arm1, armCanvas, color);
|
|
272
|
+
_b.label = 3;
|
|
273
|
+
case 3:
|
|
274
|
+
_b.trys.push([3, 5, , 6]);
|
|
275
|
+
return [4 /*yield*/, editor.getPoint(arm2Prompt)];
|
|
276
|
+
case 4:
|
|
277
|
+
arm2 = _b.sent();
|
|
278
|
+
return [3 /*break*/, 6];
|
|
279
|
+
case 5:
|
|
280
|
+
_a = _b.sent();
|
|
281
|
+
// User pressed ESC / cancelled — clean up construction-phase DOM
|
|
282
|
+
context.view.events.viewChanged.removeEventListener(redrawOnViewChange);
|
|
283
|
+
armCanvas.remove();
|
|
284
|
+
return [2 /*return*/];
|
|
285
|
+
case 6:
|
|
286
|
+
// Clean up construction-phase canvas
|
|
287
|
+
context.view.events.viewChanged.removeEventListener(redrawOnViewChange);
|
|
288
|
+
armCanvas.remove();
|
|
289
|
+
degrees = calcAngleDeg(vertex, arm1, arm2);
|
|
290
|
+
line1 = new AcDbLine(vertex, arm1);
|
|
291
|
+
line1.color = color;
|
|
292
|
+
line1.lineWeight = AcGiLineWeight.LineWeight070;
|
|
293
|
+
context.view.addTransientEntity(line1);
|
|
294
|
+
line2 = new AcDbLine(vertex, arm2);
|
|
295
|
+
line2.color = color;
|
|
296
|
+
line2.lineWeight = AcGiLineWeight.LineWeight070;
|
|
297
|
+
context.view.addTransientEntity(line2);
|
|
298
|
+
persistCanvas = document.createElement('canvas');
|
|
299
|
+
persistCanvas.style.cssText =
|
|
300
|
+
'position:fixed;pointer-events:none;z-index:99997;';
|
|
301
|
+
document.body.appendChild(persistCanvas);
|
|
302
|
+
drawAngleArcOnCanvas(persistCanvas, context.view, vertex, arm1, arm2, color);
|
|
303
|
+
redrawPersist = function () {
|
|
304
|
+
return drawAngleArcOnCanvas(persistCanvas, context.view, vertex, arm1, arm2, color);
|
|
305
|
+
};
|
|
306
|
+
context.view.events.viewChanged.addEventListener(redrawPersist);
|
|
307
|
+
htManager = AcApDocManager.instance.curView.htmlTransientManager;
|
|
308
|
+
id = "angle-".concat(Date.now());
|
|
309
|
+
htManager.add("".concat(id, "-dotV"), makeDot(color), vertex, 'measurement');
|
|
310
|
+
htManager.add("".concat(id, "-dot1"), makeDot(color), arm1, 'measurement');
|
|
311
|
+
htManager.add("".concat(id, "-dot2"), makeDot(color), arm2, 'measurement');
|
|
312
|
+
dx1 = arm1.x - vertex.x;
|
|
313
|
+
dy1 = arm1.y - vertex.y;
|
|
314
|
+
dx2 = arm2.x - vertex.x;
|
|
315
|
+
dy2 = arm2.y - vertex.y;
|
|
316
|
+
wLen1 = Math.hypot(dx1, dy1);
|
|
317
|
+
wLen2 = Math.hypot(dx2, dy2);
|
|
318
|
+
u1x = wLen1 > 0 ? dx1 / wLen1 : 1;
|
|
319
|
+
u1y = wLen1 > 0 ? dy1 / wLen1 : 0;
|
|
320
|
+
u2x = wLen2 > 0 ? dx2 / wLen2 : 1;
|
|
321
|
+
u2y = wLen2 > 0 ? dy2 / wLen2 : 0;
|
|
322
|
+
bx = u1x + u2x;
|
|
323
|
+
by = u1y + u2y;
|
|
324
|
+
bLen = Math.hypot(bx, by);
|
|
325
|
+
if (bLen > 0) {
|
|
326
|
+
bx /= bLen;
|
|
327
|
+
by /= bLen;
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
// Arms are exactly opposite — use perpendicular
|
|
331
|
+
bx = -u1y;
|
|
332
|
+
by = u1x;
|
|
333
|
+
}
|
|
334
|
+
badgeOffset = Math.max(Math.min(wLen1, wLen2) * 0.4, Math.max(wLen1, wLen2) * 0.15);
|
|
335
|
+
badgeWorld = {
|
|
336
|
+
x: vertex.x + bx * badgeOffset,
|
|
337
|
+
y: vertex.y + by * badgeOffset
|
|
338
|
+
};
|
|
339
|
+
htManager.add("".concat(id, "-badge"), makeBadge(color, "".concat(degrees.toFixed(2), "\u00B0")), badgeWorld, 'measurement');
|
|
340
|
+
registerMeasurementCleanup(function () {
|
|
341
|
+
context.view.removeTransientEntity(line1.objectId);
|
|
342
|
+
context.view.removeTransientEntity(line2.objectId);
|
|
343
|
+
persistCanvas.remove();
|
|
344
|
+
context.view.events.viewChanged.removeEventListener(redrawPersist);
|
|
345
|
+
htManager.remove("".concat(id, "-dotV"));
|
|
346
|
+
htManager.remove("".concat(id, "-dot1"));
|
|
347
|
+
htManager.remove("".concat(id, "-dot2"));
|
|
348
|
+
htManager.remove("".concat(id, "-badge"));
|
|
349
|
+
});
|
|
350
|
+
return [2 /*return*/];
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
return AcApMeasureAngleCmd;
|
|
356
|
+
}(AcEdCommand));
|
|
357
|
+
export { AcApMeasureAngleCmd };
|
|
358
|
+
//# sourceMappingURL=AcApMeasureAngleCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApMeasureAngleCmd.js","sourceRoot":"","sources":["../../src/command/AcApMeasureAngleCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC,CAAC,GAAG,EAAE,GAAG,WAAW;yBAC/B,CAAA;wBACD,SAAS,CAAC,GAAG,CACX,UAAG,EAAE,WAAQ,EACb,SAAS,CAAC,KAAK,EAAE,UAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,WAAQ,CAAC,EAC/C,UAAU,EACV,aAAa,CACd,CAAA;wBAED,0BAA0B,CAAC;4BACzB,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;4BAClD,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;4BAClD,aAAa,CAAC,MAAM,EAAE,CAAA;4BACtB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAA;4BAClE,SAAS,CAAC,MAAM,CAAC,UAAG,EAAE,UAAO,CAAC,CAAA;4BAC9B,SAAS,CAAC,MAAM,CAAC,UAAG,EAAE,UAAO,CAAC,CAAA;4BAC9B,SAAS,CAAC,MAAM,CAAC,UAAG,EAAE,UAAO,CAAC,CAAA;4BAC9B,SAAS,CAAC,MAAM,CAAC,UAAG,EAAE,WAAQ,CAAC,CAAA;wBACjC,CAAC,CAAC,CAAA;;;;;KACH;IACH,0BAAC;AAAD,CAAC,AAtID,CAAyC,WAAW,GAsInD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AcApContext } from '../app';
|
|
2
|
+
import { AcEdCommand } from '../editor';
|
|
3
|
+
/**
|
|
4
|
+
* Command that measures the length of an arc on an existing circle or arc entity.
|
|
5
|
+
*
|
|
6
|
+
* Uses a two-phase pick flow that mirrors AutoCAD's arc-length measurement:
|
|
7
|
+
*
|
|
8
|
+
* 1. **Phase 1 — entity snap**: The user hovers over a circle or arc in the
|
|
9
|
+
* drawing. A square snap indicator appears on the circumference and the
|
|
10
|
+
* entity geometry is captured. Clicking confirms the start point.
|
|
11
|
+
*
|
|
12
|
+
* 2. **Phase 2 — end point**: The same square indicator follows the cursor,
|
|
13
|
+
* always locked to the captured circle. A canvas overlay draws the shorter
|
|
14
|
+
* arc between the start and current position in real time, together with a
|
|
15
|
+
* live badge showing the arc length.
|
|
16
|
+
*
|
|
17
|
+
* Persistent overlays are placed via {@link AcTrHtmlTransientManager} for dots
|
|
18
|
+
* and badge. The arc canvas is managed with a viewChanged listener cleaned up
|
|
19
|
+
* via {@link registerMeasurementCleanup}.
|
|
20
|
+
*/
|
|
21
|
+
export declare class AcApMeasureArcCmd extends AcEdCommand {
|
|
22
|
+
constructor();
|
|
23
|
+
execute(context: AcApContext): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=AcApMeasureArcCmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApMeasureArcCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApMeasureArcCmd.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAkB,MAAM,QAAQ,CAAA;AACpD,OAAO,EAEL,WAAW,EAIZ,MAAM,WAAW,CAAA;AA2OlB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;;IAM1C,OAAO,CAAC,OAAO,EAAE,WAAW;CAmJnC"}
|