@mlightcad/cad-simple-viewer 1.2.4 → 1.2.5
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 +11406 -8892
- package/dist/index.umd.cjs +314 -24
- package/dist/libredwg-parser-worker.js +7267 -7238
- package/dist/mtext-renderer-worker.js +32 -9
- package/lib/app/AcApDocManager.d.ts +20 -3
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +66 -11
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApProgress.d.ts +133 -0
- package/lib/app/AcApProgress.d.ts.map +1 -0
- package/lib/app/AcApProgress.js +148 -0
- package/lib/app/AcApProgress.js.map +1 -0
- package/lib/app/AcApSettingManager.d.ts +42 -0
- package/lib/app/AcApSettingManager.d.ts.map +1 -1
- package/lib/app/AcApSettingManager.js +63 -0
- package/lib/app/AcApSettingManager.js.map +1 -1
- package/lib/app/index.d.ts +0 -1
- package/lib/app/index.d.ts.map +1 -1
- package/lib/app/index.js +0 -1
- package/lib/app/index.js.map +1 -1
- package/lib/command/AcApCircleCmd.d.ts +21 -0
- package/lib/command/AcApCircleCmd.d.ts.map +1 -0
- package/lib/command/AcApCircleCmd.js +115 -0
- package/lib/command/AcApCircleCmd.js.map +1 -0
- package/lib/command/AcApDimCmd.d.ts +57 -0
- package/lib/command/AcApDimCmd.d.ts.map +1 -0
- package/lib/command/AcApDimCmd.js +228 -0
- package/lib/command/AcApDimCmd.js.map +1 -0
- package/lib/command/AcApLogCmd.d.ts +13 -0
- package/lib/command/AcApLogCmd.d.ts.map +1 -0
- package/lib/command/AcApLogCmd.js +97 -0
- package/lib/command/AcApLogCmd.js.map +1 -0
- package/lib/command/AcApSysVarCmd.d.ts +15 -0
- package/lib/command/AcApSysVarCmd.d.ts.map +1 -0
- package/lib/command/AcApSysVarCmd.js +94 -0
- package/lib/command/AcApSysVarCmd.js.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts +0 -36
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.js +4 -61
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
- package/lib/command/index.d.ts +4 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +4 -0
- package/lib/command/index.js.map +1 -1
- package/lib/editor/command/AcEdCommandStack.d.ts +19 -1
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommandStack.js +40 -0
- package/lib/editor/command/AcEdCommandStack.js.map +1 -1
- package/lib/editor/input/AcEdCursorManager.d.ts +14 -30
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
- package/lib/editor/input/AcEdCursorManager.js +32 -31
- package/lib/editor/input/AcEdCursorManager.js.map +1 -1
- package/lib/editor/input/AcEdPreviewJig.d.ts +103 -0
- package/lib/editor/input/AcEdPreviewJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdPreviewJig.js +82 -0
- package/lib/editor/input/AcEdPreviewJig.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +58 -11
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +86 -22
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/input/handler/AcEdAngleHandler.d.ts +12 -0
- package/lib/editor/input/handler/AcEdAngleHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdAngleHandler.js +25 -0
- package/lib/editor/input/handler/AcEdAngleHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdDistanceHandler.d.ts +8 -0
- package/lib/editor/input/handler/AcEdDistanceHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdDistanceHandler.js +29 -0
- package/lib/editor/input/handler/AcEdDistanceHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdDoubleHandler.d.ts +7 -0
- package/lib/editor/input/handler/AcEdDoubleHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdDoubleHandler.js +28 -0
- package/lib/editor/input/handler/AcEdDoubleHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdInputHandler.d.ts +14 -0
- package/lib/editor/input/handler/AcEdInputHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdInputHandler.js +2 -0
- package/lib/editor/input/handler/AcEdInputHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdIntegerHandler.d.ts +11 -0
- package/lib/editor/input/handler/AcEdIntegerHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdIntegerHandler.js +44 -0
- package/lib/editor/input/handler/AcEdIntegerHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdNumericalHandler.d.ts +11 -0
- package/lib/editor/input/handler/AcEdNumericalHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdNumericalHandler.js +24 -0
- package/lib/editor/input/handler/AcEdNumericalHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdPointHandler.d.ts +16 -0
- package/lib/editor/input/handler/AcEdPointHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdPointHandler.js +19 -0
- package/lib/editor/input/handler/AcEdPointHandler.js.map +1 -0
- package/lib/editor/input/handler/AcEdStringHandler.d.ts +12 -0
- package/lib/editor/input/handler/AcEdStringHandler.d.ts.map +1 -0
- package/lib/editor/input/handler/AcEdStringHandler.js +24 -0
- package/lib/editor/input/handler/AcEdStringHandler.js.map +1 -0
- package/lib/editor/input/handler/index.d.ts +9 -0
- package/lib/editor/input/handler/index.d.ts.map +1 -0
- package/lib/editor/input/handler/index.js +9 -0
- package/lib/editor/input/handler/index.js.map +1 -0
- package/lib/editor/input/index.d.ts +4 -1
- package/lib/editor/input/index.d.ts.map +1 -1
- package/lib/editor/input/index.js +4 -1
- package/lib/editor/input/index.js.map +1 -1
- package/lib/editor/input/marker/AcEdMarker.d.ts +72 -0
- package/lib/editor/input/marker/AcEdMarker.d.ts.map +1 -0
- package/lib/editor/input/marker/AcEdMarker.js +124 -0
- package/lib/editor/input/marker/AcEdMarker.js.map +1 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts +52 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.d.ts.map +1 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.js +91 -0
- package/lib/editor/input/marker/AcEdOSnapMarkerManager.js.map +1 -0
- package/lib/editor/input/marker/index.d.ts +3 -0
- package/lib/editor/input/marker/index.d.ts.map +1 -0
- package/lib/editor/input/marker/index.js +3 -0
- package/lib/editor/input/marker/index.js.map +1 -0
- package/lib/editor/input/prompt/AcEdKeyword.d.ts +63 -0
- package/lib/editor/input/prompt/AcEdKeyword.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdKeyword.js +120 -0
- package/lib/editor/input/prompt/AcEdKeyword.js.map +1 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts +52 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.js +103 -0
- package/lib/editor/input/prompt/AcEdKeywordCollection.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +75 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +182 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.d.ts +46 -0
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js +114 -0
- package/lib/editor/input/prompt/AcEdPromptDistanceOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleOptions.d.ts +10 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleOptions.js +31 -0
- package/lib/editor/input/prompt/AcEdPromptDoubleOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerOptions.d.ts +39 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerOptions.js +84 -0
- package/lib/editor/input/prompt/AcEdPromptIntegerOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts +59 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js +140 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalResult.d.ts +19 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalResult.js +36 -0
- package/lib/editor/input/prompt/AcEdPromptNumericalResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptOptions.d.ts +61 -0
- package/lib/editor/input/prompt/AcEdPromptOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptOptions.js +179 -0
- package/lib/editor/input/prompt/AcEdPromptOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts +46 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.js +113 -0
- package/lib/editor/input/prompt/AcEdPromptPointOptions.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts +25 -0
- package/lib/editor/input/prompt/AcEdPromptPointResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptPointResult.js +38 -0
- package/lib/editor/input/prompt/AcEdPromptPointResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptResult.d.ts +27 -0
- package/lib/editor/input/prompt/AcEdPromptResult.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptResult.js +19 -0
- package/lib/editor/input/prompt/AcEdPromptResult.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptStatus.d.ts +22 -0
- package/lib/editor/input/prompt/AcEdPromptStatus.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptStatus.js +23 -0
- package/lib/editor/input/prompt/AcEdPromptStatus.js.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts +54 -0
- package/lib/editor/input/prompt/AcEdPromptStringOptions.d.ts.map +1 -0
- package/lib/editor/input/prompt/AcEdPromptStringOptions.js +124 -0
- package/lib/editor/input/prompt/AcEdPromptStringOptions.js.map +1 -0
- package/lib/editor/input/prompt/index.d.ts +11 -0
- package/lib/editor/input/prompt/index.d.ts.map +1 -0
- package/lib/editor/input/prompt/index.js +11 -0
- package/lib/editor/input/prompt/index.js.map +1 -0
- package/lib/editor/input/ui/AcEdCommandLine.d.ts +114 -0
- package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdCommandLine.js +453 -0
- package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts +151 -0
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInput.js +239 -0
- package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts +60 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.js +113 -0
- package/lib/editor/input/ui/AcEdFloatingInputBox.js.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts +104 -0
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +154 -0
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts +113 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.js +2 -0
- package/lib/editor/input/ui/AcEdFloatingInputTypes.js.map +1 -0
- package/lib/editor/input/ui/AcEdInputManager.d.ts +132 -0
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdInputManager.js +477 -0
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -0
- package/lib/editor/input/ui/AcEdRubberBand.d.ts +66 -0
- package/lib/editor/input/ui/AcEdRubberBand.d.ts.map +1 -0
- package/lib/editor/input/ui/AcEdRubberBand.js +276 -0
- package/lib/editor/input/ui/AcEdRubberBand.js.map +1 -0
- package/lib/editor/input/ui/index.d.ts +3 -0
- package/lib/editor/input/ui/index.d.ts.map +1 -0
- package/lib/editor/input/ui/index.js +3 -0
- package/lib/editor/input/ui/index.js.map +1 -0
- package/lib/editor/view/AcEdBaseView.d.ts +35 -11
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +14 -11
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/i18n/AcApI18n.d.ts +135 -0
- package/lib/i18n/AcApI18n.d.ts.map +1 -0
- package/lib/i18n/AcApI18n.js +208 -0
- package/lib/i18n/AcApI18n.js.map +1 -0
- package/lib/i18n/en/command.d.ts +18 -0
- package/lib/i18n/en/command.d.ts.map +1 -0
- package/lib/i18n/en/command.js +17 -0
- package/lib/i18n/en/command.js.map +1 -0
- package/lib/i18n/en/jig.d.ts +11 -0
- package/lib/i18n/en/jig.d.ts.map +1 -0
- package/lib/i18n/en/jig.js +10 -0
- package/lib/i18n/en/jig.js.map +1 -0
- package/lib/i18n/en/main.d.ts +37 -0
- package/lib/i18n/en/main.d.ts.map +1 -0
- package/lib/i18n/en/main.js +36 -0
- package/lib/i18n/en/main.js.map +1 -0
- package/lib/i18n/index.d.ts +6 -0
- package/lib/i18n/index.d.ts.map +1 -0
- package/lib/i18n/index.js +31 -0
- package/lib/i18n/index.js.map +1 -0
- package/lib/i18n/zh/command.d.ts +18 -0
- package/lib/i18n/zh/command.d.ts.map +1 -0
- package/lib/i18n/zh/command.js +17 -0
- package/lib/i18n/zh/command.js.map +1 -0
- package/lib/i18n/zh/jig.d.ts +11 -0
- package/lib/i18n/zh/jig.d.ts.map +1 -0
- package/lib/i18n/zh/jig.js +10 -0
- package/lib/i18n/zh/jig.js.map +1 -0
- package/lib/i18n/zh/main.d.ts +37 -0
- package/lib/i18n/zh/main.d.ts.map +1 -0
- package/lib/i18n/zh/main.js +36 -0
- package/lib/i18n/zh/main.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +19 -6
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +25 -6
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +11 -1
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +73 -35
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +7 -7
- package/lib/editor/input/AcEdBaseInput.d.ts +0 -89
- package/lib/editor/input/AcEdBaseInput.d.ts.map +0 -1
- package/lib/editor/input/AcEdBaseInput.js +0 -166
- package/lib/editor/input/AcEdBaseInput.js.map +0 -1
- package/lib/editor/input/AcEdBoxSelector.d.ts +0 -108
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +0 -1
- package/lib/editor/input/AcEdBoxSelector.js +0 -220
- package/lib/editor/input/AcEdBoxSelector.js.map +0 -1
- package/lib/editor/input/AcEdInputPoint.d.ts +0 -51
- package/lib/editor/input/AcEdInputPoint.d.ts.map +0 -1
- package/lib/editor/input/AcEdInputPoint.js +0 -78
- package/lib/editor/input/AcEdInputPoint.js.map +0 -1
- package/lib/editor/input/AcEdJig.d.ts +0 -180
- package/lib/editor/input/AcEdJig.d.ts.map +0 -1
- package/lib/editor/input/AcEdJig.js +0 -256
- package/lib/editor/input/AcEdJig.js.map +0 -1
- package/lib/editor/input/AcEdJigLoop.d.ts +0 -63
- package/lib/editor/input/AcEdJigLoop.d.ts.map +0 -1
- package/lib/editor/input/AcEdJigLoop.js +0 -91
- package/lib/editor/input/AcEdJigLoop.js.map +0 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { AcGePoint3d } from '@mlightcad/data-model';
|
|
2
|
+
/**
|
|
3
|
+
* AcEdRubberBand provides a temporary CAD-style rubber-band preview.
|
|
4
|
+
*
|
|
5
|
+
* It can draws a CAD-like reference rectangle:
|
|
6
|
+
* 1. baseLine: solid line from the last point to the cursor.
|
|
7
|
+
* 2. perpLineAtBase: dashed perpendicular line at the base point.
|
|
8
|
+
* 3. perpLineAtCursor: dashed perpendicular line at the cursor.
|
|
9
|
+
* 4. connectorLine: dashed line connecting the ends of the two perpendicular lines.
|
|
10
|
+
* 5. distance label displayed near connectorLine
|
|
11
|
+
*
|
|
12
|
+
* And draw one arc:
|
|
13
|
+
* 1. xAxisLine: horizontal reference line starting at base point
|
|
14
|
+
* 2. angleArc: arc showing angle between baseLine and x-axis (radius = baseLine length)
|
|
15
|
+
* 3. angle label shown at midpoint of the arc
|
|
16
|
+
*/
|
|
17
|
+
var AcEdRubberBand = /** @class */ (function () {
|
|
18
|
+
function AcEdRubberBand(view) {
|
|
19
|
+
this.container = null;
|
|
20
|
+
// main geometry
|
|
21
|
+
this.baseLine = null;
|
|
22
|
+
this.perpLineAtBase = null;
|
|
23
|
+
this.perpLineAtCursor = null;
|
|
24
|
+
this.connectorLine = null;
|
|
25
|
+
// labels
|
|
26
|
+
this.labelEl = null;
|
|
27
|
+
this.angleLabelEl = null;
|
|
28
|
+
// angle visuals (SVG)
|
|
29
|
+
this.xAxisLine = null;
|
|
30
|
+
this.angleSvg = null;
|
|
31
|
+
this.anglePath = null;
|
|
32
|
+
this.options = {};
|
|
33
|
+
this.view = view;
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(AcEdRubberBand.prototype, "element", {
|
|
36
|
+
/** Returns the parent container element that holds all rubber-band HTML elements. */
|
|
37
|
+
get: function () {
|
|
38
|
+
return this.container;
|
|
39
|
+
},
|
|
40
|
+
enumerable: false,
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Starts the rubber-band preview.
|
|
45
|
+
* @param basePoint The starting point in world coordinates.
|
|
46
|
+
*/
|
|
47
|
+
AcEdRubberBand.prototype.start = function (basePoint, options) {
|
|
48
|
+
var _this = this;
|
|
49
|
+
this.basePoint = new AcGePoint3d(basePoint);
|
|
50
|
+
this.options = options || {};
|
|
51
|
+
var color = this.options.color || '#0f0';
|
|
52
|
+
// --------------------------------------------------------------------
|
|
53
|
+
// Create parent container
|
|
54
|
+
// --------------------------------------------------------------------
|
|
55
|
+
this.container = document.createElement('div');
|
|
56
|
+
this.container.style.position = 'fixed';
|
|
57
|
+
this.container.style.left = '0';
|
|
58
|
+
this.container.style.top = '0';
|
|
59
|
+
this.container.style.pointerEvents = 'none';
|
|
60
|
+
this.container.style.zIndex = '99999';
|
|
61
|
+
document.body.appendChild(this.container);
|
|
62
|
+
// --------------------------------------------------------------------
|
|
63
|
+
// Always create baseLine
|
|
64
|
+
// --------------------------------------------------------------------
|
|
65
|
+
this.baseLine = document.createElement('div');
|
|
66
|
+
this.baseLine.style.position = 'fixed';
|
|
67
|
+
this.baseLine.style.borderTop = "1px solid ".concat(color);
|
|
68
|
+
this.container.appendChild(this.baseLine);
|
|
69
|
+
var createDashed = function () {
|
|
70
|
+
var el = document.createElement('div');
|
|
71
|
+
el.style.position = 'fixed';
|
|
72
|
+
el.style.borderTop = "1px dashed ".concat(color);
|
|
73
|
+
_this.container.appendChild(el);
|
|
74
|
+
return el;
|
|
75
|
+
};
|
|
76
|
+
if (!this.options.showBaseLineOnly) {
|
|
77
|
+
// perpendiculars + connector
|
|
78
|
+
this.perpLineAtBase = createDashed();
|
|
79
|
+
this.perpLineAtCursor = createDashed();
|
|
80
|
+
this.connectorLine = createDashed();
|
|
81
|
+
// distance label
|
|
82
|
+
this.labelEl = document.createElement('div');
|
|
83
|
+
this.labelEl.style.position = 'fixed';
|
|
84
|
+
// this.labelEl.style.background = 'rgba(0,0,0,0.6)'
|
|
85
|
+
this.labelEl.style.color = color;
|
|
86
|
+
this.labelEl.style.fontSize = '12px';
|
|
87
|
+
this.labelEl.style.padding = '2px 4px';
|
|
88
|
+
this.labelEl.style.borderRadius = '4px';
|
|
89
|
+
this.container.appendChild(this.labelEl);
|
|
90
|
+
// X-axis reference line
|
|
91
|
+
this.xAxisLine = document.createElement('div');
|
|
92
|
+
this.xAxisLine.style.position = 'fixed';
|
|
93
|
+
this.xAxisLine.style.borderTop = "1px solid ".concat(color);
|
|
94
|
+
this.container.appendChild(this.xAxisLine);
|
|
95
|
+
// SVG for angle arc
|
|
96
|
+
// We'll create an SVG sized dynamically on each update (width = height = 2*radius)
|
|
97
|
+
this.angleSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
98
|
+
// Let the SVG be absolutely positioned; we set left/top/width/height in update()
|
|
99
|
+
this.angleSvg.setAttribute('style', 'position:absolute; overflow:visible; pointer-events:none;');
|
|
100
|
+
// Path element for the arc
|
|
101
|
+
this.anglePath = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
102
|
+
this.anglePath.setAttribute('fill', 'none');
|
|
103
|
+
this.anglePath.setAttribute('stroke', color);
|
|
104
|
+
this.anglePath.setAttribute('stroke-width', '1');
|
|
105
|
+
this.anglePath.setAttribute('stroke-dasharray', '4 4');
|
|
106
|
+
this.angleSvg.appendChild(this.anglePath);
|
|
107
|
+
this.container.appendChild(this.angleSvg);
|
|
108
|
+
// Angle label (HTML) positioned in screen coords at arc midpoint
|
|
109
|
+
this.angleLabelEl = document.createElement('div');
|
|
110
|
+
this.angleLabelEl.style.position = 'fixed';
|
|
111
|
+
// this.angleLabelEl.style.background = 'rgba(0,0,0,0.6)'
|
|
112
|
+
this.angleLabelEl.style.color = color;
|
|
113
|
+
this.angleLabelEl.style.fontSize = '12px';
|
|
114
|
+
this.angleLabelEl.style.padding = '2px 4px';
|
|
115
|
+
this.angleLabelEl.style.borderRadius = '4px';
|
|
116
|
+
this.container.appendChild(this.angleLabelEl);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Updates the rubber-band lines to a new target point.
|
|
121
|
+
* @param targetPoint The current cursor position in world coordinates.
|
|
122
|
+
*/
|
|
123
|
+
AcEdRubberBand.prototype.update = function (targetPoint) {
|
|
124
|
+
var _a;
|
|
125
|
+
if (!this.container || !this.basePoint || !this.baseLine)
|
|
126
|
+
return;
|
|
127
|
+
var rect = this.view.canvas.getBoundingClientRect();
|
|
128
|
+
var p0 = this.view.wcs2Cwcs(this.basePoint);
|
|
129
|
+
var p3 = this.view.wcs2Cwcs(targetPoint);
|
|
130
|
+
var offsetX = rect.left;
|
|
131
|
+
var offsetY = rect.top;
|
|
132
|
+
var drawLine = function (line, start, end) {
|
|
133
|
+
var dx = end.x - start.x;
|
|
134
|
+
var dy = end.y - start.y;
|
|
135
|
+
var length = Math.sqrt(dx * dx + dy * dy);
|
|
136
|
+
var angle = Math.atan2(dy, dx) * (180 / Math.PI);
|
|
137
|
+
line.style.width = "".concat(length, "px");
|
|
138
|
+
line.style.transformOrigin = '0 0';
|
|
139
|
+
line.style.transform = "translate(".concat(start.x + offsetX, "px, ").concat(start.y + offsetY, "px) rotate(").concat(angle, "deg)");
|
|
140
|
+
};
|
|
141
|
+
// --------------------------------------------------------------------
|
|
142
|
+
// Always update baseLine
|
|
143
|
+
// --------------------------------------------------------------------
|
|
144
|
+
drawLine(this.baseLine, p0, p3);
|
|
145
|
+
if (this.options.showBaseLineOnly)
|
|
146
|
+
return;
|
|
147
|
+
// --------------------------------------------------------------------
|
|
148
|
+
// Update remaining rectangle geometry
|
|
149
|
+
// --------------------------------------------------------------------
|
|
150
|
+
if (!this.perpLineAtBase || !this.perpLineAtCursor || !this.connectorLine)
|
|
151
|
+
return;
|
|
152
|
+
var dx = p3.x - p0.x;
|
|
153
|
+
var dy = p3.y - p0.y;
|
|
154
|
+
var lengthBase = Math.sqrt(dx * dx + dy * dy);
|
|
155
|
+
// protect against zero-length base line
|
|
156
|
+
if (lengthBase === 0) {
|
|
157
|
+
// hide or collapse other visuals
|
|
158
|
+
if (this.perpLineAtBase)
|
|
159
|
+
this.perpLineAtBase.style.width = '0px';
|
|
160
|
+
if (this.perpLineAtCursor)
|
|
161
|
+
this.perpLineAtCursor.style.width = '0px';
|
|
162
|
+
if (this.connectorLine)
|
|
163
|
+
this.connectorLine.style.width = '0px';
|
|
164
|
+
if (this.xAxisLine)
|
|
165
|
+
this.xAxisLine.style.width = '0px';
|
|
166
|
+
if (this.anglePath)
|
|
167
|
+
this.anglePath.setAttribute('d', '');
|
|
168
|
+
if (this.angleLabelEl)
|
|
169
|
+
this.angleLabelEl.style.display = 'none';
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
var perpLen = (_a = this.options.perpendicularLength) !== null && _a !== void 0 ? _a : 50;
|
|
173
|
+
// perpendicular unit
|
|
174
|
+
var ux = -dy / lengthBase;
|
|
175
|
+
var uy = dx / lengthBase;
|
|
176
|
+
// perpendicular endpoints
|
|
177
|
+
var pBasePerp = { x: p0.x + ux * perpLen, y: p0.y + uy * perpLen };
|
|
178
|
+
var pCursorPerp = { x: p3.x + ux * perpLen, y: p3.y + uy * perpLen };
|
|
179
|
+
drawLine(this.perpLineAtBase, p0, pBasePerp);
|
|
180
|
+
drawLine(this.perpLineAtCursor, p3, pCursorPerp);
|
|
181
|
+
drawLine(this.connectorLine, pBasePerp, pCursorPerp);
|
|
182
|
+
// --------------------------------------------------------------------
|
|
183
|
+
// Distance label
|
|
184
|
+
// --------------------------------------------------------------------
|
|
185
|
+
if (this.labelEl) {
|
|
186
|
+
var midX = (pBasePerp.x + pCursorPerp.x) / 2 + offsetX;
|
|
187
|
+
var midY = (pBasePerp.y + pCursorPerp.y) / 2 + offsetY - 24;
|
|
188
|
+
var dist = Math.sqrt(Math.pow((targetPoint.x - this.basePoint.x), 2) +
|
|
189
|
+
Math.pow((targetPoint.y - this.basePoint.y), 2));
|
|
190
|
+
this.labelEl.textContent = dist.toFixed(3);
|
|
191
|
+
this.labelEl.style.left = "".concat(midX - 20, "px");
|
|
192
|
+
this.labelEl.style.top = "".concat(midY, "px");
|
|
193
|
+
this.labelEl.style.display = '';
|
|
194
|
+
}
|
|
195
|
+
// --------------------------------------------------------------------
|
|
196
|
+
// Horizontal X-axis line (same length as base line)
|
|
197
|
+
// --------------------------------------------------------------------
|
|
198
|
+
if (this.xAxisLine) {
|
|
199
|
+
var pX = { x: p0.x + lengthBase, y: p0.y };
|
|
200
|
+
drawLine(this.xAxisLine, p0, pX);
|
|
201
|
+
}
|
|
202
|
+
// --------------------------------------------------------------------
|
|
203
|
+
// Angle arc (radius = length of base line)
|
|
204
|
+
// Arc from end of x-axis (p0 + radius * +X) to end of baseLine (p3).
|
|
205
|
+
// --------------------------------------------------------------------
|
|
206
|
+
if (this.angleSvg && this.anglePath && this.angleLabelEl) {
|
|
207
|
+
var radius = lengthBase;
|
|
208
|
+
// center (screen) of the arc
|
|
209
|
+
var centerScreenX = p0.x + offsetX;
|
|
210
|
+
var centerScreenY = p0.y + offsetY;
|
|
211
|
+
// We need coordinates relative to the SVG's top-left.
|
|
212
|
+
// We'll make the SVG have width = height = 2*radius and be positioned
|
|
213
|
+
// at (center - radius). Then coordinates inside SVG are:
|
|
214
|
+
// start = (2r, r), end = (r + r*cos(theta), r + r*sin(theta))
|
|
215
|
+
// angle between +X and baseLine in screen coordinate system
|
|
216
|
+
var angleRad = Math.atan2(p3.y - p0.y, p3.x - p0.x);
|
|
217
|
+
var angleDeg = (angleRad * 180) / Math.PI;
|
|
218
|
+
// mid-angle for placing label (middle of arc)
|
|
219
|
+
var midAngle = angleRad / 2;
|
|
220
|
+
// SVG position and sizing
|
|
221
|
+
var svgLeft = centerScreenX - radius;
|
|
222
|
+
var svgTop = centerScreenY - radius;
|
|
223
|
+
var svgSize = radius * 2;
|
|
224
|
+
// set SVG attributes and position
|
|
225
|
+
this.angleSvg.style.left = "".concat(svgLeft, "px");
|
|
226
|
+
this.angleSvg.style.top = "".concat(svgTop, "px");
|
|
227
|
+
this.angleSvg.setAttribute('width', "".concat(svgSize));
|
|
228
|
+
this.angleSvg.setAttribute('height', "".concat(svgSize));
|
|
229
|
+
this.angleSvg.setAttribute('viewBox', "0 0 ".concat(svgSize, " ").concat(svgSize));
|
|
230
|
+
// compute start and end in SVG local coords (origin top-left)
|
|
231
|
+
var cx = radius;
|
|
232
|
+
var cy = radius;
|
|
233
|
+
var sx = cx + radius; // = 2*radius
|
|
234
|
+
var sy = cy;
|
|
235
|
+
var ex = cx + radius * Math.cos(angleRad);
|
|
236
|
+
var ey = cy + radius * Math.sin(angleRad);
|
|
237
|
+
// large-arc-flag: whether to take the long way around
|
|
238
|
+
var largeArcFlag = Math.abs(angleRad) > Math.PI ? '1' : '0';
|
|
239
|
+
// sweep-flag: for screen coords (y downwards), positive angle => sweep=1
|
|
240
|
+
var sweepFlag = angleRad >= 0 ? '1' : '0';
|
|
241
|
+
// build path: Move to start, arc to end
|
|
242
|
+
var d = "M ".concat(sx, " ").concat(sy, " A ").concat(radius, " ").concat(radius, " 0 ").concat(largeArcFlag, " ").concat(sweepFlag, " ").concat(ex, " ").concat(ey);
|
|
243
|
+
this.anglePath.setAttribute('d', d);
|
|
244
|
+
// angle label (absolute degrees)
|
|
245
|
+
var angleValueDeg = Math.abs(angleDeg);
|
|
246
|
+
var angleText = "".concat(angleValueDeg.toFixed(1), "\u00B0");
|
|
247
|
+
// midpoint of arc in screen coords
|
|
248
|
+
var midScreenX = centerScreenX + radius * Math.cos(midAngle);
|
|
249
|
+
var midScreenY = centerScreenY + radius * Math.sin(midAngle);
|
|
250
|
+
this.angleLabelEl.textContent = angleText;
|
|
251
|
+
// center the label roughly
|
|
252
|
+
var labelRectApproxWidth = 40; // rough centering; exact can be done by measuring
|
|
253
|
+
this.angleLabelEl.style.left = "".concat(midScreenX - labelRectApproxWidth / 2, "px");
|
|
254
|
+
this.angleLabelEl.style.top = "".concat(midScreenY - 12, "px");
|
|
255
|
+
this.angleLabelEl.style.display = '';
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
/** Disposes all HTML elements associated with this rubber-band. */
|
|
259
|
+
AcEdRubberBand.prototype.dispose = function () {
|
|
260
|
+
if (this.container)
|
|
261
|
+
this.container.remove();
|
|
262
|
+
this.container = null;
|
|
263
|
+
this.baseLine = null;
|
|
264
|
+
this.perpLineAtBase = null;
|
|
265
|
+
this.perpLineAtCursor = null;
|
|
266
|
+
this.connectorLine = null;
|
|
267
|
+
this.labelEl = null;
|
|
268
|
+
this.angleLabelEl = null;
|
|
269
|
+
this.xAxisLine = null;
|
|
270
|
+
this.angleSvg = null;
|
|
271
|
+
this.anglePath = null;
|
|
272
|
+
};
|
|
273
|
+
return AcEdRubberBand;
|
|
274
|
+
}());
|
|
275
|
+
export { AcEdRubberBand };
|
|
276
|
+
//# sourceMappingURL=AcEdRubberBand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdRubberBand.js","sourceRoot":"","sources":["../../../../src/editor/input/ui/AcEdRubberBand.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAEZ,MAAM,uBAAuB,CAAA;AAyB9B;;;;;;;;;;;;;;GAcG;AACH;IA4BE,wBAAY,IAAkB;QAxBtB,cAAS,GAA0B,IAAI,CAAA;QAE/C,gBAAgB;QACR,aAAQ,GAA0B,IAAI,CAAA;QACtC,mBAAc,GAA0B,IAAI,CAAA;QAC5C,qBAAgB,GAA0B,IAAI,CAAA;QAC9C,kBAAa,GAA0B,IAAI,CAAA;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
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/editor/input/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA"}
|
|
@@ -153,8 +153,8 @@ export declare abstract class AcEdBaseView {
|
|
|
153
153
|
private _bbox;
|
|
154
154
|
/** Current mouse position in world coordinates */
|
|
155
155
|
private _curPos;
|
|
156
|
-
/** Current mouse position in
|
|
157
|
-
private
|
|
156
|
+
/** Current mouse position in client window coordinates */
|
|
157
|
+
private _curMousePos;
|
|
158
158
|
/** Set of currently selected entities */
|
|
159
159
|
private _selectionSet;
|
|
160
160
|
/** Input manager for handling user interactions */
|
|
@@ -334,13 +334,27 @@ export declare abstract class AcEdBaseView {
|
|
|
334
334
|
*/
|
|
335
335
|
abstract search(box: AcGeBox2d | AcGeBox3d): AcEdSpatialQueryResultItem[];
|
|
336
336
|
/**
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
337
|
+
* Picks entities that intersect a hit-region centered at the specified point
|
|
338
|
+
* in world coordinates.
|
|
339
|
+
*
|
|
340
|
+
* The hit-region is defined as a square (or bounding box) centered at the
|
|
341
|
+
* input point, whose half-size is determined by the `hitRadius` parameter.
|
|
342
|
+
* Only entities whose geometry intersects this region are returned.
|
|
343
|
+
*
|
|
344
|
+
* @param point The center point of the hit-region in world coordinates.
|
|
345
|
+
* If omitted, the current cursor position is used.
|
|
346
|
+
*
|
|
347
|
+
* @param hitRadius The half-width (in pixel size) of the hit-region around
|
|
348
|
+
* the point. It will be converted on one value in the world
|
|
349
|
+
* coordinate 'wcsHitRadius' and creates a square bounding box:
|
|
350
|
+
* [point.x ± wcsHitRadius, point.y ± wcsHitRadius].
|
|
351
|
+
* A larger value increases the pick sensitivity. If omitted, a reasonable
|
|
352
|
+
* default is used.
|
|
353
|
+
*
|
|
354
|
+
* @returns An array of object IDs representing the entities that intersect
|
|
355
|
+
* the hit-region.
|
|
342
356
|
*/
|
|
343
|
-
abstract pick(point?: AcGePoint2dLike): AcDbObjectId[];
|
|
357
|
+
abstract pick(point?: AcGePoint2dLike, hitRadius?: number): AcDbObjectId[];
|
|
344
358
|
/**
|
|
345
359
|
* Select entities intersected with the specified bounding box in the world
|
|
346
360
|
* coordinate system, add them to the current selection set, and highlight
|
|
@@ -368,10 +382,20 @@ export declare abstract class AcEdBaseView {
|
|
|
368
382
|
* @param layer Input the layer to update
|
|
369
383
|
*/
|
|
370
384
|
abstract updateLayer(layer: AcDbLayerTableRecord): void;
|
|
385
|
+
/**
|
|
386
|
+
* Add the specified transient entity or entities in the current scene.
|
|
387
|
+
* @param entity Input one or multiple transient entities
|
|
388
|
+
*/
|
|
389
|
+
abstract addTransientEntity(entity: AcDbEntity | AcDbEntity[]): void;
|
|
390
|
+
/**
|
|
391
|
+
* Remove the specified transient entity or entities in the current scene.
|
|
392
|
+
* @param entity Input the object id of one transient entity
|
|
393
|
+
*/
|
|
394
|
+
abstract removeTransientEntity(objectId: AcDbObjectId): void;
|
|
371
395
|
/**
|
|
372
396
|
* Add the specified entity or entities in drawing database into the current scene
|
|
373
397
|
* and draw it or them
|
|
374
|
-
* @param entity Input
|
|
398
|
+
* @param entity Input one or multiple entities to add into the current scene
|
|
375
399
|
*/
|
|
376
400
|
abstract addEntity(entity: AcDbEntity | AcDbEntity[]): void;
|
|
377
401
|
/**
|
|
@@ -434,9 +458,9 @@ export declare abstract class AcEdBaseView {
|
|
|
434
458
|
*/
|
|
435
459
|
get curPos(): AcGePoint2d;
|
|
436
460
|
/**
|
|
437
|
-
* Postion of current mouse in
|
|
461
|
+
* Postion of current mouse in client window
|
|
438
462
|
*/
|
|
439
|
-
get
|
|
463
|
+
get curMousePos(): AcGePoint2d;
|
|
440
464
|
/**
|
|
441
465
|
* The selection set in current view.
|
|
442
466
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBaseView.d.ts","sourceRoot":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C,EAAE,EAAE,YAAY,GAAG,IAAI;IAElD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI;IAEpD;;;OAGG;IACH,SAAS,CAAC,UAAU,EAAE,cAAc;IAIpC;;;OAGG;IACH,wBAAwB,CAAC,KAAK,EAAE,yBAAyB;IAIzD;;OAEG;IACH,IAAI,KAAK,IAGQ,MAAM,CADtB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED;;OAEG;IACH,IAAI,MAAM,IAGQ,MAAM,CADvB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAEvB;IAED;;OAEG;IACH,IAAI,IAAI,cAEP;IAED;;OAEG;IACH,IAAI,MAAM,sBAET;IAED,IAAI,MAAM,WAET;IAED;;OAEG;IACH,IAAI,MAAM,gBAET;IAED;;OAEG;IACH,IAAI,WAAW,gBAEd;IAED;;OAEG;IACH,IAAI,YAAY,qBAEf;IAED,SAAS,CAAC,cAAc;IAexB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,eAAe;CASxB"}
|
|
@@ -104,7 +104,7 @@ var AcEdBaseView = /** @class */ (function () {
|
|
|
104
104
|
this._width = rect.width;
|
|
105
105
|
this._height = rect.height;
|
|
106
106
|
this._curPos = new AcGePoint2d();
|
|
107
|
-
this.
|
|
107
|
+
this._curMousePos = new AcGePoint2d();
|
|
108
108
|
this._selectionSet = new AcEdSelectionSet();
|
|
109
109
|
this._editor = new AcEditor(this);
|
|
110
110
|
this._canvas.addEventListener('mousemove', function (event) { return _this.onMouseMove(event); });
|
|
@@ -242,12 +242,12 @@ var AcEdBaseView = /** @class */ (function () {
|
|
|
242
242
|
enumerable: false,
|
|
243
243
|
configurable: true
|
|
244
244
|
});
|
|
245
|
-
Object.defineProperty(AcEdBaseView.prototype, "
|
|
245
|
+
Object.defineProperty(AcEdBaseView.prototype, "curMousePos", {
|
|
246
246
|
/**
|
|
247
|
-
* Postion of current mouse in
|
|
247
|
+
* Postion of current mouse in client window
|
|
248
248
|
*/
|
|
249
249
|
get: function () {
|
|
250
|
-
return this.
|
|
250
|
+
return this._curMousePos;
|
|
251
251
|
},
|
|
252
252
|
enumerable: false,
|
|
253
253
|
configurable: true
|
|
@@ -282,21 +282,24 @@ var AcEdBaseView = /** @class */ (function () {
|
|
|
282
282
|
* @param event Input mouse event argument
|
|
283
283
|
*/
|
|
284
284
|
AcEdBaseView.prototype.onMouseMove = function (event) {
|
|
285
|
-
this.
|
|
286
|
-
var wcsPos = this.cwcs2Wcs(this.
|
|
285
|
+
this._curMousePos = new AcGePoint2d(event.clientX, event.clientY);
|
|
286
|
+
var wcsPos = this.cwcs2Wcs(this._curMousePos);
|
|
287
287
|
this._curPos.copy(wcsPos);
|
|
288
288
|
this.events.mouseMove.dispatch({ x: wcsPos.x, y: wcsPos.y });
|
|
289
289
|
// Hover handler
|
|
290
290
|
if (this.mode == AcEdViewMode.SELECTION) {
|
|
291
|
-
|
|
291
|
+
// If it is in “input acquisition” mode, disable hover behavior
|
|
292
|
+
if (!this._editor.isActive) {
|
|
293
|
+
this.startHoverTimer(wcsPos.x, wcsPos.y);
|
|
294
|
+
}
|
|
292
295
|
}
|
|
293
296
|
};
|
|
294
297
|
AcEdBaseView.prototype.setHoveredObjectId = function (newId) {
|
|
295
298
|
if (this._hoveredObjectId) {
|
|
296
299
|
this.events.unhover.dispatch({
|
|
297
300
|
id: this._hoveredObjectId,
|
|
298
|
-
x: this.
|
|
299
|
-
y: this.
|
|
301
|
+
x: this.curMousePos.x,
|
|
302
|
+
y: this.curMousePos.y
|
|
300
303
|
});
|
|
301
304
|
this.onUnhover(this._hoveredObjectId);
|
|
302
305
|
}
|
|
@@ -338,8 +341,8 @@ var AcEdBaseView = /** @class */ (function () {
|
|
|
338
341
|
this._pauseTimer = setTimeout(function () {
|
|
339
342
|
_this.events.hover.dispatch({
|
|
340
343
|
id: id,
|
|
341
|
-
x: _this.
|
|
342
|
-
y: _this.
|
|
344
|
+
x: _this.curMousePos.x,
|
|
345
|
+
y: _this.curMousePos.y
|
|
343
346
|
});
|
|
344
347
|
}, 500);
|
|
345
348
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBaseView.js","sourceRoot":"","sources":["../../../src/editor/view/AcEdBaseView.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAMhB,SAAS,EACT,WAAW,EAEZ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AA2D5C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAN,IAAY,YAmBX;AAnBD,WAAY,YAAY;IACtB;;;;;;;OAOG;IACH,yDAAa,CAAA;IACb;;;;;;;OAOG;IACH,6CAAO,CAAA;AACT,CAAC,EAnBW,YAAY,KAAZ,YAAY,QAmBvB;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH;IA0CE;;;;;;;OAOG;IACH,sBAAY,MAAyB;QAArC,iBA8BC;QAlDD,wDAAwD;QACxC,WAAM,GAAG;YACvB,2CAA2C;YAC3C,SAAS,EAAE,IAAI,gBAAgB,EAAsB;YACrD,qCAAqC;YACrC,UAAU,EAAE,IAAI,gBAAgB,EAA4B;YAC5D,6CAA6C;YAC7C,KAAK,EAAE,IAAI,gBAAgB,EAA0B;YACrD,qDAAqD;YACrD,OAAO,EAAE,IAAI,gBAAgB,EAA0B;SACxD,CAAA;QAWC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAA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CAAC,eAAe,EAAE,CAAA;QACxB,CAAC;IACH,CAAC;IAEO,sCAAe,GAAvB;QACE,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IAEO,sCAAe,GAAvB;QACE,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IAEO,sCAAe,GAAvB,UAAwB,CAAS,EAAE,CAAS;QAA5C,iBAKC;QAJC,IAAI,CAAC,eAAe,EAAE,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC5B,KAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACpB,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC;IAEO,sCAAe,GAAvB,UAAwB,EAAgB;QAAxC,iBAQC;QAPC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC5B,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;gBACzB,EAAE,EAAE,EAAE;gBACN,CAAC,EAAE,KAAI,CAAC,WAAW,CAAC,CAAC;gBACrB,CAAC,EAAE,KAAI,CAAC,WAAW,CAAC,CAAC;aACtB,CAAC,CAAA;QACJ,CAAC,EAAE,GAAG,CAAC,CAAA;IACT,CAAC;IACH,mBAAC;AAAD,CAAC,AAngBD,IAmgBC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
|
+
/**
|
|
3
|
+
* Language/locale id used in the application.
|
|
4
|
+
* Matches the naming style used by vue-i18n ("Locale").
|
|
5
|
+
*/
|
|
6
|
+
export type AcApLocale = 'en' | 'zh';
|
|
7
|
+
/**
|
|
8
|
+
* A single locale message tree.
|
|
9
|
+
* Leaf values are strings, inner nodes are nested objects of the same shape.
|
|
10
|
+
* This mirrors vue-i18n's LocaleMessage structure.
|
|
11
|
+
*/
|
|
12
|
+
export interface AcApLocaleMessage {
|
|
13
|
+
[key: string]: string | AcApLocaleMessage;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The whole messages map: locale -> locale message tree.
|
|
17
|
+
* This mirrors vue-i18n's "LocaleMessages".
|
|
18
|
+
*/
|
|
19
|
+
export type AcApLocaleMessages = Record<AcApLocale, AcApLocaleMessage>;
|
|
20
|
+
/**
|
|
21
|
+
* Options for translation lookup.
|
|
22
|
+
*/
|
|
23
|
+
export interface AcApTranslateOptions {
|
|
24
|
+
fallback?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Event arguments for locale changed events.
|
|
28
|
+
*/
|
|
29
|
+
export interface AcApLocaleChangedEventArgs {
|
|
30
|
+
/** The old locale value */
|
|
31
|
+
old: AcApLocale;
|
|
32
|
+
/** The new locale value */
|
|
33
|
+
new: AcApLocale;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A framework-agnostic i18n registry with vue-i18n-like API names.
|
|
37
|
+
*
|
|
38
|
+
* Key methods:
|
|
39
|
+
* - getLocaleMessages(): returns all messages (for vue-i18n { messages })
|
|
40
|
+
* - getLocaleMessage(locale): returns single locale messages
|
|
41
|
+
* - setLocaleMessage(locale, messages): replace locale messages
|
|
42
|
+
* - mergeLocaleMessage(locale, messages): deep-merge into existing locale (fixed)
|
|
43
|
+
* - t(locale, key, options): translation helper for core code (no Vue required)
|
|
44
|
+
*/
|
|
45
|
+
export declare class AcApI18n {
|
|
46
|
+
private static _messages;
|
|
47
|
+
/**
|
|
48
|
+
* @private
|
|
49
|
+
*
|
|
50
|
+
* Stores the currently active locale used by the translation
|
|
51
|
+
* system. Defaults to `"en"`.
|
|
52
|
+
*
|
|
53
|
+
* This value is used by `t(key, options)` when no locale
|
|
54
|
+
* parameter is provided.
|
|
55
|
+
*/
|
|
56
|
+
private static _currentLocale;
|
|
57
|
+
/**
|
|
58
|
+
* Return the whole messages map (for vue-i18n initialisation).
|
|
59
|
+
*/
|
|
60
|
+
static get messages(): Readonly<AcApLocaleMessages>;
|
|
61
|
+
/** Supported events */
|
|
62
|
+
static readonly events: {
|
|
63
|
+
/** Fired when locale changed */
|
|
64
|
+
localeChanged: AcCmEventManager<AcApLocaleChangedEventArgs>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Return the messages object for a single locale.
|
|
68
|
+
*/
|
|
69
|
+
static getLocaleMessage(locale: AcApLocale): Readonly<AcApLocaleMessage>;
|
|
70
|
+
/**
|
|
71
|
+
* Deep-merge a message dictionary into an existing locale.
|
|
72
|
+
*/
|
|
73
|
+
static mergeLocaleMessage<L extends AcApLocale>(locale: L, messages: AcApLocaleMessage): void;
|
|
74
|
+
/**
|
|
75
|
+
* Register a plugin's messages.
|
|
76
|
+
* Alias for mergeLocaleMessage for consistency with vue-i18n.
|
|
77
|
+
*/
|
|
78
|
+
static registerMessage<L extends AcApLocale>(locale: L, messages: AcApLocaleMessage): void;
|
|
79
|
+
/**
|
|
80
|
+
* Set the current active locale for translation.
|
|
81
|
+
*
|
|
82
|
+
* @param locale - Locale to activate (`"en"` or `"zh"`)
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* This method updates the internal locale state used by all
|
|
86
|
+
* future calls to `t(key, options)`. After calling this method,
|
|
87
|
+
* the entire application will use the new locale automatically.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* AcApI18n.setCurrentLocale('zh')
|
|
92
|
+
* console.log(AcApI18n.t('core.start')) // uses Chinese messages
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
static setCurrentLocale(locale: AcApLocale): void;
|
|
96
|
+
/**
|
|
97
|
+
* Get the currently active locale.
|
|
98
|
+
*
|
|
99
|
+
* @returns The locale currently used for translation.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* console.log(AcApI18n.currentLocale) // "en" or "zh"
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
static get currentLocale(): AcApLocale;
|
|
107
|
+
/**
|
|
108
|
+
* Translate a dotted key path using the registry (no Vue required).
|
|
109
|
+
*
|
|
110
|
+
* @param key - dotted path, e.g. "core.start" or "pluginX.button.ok"
|
|
111
|
+
* @param options - optional fallback
|
|
112
|
+
* @returns translated string or fallback/key if not found
|
|
113
|
+
*/
|
|
114
|
+
static t(key: string, options?: AcApTranslateOptions): string;
|
|
115
|
+
/**
|
|
116
|
+
* Get localized command description
|
|
117
|
+
* @param groupName - Command group name
|
|
118
|
+
* @param cmdName - Global command name
|
|
119
|
+
* @returns - The localized command description.
|
|
120
|
+
*/
|
|
121
|
+
static cmdDescription(groupName: string, cmdName: string): string;
|
|
122
|
+
/**
|
|
123
|
+
* Tries to find command in system group and gets its localized command description
|
|
124
|
+
* @param cmdName - Global command name
|
|
125
|
+
* @returns - The localized command description
|
|
126
|
+
*/
|
|
127
|
+
static sysCmdDescription(name: string): string;
|
|
128
|
+
/**
|
|
129
|
+
* Tries to find command in user group and gets its localized command description
|
|
130
|
+
* @param cmdName - Global command name
|
|
131
|
+
* @returns - The localized command description
|
|
132
|
+
*/
|
|
133
|
+
static userCmdDescription: (name: string) => string;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=AcApI18n.d.ts.map
|