@mlightcad/cad-simple-viewer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/index.js +2422 -0
- package/dist/index.umd.cjs +9 -0
- package/lib/app/AcApContext.d.ts +15 -0
- package/lib/app/AcApContext.d.ts.map +1 -0
- package/lib/app/AcApContext.js +56 -0
- package/lib/app/AcApContext.js.map +1 -0
- package/lib/app/AcApDocCreator.d.ts +17 -0
- package/lib/app/AcApDocCreator.d.ts.map +1 -0
- package/lib/app/AcApDocCreator.js +140 -0
- package/lib/app/AcApDocCreator.js.map +1 -0
- package/lib/app/AcApDocManager.d.ts +60 -0
- package/lib/app/AcApDocManager.d.ts.map +1 -0
- package/lib/app/AcApDocManager.js +275 -0
- package/lib/app/AcApDocManager.js.map +1 -0
- package/lib/app/AcApDocument.d.ts +27 -0
- package/lib/app/AcApDocument.d.ts.map +1 -0
- package/lib/app/AcApDocument.js +165 -0
- package/lib/app/AcApDocument.js.map +1 -0
- package/lib/app/AcApFontLoader.d.ts +20 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -0
- package/lib/app/AcApFontLoader.js +135 -0
- package/lib/app/AcApFontLoader.js.map +1 -0
- package/lib/app/AcApSettingManager.d.ts +44 -0
- package/lib/app/AcApSettingManager.d.ts.map +1 -0
- package/lib/app/AcApSettingManager.js +122 -0
- package/lib/app/AcApSettingManager.js.map +1 -0
- package/lib/app/index.d.ts +5 -0
- package/lib/app/index.d.ts.map +1 -0
- package/lib/app/index.js +5 -0
- package/lib/app/index.js.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts +6 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.js +30 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
- package/lib/command/AcApOpenCmd.d.ts +6 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -0
- package/lib/command/AcApOpenCmd.js +29 -0
- package/lib/command/AcApOpenCmd.js.map +1 -0
- package/lib/command/AcApPanCmd.d.ts +6 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -0
- package/lib/command/AcApPanCmd.js +30 -0
- package/lib/command/AcApPanCmd.js.map +1 -0
- package/lib/command/AcApQNewCmd.d.ts +6 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -0
- package/lib/command/AcApQNewCmd.js +30 -0
- package/lib/command/AcApQNewCmd.js.map +1 -0
- package/lib/command/AcApSelectCmd.d.ts +6 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -0
- package/lib/command/AcApSelectCmd.js +30 -0
- package/lib/command/AcApSelectCmd.js.map +1 -0
- package/lib/command/AcApSvgConvertor.d.ts +5 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
- package/lib/command/AcApSvgConvertor.js +55 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -0
- package/lib/command/AcApZoomCmd.d.ts +6 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomCmd.js +28 -0
- package/lib/command/AcApZoomCmd.js.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts +11 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.js +101 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
- package/lib/command/index.d.ts +10 -0
- package/lib/command/index.d.ts.map +1 -0
- package/lib/command/index.js +10 -0
- package/lib/command/index.js.map +1 -0
- package/lib/editor/command/AcEdCommand.d.ts +42 -0
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommand.js +60 -0
- package/lib/editor/command/AcEdCommand.js.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.js +65 -0
- package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
- package/lib/editor/command/AcEdCommandStack.d.ts +66 -0
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandStack.js +192 -0
- package/lib/editor/command/AcEdCommandStack.js.map +1 -0
- package/lib/editor/command/index.d.ts +3 -0
- package/lib/editor/command/index.d.ts.map +1 -0
- package/lib/editor/command/index.js +3 -0
- package/lib/editor/command/index.js.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.js +14 -0
- package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
- package/lib/editor/global/AcEdMessage.d.ts +5 -0
- package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
- package/lib/editor/global/AcEdMessage.js +6 -0
- package/lib/editor/global/AcEdMessage.js.map +1 -0
- package/lib/editor/global/eventBus.d.ts +34 -0
- package/lib/editor/global/eventBus.d.ts.map +1 -0
- package/lib/editor/global/eventBus.js +3 -0
- package/lib/editor/global/eventBus.js.map +1 -0
- package/lib/editor/global/index.d.ts +3 -0
- package/lib/editor/global/index.d.ts.map +1 -0
- package/lib/editor/global/index.js +3 -0
- package/lib/editor/global/index.js.map +1 -0
- package/lib/editor/index.d.ts +5 -0
- package/lib/editor/index.d.ts.map +1 -0
- package/lib/editor/index.js +5 -0
- package/lib/editor/index.js.map +1 -0
- package/lib/editor/input/AcEdBaseInput.d.ts +25 -0
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
- package/lib/editor/input/AcEdBaseInput.js +105 -0
- package/lib/editor/input/AcEdBaseInput.js.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts +27 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.js +140 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
- package/lib/editor/input/AcEdCursorManager.d.ts +43 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
- package/lib/editor/input/AcEdCursorManager.js +71 -0
- package/lib/editor/input/AcEdCursorManager.js.map +1 -0
- package/lib/editor/input/AcEdInputPoint.d.ts +14 -0
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
- package/lib/editor/input/AcEdInputPoint.js +41 -0
- package/lib/editor/input/AcEdInputPoint.js.map +1 -0
- package/lib/editor/input/AcEdJig.d.ts +14 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdJig.js +92 -0
- package/lib/editor/input/AcEdJig.js.map +1 -0
- package/lib/editor/input/AcEdJigLoop.d.ts +14 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
- package/lib/editor/input/AcEdJigLoop.js +43 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts +26 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.js +63 -0
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +27 -0
- package/lib/editor/input/AcEditor.d.ts.map +1 -0
- package/lib/editor/input/AcEditor.js +103 -0
- package/lib/editor/input/AcEditor.js.map +1 -0
- package/lib/editor/input/index.d.ts +5 -0
- package/lib/editor/input/index.d.ts.map +1 -0
- package/lib/editor/input/index.js +5 -0
- package/lib/editor/input/index.js.map +1 -0
- package/lib/editor/view/AcEdBaseView.d.ts +261 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
- package/lib/editor/view/AcEdBaseView.js +260 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -0
- package/lib/editor/view/index.d.ts +2 -0
- package/lib/editor/view/index.d.ts.map +1 -0
- package/lib/editor/view/index.js +2 -0
- package/lib/editor/view/index.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/util/AcTrGeometryUtil.d.ts +18 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
- package/lib/util/AcTrGeometryUtil.js +33 -0
- package/lib/util/AcTrGeometryUtil.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -0
- package/lib/view/AcTrLayer.d.ts +97 -0
- package/lib/view/AcTrLayer.d.ts.map +1 -0
- package/lib/view/AcTrLayer.js +170 -0
- package/lib/view/AcTrLayer.js.map +1 -0
- package/lib/view/AcTrLayout.d.ts +114 -0
- package/lib/view/AcTrLayout.d.ts.map +1 -0
- package/lib/view/AcTrLayout.js +344 -0
- package/lib/view/AcTrLayout.js.map +1 -0
- package/lib/view/AcTrLayoutView.d.ts +57 -0
- package/lib/view/AcTrLayoutView.d.ts.map +1 -0
- package/lib/view/AcTrLayoutView.js +151 -0
- package/lib/view/AcTrLayoutView.js.map +1 -0
- package/lib/view/AcTrLayoutViewManager.d.ts +43 -0
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
- package/lib/view/AcTrLayoutViewManager.js +74 -0
- package/lib/view/AcTrLayoutViewManager.js.map +1 -0
- package/lib/view/AcTrScene.d.ts +115 -0
- package/lib/view/AcTrScene.d.ts.map +1 -0
- package/lib/view/AcTrScene.js +319 -0
- package/lib/view/AcTrScene.js.map +1 -0
- package/lib/view/AcTrView2d.d.ts +160 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -0
- package/lib/view/AcTrView2d.js +473 -0
- package/lib/view/AcTrView2d.js.map +1 -0
- package/lib/view/index.d.ts +2 -0
- package/lib/view/index.d.ts.map +1 -0
- package/lib/view/index.js +2 -0
- package/lib/view/index.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,101 @@
|
|
|
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 { AcApDocManager } from '../app';
|
|
53
|
+
import { AcEdCommand } from '../command';
|
|
54
|
+
import { AcEdJig } from '../editor';
|
|
55
|
+
var AcApZoomToBoxJig = /** @class */ (function (_super) {
|
|
56
|
+
__extends(AcApZoomToBoxJig, _super);
|
|
57
|
+
function AcApZoomToBoxJig(view) {
|
|
58
|
+
return _super.call(this, view) || this;
|
|
59
|
+
}
|
|
60
|
+
AcApZoomToBoxJig.prototype.sampler = function () {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
+
var _this = this;
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
switch (_a.label) {
|
|
65
|
+
case 0: return [4 /*yield*/, AcApDocManager.instance.editor.getSelection().then(function (box) {
|
|
66
|
+
return _this.view.zoomTo(box, 1);
|
|
67
|
+
})];
|
|
68
|
+
case 1:
|
|
69
|
+
_a.sent();
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
return AcApZoomToBoxJig;
|
|
76
|
+
}(AcEdJig));
|
|
77
|
+
export { AcApZoomToBoxJig };
|
|
78
|
+
var AcApZoomToBoxCmd = /** @class */ (function (_super) {
|
|
79
|
+
__extends(AcApZoomToBoxCmd, _super);
|
|
80
|
+
function AcApZoomToBoxCmd() {
|
|
81
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
82
|
+
}
|
|
83
|
+
AcApZoomToBoxCmd.prototype.execute = function (context) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
+
var jig;
|
|
86
|
+
return __generator(this, function (_a) {
|
|
87
|
+
switch (_a.label) {
|
|
88
|
+
case 0:
|
|
89
|
+
jig = new AcApZoomToBoxJig(context.view);
|
|
90
|
+
return [4 /*yield*/, jig.drag()];
|
|
91
|
+
case 1:
|
|
92
|
+
_a.sent();
|
|
93
|
+
return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
return AcApZoomToBoxCmd;
|
|
99
|
+
}(AcEdCommand));
|
|
100
|
+
export { AcApZoomToBoxCmd };
|
|
101
|
+
//# sourceMappingURL=AcApZoomToBoxCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApZoomToBoxCmd.js","sourceRoot":"","sources":["../../src/command/AcApZoomToBoxCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAgB,OAAO,EAAE,MAAM,WAAW,CAAA;AAEjD;IAAsC,oCAAgB;IACpD,0BAAY,IAAkB;QAC5B,OAAA,MAAK,YAAC,IAAI,CAAC,SAAA;IACb,CAAC;IAEK,kCAAO,GAAb;;;;;4BACE,qBAAM,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,UAAA,GAAG;4BAC1D,OAAO,KAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;wBACjC,CAAC,CAAC,EAAA;;wBAFF,SAEE,CAAA;;;;;KACH;IACH,uBAAC;AAAD,CAAC,AAVD,CAAsC,OAAO,GAU5C;;AAED;IAAsC,oCAAW;IAAjD;;IAKA,CAAC;IAJO,kCAAO,GAAb,UAAc,OAAoB;;;;;;wBAC1B,GAAG,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;wBAC9C,qBAAM,GAAG,CAAC,IAAI,EAAE,EAAA;;wBAAhB,SAAgB,CAAA;;;;;KACjB;IACH,uBAAC;AAAD,CAAC,AALD,CAAsC,WAAW,GAKhD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from '../editor/command/AcEdCommand';
|
|
2
|
+
export * from '../editor/command/AcEdCommandStack';
|
|
3
|
+
export * from './AcApConvertToSvgCmd';
|
|
4
|
+
export * from './AcApOpenCmd';
|
|
5
|
+
export * from './AcApQNewCmd';
|
|
6
|
+
export * from './AcApSelectCmd';
|
|
7
|
+
export * from './AcApZoomCmd';
|
|
8
|
+
export * from './AcApZoomToBoxCmd';
|
|
9
|
+
export * from './AcApPanCmd';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from '../editor/command/AcEdCommand';
|
|
2
|
+
export * from '../editor/command/AcEdCommandStack';
|
|
3
|
+
export * from './AcApConvertToSvgCmd';
|
|
4
|
+
export * from './AcApOpenCmd';
|
|
5
|
+
export * from './AcApQNewCmd';
|
|
6
|
+
export * from './AcApSelectCmd';
|
|
7
|
+
export * from './AcApZoomCmd';
|
|
8
|
+
export * from './AcApZoomToBoxCmd';
|
|
9
|
+
export * from './AcApPanCmd';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oCAAoC,CAAA;AAClD,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
|
+
import { AcApContext } from '../../app';
|
|
3
|
+
/**
|
|
4
|
+
* Interface to define arguments of one command event.
|
|
5
|
+
*/
|
|
6
|
+
export interface AcEdCommandEventArgs {
|
|
7
|
+
command: AcEdCommand;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Base class of all commands.
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class AcEdCommand {
|
|
13
|
+
private _globalName;
|
|
14
|
+
private _localName;
|
|
15
|
+
constructor();
|
|
16
|
+
readonly events: {
|
|
17
|
+
commandWillStart: AcCmEventManager<AcEdCommandEventArgs>;
|
|
18
|
+
commandEnded: AcCmEventManager<AcEdCommandEventArgs>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The global or untranslated name associated with the command.
|
|
22
|
+
*/
|
|
23
|
+
get globalName(): string;
|
|
24
|
+
set globalName(value: string);
|
|
25
|
+
/**
|
|
26
|
+
* The local or translated name associated with the command.
|
|
27
|
+
*/
|
|
28
|
+
get localName(): string;
|
|
29
|
+
set localName(value: string);
|
|
30
|
+
/**
|
|
31
|
+
* Trigger this command. The children class should not override this method to keep event notification
|
|
32
|
+
* work correctly.
|
|
33
|
+
* @param context Input current context to execute this command.
|
|
34
|
+
*/
|
|
35
|
+
tirgger(context: AcApContext): void;
|
|
36
|
+
/**
|
|
37
|
+
* Execute this command. The children class should override this method to add business logic of this command.
|
|
38
|
+
* @param _context Input current context to execute this command.
|
|
39
|
+
*/
|
|
40
|
+
execute(_context: AcApContext): void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=AcEdCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdCommand.d.ts","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,WAAW,CAAA;CACrB;AAED;;GAEG;AACH,8BAAsB,WAAW;IAC/B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,UAAU,CAAQ;;IAO1B,SAAgB,MAAM;;;MAGrB;IAED;;OAEG;IACH,IAAI,UAAU,IAGQ,MAAM,CAD3B;IACD,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED;;OAEG;IACH,IAAI,SAAS,IAGQ,MAAM,CAD1B;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,MAAM,EAE1B;IAED;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,WAAW;IAM5B;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,WAAW;CAG9B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AcCmEventManager } from '@mlightcad/data-model';
|
|
2
|
+
/**
|
|
3
|
+
* Base class of all commands.
|
|
4
|
+
*/
|
|
5
|
+
var AcEdCommand = /** @class */ (function () {
|
|
6
|
+
function AcEdCommand() {
|
|
7
|
+
this.events = {
|
|
8
|
+
commandWillStart: new AcCmEventManager(),
|
|
9
|
+
commandEnded: new AcCmEventManager()
|
|
10
|
+
};
|
|
11
|
+
this._globalName = '';
|
|
12
|
+
this._localName = '';
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(AcEdCommand.prototype, "globalName", {
|
|
15
|
+
/**
|
|
16
|
+
* The global or untranslated name associated with the command.
|
|
17
|
+
*/
|
|
18
|
+
get: function () {
|
|
19
|
+
return this._globalName;
|
|
20
|
+
},
|
|
21
|
+
set: function (value) {
|
|
22
|
+
this._globalName = value;
|
|
23
|
+
},
|
|
24
|
+
enumerable: false,
|
|
25
|
+
configurable: true
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(AcEdCommand.prototype, "localName", {
|
|
28
|
+
/**
|
|
29
|
+
* The local or translated name associated with the command.
|
|
30
|
+
*/
|
|
31
|
+
get: function () {
|
|
32
|
+
return this._localName;
|
|
33
|
+
},
|
|
34
|
+
set: function (value) {
|
|
35
|
+
this._localName = value;
|
|
36
|
+
},
|
|
37
|
+
enumerable: false,
|
|
38
|
+
configurable: true
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Trigger this command. The children class should not override this method to keep event notification
|
|
42
|
+
* work correctly.
|
|
43
|
+
* @param context Input current context to execute this command.
|
|
44
|
+
*/
|
|
45
|
+
AcEdCommand.prototype.tirgger = function (context) {
|
|
46
|
+
this.events.commandWillStart.dispatch({ command: this });
|
|
47
|
+
this.execute(context);
|
|
48
|
+
this.events.commandEnded.dispatch({ command: this });
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Execute this command. The children class should override this method to add business logic of this command.
|
|
52
|
+
* @param _context Input current context to execute this command.
|
|
53
|
+
*/
|
|
54
|
+
AcEdCommand.prototype.execute = function (_context) {
|
|
55
|
+
// Do nothing
|
|
56
|
+
};
|
|
57
|
+
return AcEdCommand;
|
|
58
|
+
}());
|
|
59
|
+
export { AcEdCommand };
|
|
60
|
+
//# sourceMappingURL=AcEdCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdCommand.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAWxD;;GAEG;AACH;IAIE;QAKgB,WAAM,GAAG;YACvB,gBAAgB,EAAE,IAAI,gBAAgB,EAAwB;YAC9D,YAAY,EAAE,IAAI,gBAAgB,EAAwB;SAC3D,CAAA;QAPC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAA;QACrB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;IACtB,CAAC;IAUD,sBAAI,mCAAU;QAHd;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,WAAW,CAAA;QACzB,CAAC;aACD,UAAe,KAAa;YAC1B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;QAC1B,CAAC;;;OAHA;IAQD,sBAAI,kCAAS;QAHb;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,UAAU,CAAA;QACxB,CAAC;aACD,UAAc,KAAa;YACzB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;QACzB,CAAC;;;OAHA;IAKD;;;;OAIG;IACH,6BAAO,GAAP,UAAQ,OAAoB;QAC1B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QACxD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACrB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;IACtD,CAAC;IAED;;;OAGG;IACH,6BAAO,GAAP,UAAQ,QAAqB;QAC3B,aAAa;IACf,CAAC;IACH,kBAAC;AAAD,CAAC,AApDD,IAoDC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AcEdCommand } from './AcEdCommand';
|
|
2
|
+
import { AcEdCommandGroup } from './AcEdCommandStack';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the type of item returned by command iterator.
|
|
5
|
+
*/
|
|
6
|
+
export interface AcEdCommandIteratorItem {
|
|
7
|
+
commandGroup: string;
|
|
8
|
+
command: AcEdCommand;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* This class allows you to traverse the chain of command groups that are registered with AutoCAD and
|
|
12
|
+
* obtain information about the groups and the AcEdCommand objects within them.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AcEdCommandIterator implements IterableIterator<AcEdCommandIteratorItem> {
|
|
15
|
+
private _index;
|
|
16
|
+
private _commands;
|
|
17
|
+
constructor(commandGroups: AcEdCommandGroup[]);
|
|
18
|
+
[Symbol.iterator](): IterableIterator<AcEdCommandIteratorItem>;
|
|
19
|
+
/**
|
|
20
|
+
* Return command object the iterator currently points to. If the iterator is at the beginning, then the
|
|
21
|
+
* first object is returned. If the iterator has already gone past the last entry, then null is returned.
|
|
22
|
+
*/
|
|
23
|
+
get command(): AcEdCommand | null;
|
|
24
|
+
/**
|
|
25
|
+
* Return the name of the command object the iterator currently points to. If the iterator is at the
|
|
26
|
+
* beginning, then the first object is returned. If the iterator has already gone past the last entry,
|
|
27
|
+
* then null is returned.
|
|
28
|
+
*/
|
|
29
|
+
get commandGroup(): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Increment the iterator to the next entry.
|
|
32
|
+
* @returns Return the next entry
|
|
33
|
+
*/
|
|
34
|
+
next(): IteratorResult<AcEdCommandIteratorItem, null>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=AcEdCommandIterator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdCommandIterator.d.ts","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandIterator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,WAAW,CAAA;CACrB;AACD;;;GAGG;AACH,qBAAa,mBACX,YAAW,gBAAgB,CAAC,uBAAuB,CAAC;IAEpD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,SAAS,CAA2B;gBAEhC,aAAa,EAAE,gBAAgB,EAAE;IAc7C,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,uBAAuB,CAAC;IAI9D;;;OAGG;IACH,IAAI,OAAO,uBAIV;IAED;;;;OAIG;IACH,IAAI,YAAY,kBAIf;IAED;;;OAGG;IACH,IAAI,IAAI,cAAc,CAAC,uBAAuB,EAAE,IAAI,CAAC;CAQtD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This class allows you to traverse the chain of command groups that are registered with AutoCAD and
|
|
3
|
+
* obtain information about the groups and the AcEdCommand objects within them.
|
|
4
|
+
*/
|
|
5
|
+
var AcEdCommandIterator = /** @class */ (function () {
|
|
6
|
+
function AcEdCommandIterator(commandGroups) {
|
|
7
|
+
var _this = this;
|
|
8
|
+
this._index = 0;
|
|
9
|
+
this._commands = [];
|
|
10
|
+
commandGroups.forEach(function (group) {
|
|
11
|
+
var commandGroup = group.groupName;
|
|
12
|
+
group.commandsByGlobalName.forEach(function (command) {
|
|
13
|
+
_this._commands.push({
|
|
14
|
+
command: command,
|
|
15
|
+
commandGroup: commandGroup
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
AcEdCommandIterator.prototype[Symbol.iterator] = function () {
|
|
21
|
+
return this;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(AcEdCommandIterator.prototype, "command", {
|
|
24
|
+
/**
|
|
25
|
+
* Return command object the iterator currently points to. If the iterator is at the beginning, then the
|
|
26
|
+
* first object is returned. If the iterator has already gone past the last entry, then null is returned.
|
|
27
|
+
*/
|
|
28
|
+
get: function () {
|
|
29
|
+
return this._index < this._commands.length
|
|
30
|
+
? this._commands[this._index].command
|
|
31
|
+
: null;
|
|
32
|
+
},
|
|
33
|
+
enumerable: false,
|
|
34
|
+
configurable: true
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(AcEdCommandIterator.prototype, "commandGroup", {
|
|
37
|
+
/**
|
|
38
|
+
* Return the name of the command object the iterator currently points to. If the iterator is at the
|
|
39
|
+
* beginning, then the first object is returned. If the iterator has already gone past the last entry,
|
|
40
|
+
* then null is returned.
|
|
41
|
+
*/
|
|
42
|
+
get: function () {
|
|
43
|
+
return this._index < this._commands.length
|
|
44
|
+
? this._commands[this._index].commandGroup
|
|
45
|
+
: null;
|
|
46
|
+
},
|
|
47
|
+
enumerable: false,
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Increment the iterator to the next entry.
|
|
52
|
+
* @returns Return the next entry
|
|
53
|
+
*/
|
|
54
|
+
AcEdCommandIterator.prototype.next = function () {
|
|
55
|
+
while (this._index < this._commands.length) {
|
|
56
|
+
var value = this._commands[this._index];
|
|
57
|
+
this._index += 1;
|
|
58
|
+
return { value: value, done: false };
|
|
59
|
+
}
|
|
60
|
+
return { value: null, done: true };
|
|
61
|
+
};
|
|
62
|
+
return AcEdCommandIterator;
|
|
63
|
+
}());
|
|
64
|
+
export { AcEdCommandIterator };
|
|
65
|
+
//# sourceMappingURL=AcEdCommandIterator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdCommandIterator.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandIterator.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH;IAME,6BAAY,aAAiC;QAA7C,iBAYC;QAXC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;QACf,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;QACnB,aAAa,CAAC,OAAO,CAAC,UAAA,KAAK;YACzB,IAAM,YAAY,GAAG,KAAK,CAAC,SAAS,CAAA;YACpC,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,UAAA,OAAO;gBACxC,KAAI,CAAC,SAAS,CAAC,IAAI,CAAC;oBAClB,OAAO,SAAA;oBACP,YAAY,cAAA;iBACb,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,8BAAC,MAAM,CAAC,QAAQ,CAAC,GAAjB;QACE,OAAO,IAAI,CAAA;IACb,CAAC;IAMD,sBAAI,wCAAO;QAJX;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;gBACxC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO;gBACrC,CAAC,CAAC,IAAI,CAAA;QACV,CAAC;;;OAAA;IAOD,sBAAI,6CAAY;QALhB;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM;gBACxC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,YAAY;gBAC1C,CAAC,CAAC,IAAI,CAAA;QACV,CAAC;;;OAAA;IAED;;;OAGG;IACH,kCAAI,GAAJ;QACE,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;YAC3C,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YACzC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAA;YAChB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QACtC,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IACpC,CAAC;IACH,0BAAC;AAAD,CAAC,AAzDD,IAyDC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AcEdCommand } from './AcEdCommand';
|
|
2
|
+
import { AcEdCommandIterator } from './AcEdCommandIterator';
|
|
3
|
+
export interface AcEdCommandGroup {
|
|
4
|
+
groupName: string;
|
|
5
|
+
commandsByGlobalName: Map<string, AcEdCommand>;
|
|
6
|
+
commandsByLocalName: Map<string, AcEdCommand>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The class to create, define, and register command objects.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AcEdCommandStack {
|
|
12
|
+
static SYSTEMT_COMMAND_GROUP_NAME: string;
|
|
13
|
+
static DEFAUT_COMMAND_GROUP_NAME: string;
|
|
14
|
+
private _commandsByGroup;
|
|
15
|
+
private _systemCommandGroup;
|
|
16
|
+
private _defaultCommandGroup;
|
|
17
|
+
private static _instance?;
|
|
18
|
+
private constructor();
|
|
19
|
+
static get instance(): AcEdCommandStack;
|
|
20
|
+
addCommand(cmdGroupName: string, cmdGlobalName: string, cmdLocalName: string, cmd: AcEdCommand): void;
|
|
21
|
+
/**
|
|
22
|
+
* Return an iterator that can be used to traverse all of command objects in this command stack
|
|
23
|
+
* (that is, the iterator iterates through all commands in all groups).
|
|
24
|
+
* @returns Return an iterator that can be used to traverse all of command objects in this command
|
|
25
|
+
* stack.
|
|
26
|
+
*/
|
|
27
|
+
iterator(): AcEdCommandIterator;
|
|
28
|
+
/**
|
|
29
|
+
* Search through all of the global and untranslated names in all of the command groups in the command
|
|
30
|
+
* stack starting at the top of the stack trying to find a match with cmdName. If a match is found, the
|
|
31
|
+
* matched AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command
|
|
32
|
+
* could not be found. If more than one command of the same name is present in the command stack (that
|
|
33
|
+
* is, in separate command groups), then the first one found is used.
|
|
34
|
+
* @param cmdName Input the command name to search for
|
|
35
|
+
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
36
|
+
*/
|
|
37
|
+
lookupGlobalCmd(cmdName: string): AcEdCommand | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Search through all of the local and translated names in all of the command groups in the command stack
|
|
40
|
+
* starting at the top of the stack trying to find a match with cmdName. If a match is found, the matched
|
|
41
|
+
* AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command could not
|
|
42
|
+
* be found. If more than one command of the same name is present in the command stack (that is, in
|
|
43
|
+
* separate command groups), then the first one found is used.
|
|
44
|
+
* @param cmdName Input the command name to search for
|
|
45
|
+
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
46
|
+
*/
|
|
47
|
+
lookupLocalCmd(cmdName: string): AcEdCommand | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Remove the command with the global and untranslated name `cmdGlobalName` from the `cmdGroupName`
|
|
50
|
+
* command group. Return true if successful. Return false if no command with the global and untranslated
|
|
51
|
+
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
52
|
+
* @param cmdGroupName Input the name of the command group containing the command to be removed
|
|
53
|
+
* @param cmdGlobalName Input the command name which is to be removed from cmdGroupName
|
|
54
|
+
* @returns Return true if successful. Return false if no command with the global and untranslated
|
|
55
|
+
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
56
|
+
*/
|
|
57
|
+
removeCmd(cmdGroupName: string, cmdGlobalName: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Remove the command group with the name `GroupName` from the command stack and delete the command group
|
|
60
|
+
* dictionary object and all the AcEdCommand objects stored within it.
|
|
61
|
+
* @param groupName Input the name of the command group to be removed from the command stack.
|
|
62
|
+
* @returns Return true if successful. Return false if no command group is found with the name `GroupName`.
|
|
63
|
+
*/
|
|
64
|
+
removeGroup(groupName: string): boolean;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=AcEdCommandStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdCommandStack.d.ts","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IAC9C,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;CAC9C;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,MAAM,CAAC,0BAA0B,SAAS;IAC1C,MAAM,CAAC,yBAAyB,SAAS;IACzC,OAAO,CAAC,gBAAgB,CAAoB;IAC5C,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,oBAAoB,CAAkB;IAC9C,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAkB;IAE3C,OAAO;IAgBP,MAAM,KAAK,QAAQ,qBAKlB;IAED,UAAU,CACR,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,WAAW;IA2ClB;;;;;OAKG;IACH,QAAQ;IAIR;;;;;;;;OAQG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM;IAS/B;;;;;;;;OAQG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM;IAS9B;;;;;;;;OAQG;IACH,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IASrD;;;;;OAKG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM;CAY9B"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function(o) {
|
|
2
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
if (o && typeof o.length === "number") return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
};
|
|
12
|
+
import { AcEdCommandIterator } from './AcEdCommandIterator';
|
|
13
|
+
/**
|
|
14
|
+
* The class to create, define, and register command objects.
|
|
15
|
+
*/
|
|
16
|
+
var AcEdCommandStack = /** @class */ (function () {
|
|
17
|
+
function AcEdCommandStack() {
|
|
18
|
+
this._commandsByGroup = [];
|
|
19
|
+
this._systemCommandGroup = {
|
|
20
|
+
groupName: AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME,
|
|
21
|
+
commandsByGlobalName: new Map(),
|
|
22
|
+
commandsByLocalName: new Map()
|
|
23
|
+
};
|
|
24
|
+
this._defaultCommandGroup = {
|
|
25
|
+
groupName: AcEdCommandStack.DEFAUT_COMMAND_GROUP_NAME,
|
|
26
|
+
commandsByGlobalName: new Map(),
|
|
27
|
+
commandsByLocalName: new Map()
|
|
28
|
+
};
|
|
29
|
+
this._commandsByGroup.push(this._systemCommandGroup);
|
|
30
|
+
this._commandsByGroup.push(this._defaultCommandGroup);
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(AcEdCommandStack, "instance", {
|
|
33
|
+
get: function () {
|
|
34
|
+
if (!AcEdCommandStack._instance) {
|
|
35
|
+
AcEdCommandStack._instance = new AcEdCommandStack();
|
|
36
|
+
}
|
|
37
|
+
return AcEdCommandStack._instance;
|
|
38
|
+
},
|
|
39
|
+
enumerable: false,
|
|
40
|
+
configurable: true
|
|
41
|
+
});
|
|
42
|
+
AcEdCommandStack.prototype.addCommand = function (cmdGroupName, cmdGlobalName, cmdLocalName, cmd) {
|
|
43
|
+
if (!cmdGlobalName) {
|
|
44
|
+
throw new Error('[AcEdCommandStack] The global name of the command is required!');
|
|
45
|
+
}
|
|
46
|
+
if (!cmdLocalName) {
|
|
47
|
+
cmdLocalName = cmdGlobalName;
|
|
48
|
+
}
|
|
49
|
+
var commandGroup = this._defaultCommandGroup;
|
|
50
|
+
if (cmdGroupName) {
|
|
51
|
+
var tmp = this._commandsByGroup.find(function (value) { return value.groupName == cmdGroupName; });
|
|
52
|
+
if (!tmp) {
|
|
53
|
+
commandGroup = {
|
|
54
|
+
groupName: cmdGroupName,
|
|
55
|
+
commandsByGlobalName: new Map(),
|
|
56
|
+
commandsByLocalName: new Map()
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
commandGroup = tmp;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (commandGroup.commandsByGlobalName.has(cmdGlobalName)) {
|
|
64
|
+
throw new Error("[AcEdCommandStack] The command with global name '".concat(cmdGlobalName, "' already exists!"));
|
|
65
|
+
}
|
|
66
|
+
if (commandGroup.commandsByLocalName.has(cmdLocalName)) {
|
|
67
|
+
throw new Error("[AcEdCommandStack] The command with local name '".concat(cmdLocalName, "' already exists!"));
|
|
68
|
+
}
|
|
69
|
+
commandGroup.commandsByGlobalName.set(cmdGlobalName, cmd);
|
|
70
|
+
commandGroup.commandsByLocalName.set(cmdLocalName, cmd);
|
|
71
|
+
cmd.globalName = cmdGlobalName;
|
|
72
|
+
cmd.localName = cmdLocalName;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Return an iterator that can be used to traverse all of command objects in this command stack
|
|
76
|
+
* (that is, the iterator iterates through all commands in all groups).
|
|
77
|
+
* @returns Return an iterator that can be used to traverse all of command objects in this command
|
|
78
|
+
* stack.
|
|
79
|
+
*/
|
|
80
|
+
AcEdCommandStack.prototype.iterator = function () {
|
|
81
|
+
return new AcEdCommandIterator(this._commandsByGroup);
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Search through all of the global and untranslated names in all of the command groups in the command
|
|
85
|
+
* stack starting at the top of the stack trying to find a match with cmdName. If a match is found, the
|
|
86
|
+
* matched AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command
|
|
87
|
+
* could not be found. If more than one command of the same name is present in the command stack (that
|
|
88
|
+
* is, in separate command groups), then the first one found is used.
|
|
89
|
+
* @param cmdName Input the command name to search for
|
|
90
|
+
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
91
|
+
*/
|
|
92
|
+
AcEdCommandStack.prototype.lookupGlobalCmd = function (cmdName) {
|
|
93
|
+
var e_1, _a;
|
|
94
|
+
var result = undefined;
|
|
95
|
+
try {
|
|
96
|
+
for (var _b = __values(this._commandsByGroup), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
97
|
+
var group = _c.value;
|
|
98
|
+
result = group.commandsByGlobalName.get(cmdName);
|
|
99
|
+
if (result)
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
104
|
+
finally {
|
|
105
|
+
try {
|
|
106
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
107
|
+
}
|
|
108
|
+
finally { if (e_1) throw e_1.error; }
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Search through all of the local and translated names in all of the command groups in the command stack
|
|
114
|
+
* starting at the top of the stack trying to find a match with cmdName. If a match is found, the matched
|
|
115
|
+
* AcEdCommand object is returned. Otherwise undefined is returned to indicate that the command could not
|
|
116
|
+
* be found. If more than one command of the same name is present in the command stack (that is, in
|
|
117
|
+
* separate command groups), then the first one found is used.
|
|
118
|
+
* @param cmdName Input the command name to search for
|
|
119
|
+
* @returns Return the matched AcEdCommand object if a match is found. Otherwise, return undefined.
|
|
120
|
+
*/
|
|
121
|
+
AcEdCommandStack.prototype.lookupLocalCmd = function (cmdName) {
|
|
122
|
+
var e_2, _a;
|
|
123
|
+
var result = undefined;
|
|
124
|
+
try {
|
|
125
|
+
for (var _b = __values(this._commandsByGroup), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
126
|
+
var group = _c.value;
|
|
127
|
+
result = group.commandsByLocalName.get(cmdName);
|
|
128
|
+
if (result)
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
133
|
+
finally {
|
|
134
|
+
try {
|
|
135
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
136
|
+
}
|
|
137
|
+
finally { if (e_2) throw e_2.error; }
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Remove the command with the global and untranslated name `cmdGlobalName` from the `cmdGroupName`
|
|
143
|
+
* command group. Return true if successful. Return false if no command with the global and untranslated
|
|
144
|
+
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
145
|
+
* @param cmdGroupName Input the name of the command group containing the command to be removed
|
|
146
|
+
* @param cmdGlobalName Input the command name which is to be removed from cmdGroupName
|
|
147
|
+
* @returns Return true if successful. Return false if no command with the global and untranslated
|
|
148
|
+
* name `cmdGlobalName` is found in the `cmdGroupName` command group.
|
|
149
|
+
*/
|
|
150
|
+
AcEdCommandStack.prototype.removeCmd = function (cmdGroupName, cmdGlobalName) {
|
|
151
|
+
var e_3, _a;
|
|
152
|
+
try {
|
|
153
|
+
for (var _b = __values(this._commandsByGroup), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
154
|
+
var group = _c.value;
|
|
155
|
+
if (group.groupName == cmdGroupName) {
|
|
156
|
+
return group.commandsByGlobalName.delete(cmdGlobalName);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
161
|
+
finally {
|
|
162
|
+
try {
|
|
163
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
164
|
+
}
|
|
165
|
+
finally { if (e_3) throw e_3.error; }
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Remove the command group with the name `GroupName` from the command stack and delete the command group
|
|
171
|
+
* dictionary object and all the AcEdCommand objects stored within it.
|
|
172
|
+
* @param groupName Input the name of the command group to be removed from the command stack.
|
|
173
|
+
* @returns Return true if successful. Return false if no command group is found with the name `GroupName`.
|
|
174
|
+
*/
|
|
175
|
+
AcEdCommandStack.prototype.removeGroup = function (groupName) {
|
|
176
|
+
var tmp = -1;
|
|
177
|
+
this._commandsByGroup.some(function (group, index) {
|
|
178
|
+
tmp = index;
|
|
179
|
+
return group.groupName == groupName;
|
|
180
|
+
});
|
|
181
|
+
if (tmp >= 0) {
|
|
182
|
+
this._commandsByGroup.splice(tmp, 1);
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
};
|
|
187
|
+
AcEdCommandStack.SYSTEMT_COMMAND_GROUP_NAME = 'ACAD';
|
|
188
|
+
AcEdCommandStack.DEFAUT_COMMAND_GROUP_NAME = 'USER';
|
|
189
|
+
return AcEdCommandStack;
|
|
190
|
+
}());
|
|
191
|
+
export { AcEdCommandStack };
|
|
192
|
+
//# sourceMappingURL=AcEdCommandStack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcEdCommandStack.js","sourceRoot":"","sources":["../../../src/editor/command/AcEdCommandStack.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAQ3D;;GAEG;AACH;IAQE;QACE,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAA;QAC1B,IAAI,CAAC,mBAAmB,GAAG;YACzB,SAAS,EAAE,gBAAgB,CAAC,0BAA0B;YACtD,oBAAoB,EAAE,IAAI,GAAG,EAAE;YAC/B,mBAAmB,EAAE,IAAI,GAAG,EAAE;SAC/B,CAAA;QACD,IAAI,CAAC,oBAAoB,GAAG;YAC1B,SAAS,EAAE,gBAAgB,CAAC,yBAAyB;YACrD,oBAAoB,EAAE,IAAI,GAAG,EAAE;YAC/B,mBAAmB,EAAE,IAAI,GAAG,EAAE;SAC/B,CAAA;QACD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;QACpD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IACvD,CAAC;IAED,sBAAW,4BAAQ;aAAnB;YACE,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC;gBAChC,gBAAgB,CAAC,SAAS,GAAG,IAAI,gBAAgB,EAAE,CAAA;YACrD,CAAC;YACD,OAAO,gBAAgB,CAAC,SAAS,CAAA;QACnC,CAAC;;;OAAA;IAED,qCAAU,GAAV,UACE,YAAoB,EACpB,aAAqB,EACrB,YAAoB,EACpB,GAAgB;QAEhB,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAA;QACH,CAAC;QACD,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,YAAY,GAAG,aAAa,CAAA;QAC9B,CAAC;QAED,IAAI,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAA;QAC5C,IAAI,YAAY,EAAE,CAAC;YACjB,IAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CACpC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,SAAS,IAAI,YAAY,EAA/B,CAA+B,CACzC,CAAA;YACD,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,YAAY,GAAG;oBACb,SAAS,EAAE,YAAY;oBACvB,oBAAoB,EAAE,IAAI,GAAG,EAAE;oBAC/B,mBAAmB,EAAE,IAAI,GAAG,EAAE;iBAC/B,CAAA;YACH,CAAC;iBAAM,CAAC;gBACN,YAAY,GAAG,GAAG,CAAA;YACpB,CAAC;QACH,CAAC;QACD,IAAI,YAAY,CAAC,oBAAoB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,KAAK,CACb,2DAAoD,aAAa,sBAAmB,CACrF,CAAA;QACH,CAAC;QACD,IAAI,YAAY,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CACb,0DAAmD,YAAY,sBAAmB,CACnF,CAAA;QACH,CAAC;QAED,YAAY,CAAC,oBAAoB,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAA;QACzD,YAAY,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;QACvD,GAAG,CAAC,UAAU,GAAG,aAAa,CAAA;QAC9B,GAAG,CAAC,SAAS,GAAG,YAAY,CAAA;IAC9B,CAAC;IAED;;;;;OAKG;IACH,mCAAQ,GAAR;QACE,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IACvD,CAAC;IAED;;;;;;;;OAQG;IACH,0CAAe,GAAf,UAAgB,OAAe;;QAC7B,IAAI,MAAM,GAA4B,SAAS,CAAA;;YAC/C,KAAoB,IAAA,KAAA,SAAA,IAAI,CAAC,gBAAgB,CAAA,gBAAA,4BAAE,CAAC;gBAAvC,IAAM,KAAK,WAAA;gBACd,MAAM,GAAG,KAAK,CAAC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;gBAChD,IAAI,MAAM;oBAAE,MAAK;YACnB,CAAC;;;;;;;;;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,yCAAc,GAAd,UAAe,OAAe;;QAC5B,IAAI,MAAM,GAA4B,SAAS,CAAA;;YAC/C,KAAoB,IAAA,KAAA,SAAA,IAAI,CAAC,gBAAgB,CAAA,gBAAA,4BAAE,CAAC;gBAAvC,IAAM,KAAK,WAAA;gBACd,MAAM,GAAG,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;gBAC/C,IAAI,MAAM;oBAAE,MAAK;YACnB,CAAC;;;;;;;;;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,oCAAS,GAAT,UAAU,YAAoB,EAAE,aAAqB;;;YACnD,KAAoB,IAAA,KAAA,SAAA,IAAI,CAAC,gBAAgB,CAAA,gBAAA,4BAAE,CAAC;gBAAvC,IAAM,KAAK,WAAA;gBACd,IAAI,KAAK,CAAC,SAAS,IAAI,YAAY,EAAE,CAAC;oBACpC,OAAO,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;gBACzD,CAAC;YACH,CAAC;;;;;;;;;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;;OAKG;IACH,sCAAW,GAAX,UAAY,SAAiB;QAC3B,IAAI,GAAG,GAAG,CAAC,CAAC,CAAA;QACZ,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAC,KAAK,EAAE,KAAK;YACtC,GAAG,GAAG,KAAK,CAAA;YACX,OAAO,KAAK,CAAC,SAAS,IAAI,SAAS,CAAA;QACrC,CAAC,CAAC,CAAA;QACF,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;YACpC,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IA9JM,2CAA0B,GAAG,MAAM,CAAA;IACnC,0CAAyB,GAAG,MAAM,CAAA;IA8J3C,uBAAC;CAAA,AAhKD,IAgKC;SAhKY,gBAAgB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/editor/command/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA"}
|