mxdraw 0.1.16 → 0.1.21

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.
Files changed (88) hide show
  1. package/dist/lib/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js +128 -1
  2. package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js +5 -1
  3. package/dist/lib/MxModule/McGeVector3d/McGeVector3d.js +2 -1
  4. package/dist/lib/MxModule/McGeVector3d/index.js +3 -1
  5. package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js +3 -1
  6. package/dist/lib/MxModule/McGiWorldDraw/index.js +2 -1
  7. package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js +19 -1
  8. package/dist/lib/MxModule/McGiWorldDrawType/index.js +4 -1
  9. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js +31 -1
  10. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js +5 -1
  11. package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js +159 -1
  12. package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js +5 -1
  13. package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +213 -1
  14. package/dist/lib/MxModule/MxDbAlignedDimension/index.js +5 -1
  15. package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +258 -1
  16. package/dist/lib/MxModule/MxDbEntity/index.js +5 -1
  17. package/dist/lib/MxModule/MxDbImage/MxDbImage.js +160 -1
  18. package/dist/lib/MxModule/MxDbImage/index.js +5 -1
  19. package/dist/lib/MxModule/MxDbLine/MxDbLine.js +94 -1
  20. package/dist/lib/MxModule/MxDbLine/index.js +5 -1
  21. package/dist/lib/MxModule/MxDbPolyline/MxDbPolyline.js +97 -0
  22. package/dist/lib/MxModule/MxDbPolyline/index.js +5 -0
  23. package/dist/lib/MxModule/MxDbRect/MxDbRect.js +273 -1
  24. package/dist/lib/MxModule/MxDbRect/index.js +4 -1
  25. package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +419 -1
  26. package/dist/lib/MxModule/MxDbSVG/index.js +5 -1
  27. package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +21 -1
  28. package/dist/lib/MxModule/MxDbSVGText/index.js +5 -1
  29. package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +782 -1
  30. package/dist/lib/MxModule/MxDrawObject/index.js +5 -1
  31. package/dist/lib/MxModule/MxFilters/MxFilters.js +201 -1
  32. package/dist/lib/MxModule/MxFilters/index.js +4 -1
  33. package/dist/lib/MxModule/MxFun/MxFun.js +676 -1
  34. package/dist/lib/MxModule/MxFun/index.js +4 -1
  35. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +283 -1
  36. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +146 -1
  37. package/dist/lib/MxModule/MxThreeJS/SVGLoader.js +1862 -1
  38. package/dist/lib/MxModule/MxThreeJS/index.js +7 -1
  39. package/dist/lib/MxModule/MxType/MxType.js +27 -1
  40. package/dist/lib/MxModule/MxType/index.js +4 -1
  41. package/dist/lib/MxModule/Mxassembly/Mxassembly.js +20 -1
  42. package/dist/lib/MxModule/Mxassembly/index.js +9 -1
  43. package/dist/lib/MxModule/loadCoreCode/index.js +5 -1
  44. package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +125 -1
  45. package/dist/lib/MxModule/loadCoreCode/mxUiData.js +312 -1
  46. package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1519 -1
  47. package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +7363 -1
  48. package/dist/lib/MxModule/store/PubsubClass.js +40 -1
  49. package/dist/lib/MxModule/store/StoreClass.js +73 -1
  50. package/dist/lib/MxModule/store/index.js +19 -1
  51. package/dist/lib/MxModule/store/store.js +25 -1
  52. package/dist/lib/MxModule/useCanvasResizeListener/index.js +5 -1
  53. package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js +95 -1
  54. package/dist/lib/doc.js +38 -1
  55. package/dist/lib/mxdraw.js +67 -1
  56. package/dist/lib/tools/algorithm/math.js +16 -1
  57. package/dist/lib/tools/algorithm/random.js +13 -1
  58. package/dist/lib/tools/dom/create.js +47 -1
  59. package/dist/lib/tools/dynamicImport/index.js +243 -1
  60. package/dist/lib/tools/formatting/index.js +20 -1
  61. package/dist/lib/tools/proxy/index.js +17 -1
  62. package/dist/lib/tools/three/index.js +124 -1
  63. package/dist/lib/types/McEdGetPointWorldDrawObject.js +2 -1
  64. package/dist/lib/types/MrxDbgUiPrPoint.js +2 -1
  65. package/dist/lib/types/MxCADObject.js +2 -1
  66. package/dist/lib/types/MxDrawObject.js +2 -1
  67. package/dist/lib/types/MxFun.js +2 -1
  68. package/dist/lib/types/Mxassembly.js +2 -1
  69. package/dist/types/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.d.ts +1 -0
  70. package/dist/types/MxModule/McGiWorldDraw/McGiWorldDraw.d.ts +1 -0
  71. package/dist/types/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.d.ts +2 -1
  72. package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +1 -0
  73. package/dist/types/MxModule/MxDbLine/MxDbLine.d.ts +2 -2
  74. package/dist/types/MxModule/MxDbPolyline/MxDbPolyline.d.ts +21 -0
  75. package/dist/types/MxModule/MxDbPolyline/index.d.ts +3 -0
  76. package/dist/types/MxModule/MxDbSVG/MxDbSVG.d.ts +1 -0
  77. package/dist/types/MxModule/MxDbSVGText/MxDbSVGText.d.ts +1 -0
  78. package/dist/types/MxModule/MxFun/MxFun.d.ts +7 -2
  79. package/dist/types/MxModule/MxThreeJS/MxThreeJS.d.ts +2 -0
  80. package/dist/types/MxModule/MxType/MxType.d.ts +1 -0
  81. package/dist/types/MxModule/loadCoreCode/mxUiData.d.ts +3 -3
  82. package/dist/types/MxModule/store/StoreClass.d.ts +10 -4
  83. package/dist/types/MxModule/store/store.d.ts +2 -2
  84. package/dist/types/mxdraw.d.ts +9 -2
  85. package/dist/types/types/MxFun.d.ts +6 -0
  86. package/package.json +1 -1
  87. package/dist/mxdraw.es5.js +0 -1
  88. package/dist/mxdraw.umd.js +0 -1
@@ -1 +1,7 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxThreeJS_mixin_1=require("./MxThreeJS.mixin"),MxThreeJS_1=require("./MxThreeJS"),MxThreeJS=new MxThreeJS_1.default;(0,MxThreeJS_mixin_1.default)(MxThreeJS),exports.default=MxThreeJS;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var MxThreeJS_mixin_1 = require("./MxThreeJS.mixin");
4
+ var MxThreeJS_1 = require("./MxThreeJS");
5
+ var MxThreeJS = new MxThreeJS_1.default();
6
+ (0, MxThreeJS_mixin_1.default)(MxThreeJS);
7
+ exports.default = MxThreeJS;
@@ -1 +1,27 @@
1
- "use strict";var MxCloneType,MxCloneType2;Object.defineProperty(exports,"__esModule",{value:!0}),function(e){e[e.kClone=1]="kClone",e[e.kDragClone=2]="kDragClone"}(MxCloneType||(MxCloneType={})),function(e){e[e.kClone=1]="kClone",e[e.kDragClone=2]="kDragClone"}(MxCloneType2||(MxCloneType2={})),exports.default={MxCloneType:MxCloneType,MxCloneType2:MxCloneType2};
1
+ "use strict";
2
+ /** @module MxType*/
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /**
5
+ * 动态绘制类型
6
+ * @example ```typescript
7
+
8
+ * ```
9
+ */
10
+ var MxCloneType;
11
+ (function (MxCloneType) {
12
+ /** 正常Clone */
13
+ MxCloneType[MxCloneType["kClone"] = 1] = "kClone";
14
+ /** 动态拖动Clone */
15
+ MxCloneType[MxCloneType["kDragClone"] = 2] = "kDragClone";
16
+ })(MxCloneType || (MxCloneType = {}));
17
+ var MxCloneType2;
18
+ (function (MxCloneType2) {
19
+ /** 正常Clone */
20
+ MxCloneType2[MxCloneType2["kClone"] = 1] = "kClone";
21
+ /** 动态拖动Clone */
22
+ MxCloneType2[MxCloneType2["kDragClone"] = 2] = "kDragClone";
23
+ })(MxCloneType2 || (MxCloneType2 = {}));
24
+ exports.default = {
25
+ MxCloneType: MxCloneType,
26
+ MxCloneType2: MxCloneType2
27
+ };
@@ -1 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxType_1=require("./MxType");exports.default=MxType_1.default;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var MxType_1 = require("./MxType");
4
+ exports.default = MxType_1.default;
@@ -1 +1,20 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var store_1=require("../store/store"),Mxassembly=function(){function e(){}return e.prototype.NewMcGeVector3d=function(){return new store_1.default.state.Mxassembly.McGeVector3d},e}();exports.default=Mxassembly;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** @module Mxassembly */
4
+ var store_1 = require("../store/store");
5
+ /**
6
+ * Mxassembly 模块
7
+ * 导出库时已实例化,只需要调用实例方法 例如:
8
+ * ```typescript
9
+ * ```
10
+ */
11
+ var Mxassembly = /** @class */ (function () {
12
+ function Mxassembly() {
13
+ }
14
+ Mxassembly.prototype.NewMcGeVector3d = function () {
15
+ var _a;
16
+ return (_a = new store_1.default.state.Mxassembly) === null || _a === void 0 ? void 0 : _a.McGeVector3d();
17
+ };
18
+ return Mxassembly;
19
+ }());
20
+ exports.default = Mxassembly;
@@ -1 +1,9 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Mxassembly_1=require("./Mxassembly");exports.default=new Mxassembly_1.default;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Mxassembly_1 = require("./Mxassembly");
4
+ // import store from '../store/_index'
5
+ // import loadCoreCode from '../loadCoreCode'
6
+ // if (!store.state.MxFUn) {
7
+ // loadCoreCode()
8
+ // }
9
+ exports.default = new Mxassembly_1.default();
@@ -1 +1,5 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var loadCoreCode_1=require("./loadCoreCode");exports.default=loadCoreCode_1.default;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** @module loadCoreCode */
4
+ var loadCoreCode_1 = require("./loadCoreCode");
5
+ exports.default = loadCoreCode_1.default;
@@ -1 +1,125 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,u)}s((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};Object.defineProperty(exports,"__esModule",{value:!0});var dynamicImport_1=require("../../tools/dynamicImport"),store_1=require("../store/store"),mxfun_es5_js_1=require("./mxfun.es5.js"),mxcadassembly_es5_js_1=require("./mxcadassembly_es5.js");function rxInitMxEntity(){store_1.default.state.MxFun.initDynamicCreate(dynamicImport_1.dynamicCreateMxObject)}function loadCoreCode(){return __awaiter(this,void 0,void 0,function(){var e=this;return __generator(this,function(t){return[2,new Promise(function(t,n){return __awaiter(e,void 0,void 0,function(){var e,r,o;return __generator(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),store_1.default.state.MxFun?(console.error("内部已调用loadCoreCode, 无需重复调用!"),[2,n({code:"error",msg:"内部已调用loadCoreCode, 无需重复调用"})]):(e=window,r=window,[4,(0,dynamicImport_1.dynamicImport)("jquery")]);case 1:return e.$=r.jQuery=i.sent(),window.MxDocumentReady=void 0,window.MxUiMain=function(e){var t=e("./MxFun").MxFun;store_1.default.commit("setMxFun",t),store_1.default.events.emit("MxUiMain",e),window.MxUiMain=void 0},window.MxMain=function(e){return store_1.default.events.emit("MxMain",e),window.MxMain=void 0,rxInitMxEntity(),t(),0},(0,mxcadassembly_es5_js_1.default)().then(function(e){store_1.default.commit("setMxassembly",e)}),(0,mxfun_es5_js_1.default)(),[3,3];case 2:return o=i.sent(),n({code:"error",msg:o}),[3,3];case 3:return[2]}})})})]})})}exports.default=loadCoreCode;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ /** @module loadCoreCode */
40
+ var dynamicImport_1 = require("../../tools/dynamicImport");
41
+ var store_1 = require("../store");
42
+ var mxfun_es5_js_1 = require("./mxfun.es5.js");
43
+ var mxcadassembly_es5_js_1 = require("./mxcadassembly_es5.js");
44
+ function rxInitMxEntity() {
45
+ var _a;
46
+ /*
47
+ new MxDbImage().rxInit()
48
+ new MxDbSVG().rxInit()
49
+ new MxDbAlignedDimension().rxInit()
50
+ new MxDbLine().rxInit()
51
+ new MxDbRect().rxInit()
52
+ */
53
+ (_a = store_1.default.state.MxFun) === null || _a === void 0 ? void 0 : _a.initDynamicCreate(dynamicImport_1.dynamicCreateMxObject);
54
+ }
55
+ /**
56
+ * 加载MxDraw库的核心代码 才能使用Mx的其他模块
57
+ * @returns Promise<{@link MxFun}>
58
+ * @example
59
+ * ```
60
+ * Mx.loadCoreCode().then(()=> console.log("加载完成", Mx.MxFun))
61
+ * ```
62
+ */
63
+ function loadCoreCode() {
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ var _this = this;
66
+ return __generator(this, function (_a) {
67
+ return [2 /*return*/, new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
68
+ var _a, _b, e_1;
69
+ return __generator(this, function (_c) {
70
+ switch (_c.label) {
71
+ case 0:
72
+ _c.trys.push([0, 2, , 3]);
73
+ if (store_1.default.state.MxFun) {
74
+ console.error('内部已调用loadCoreCode, 无需重复调用!');
75
+ return [2 /*return*/, rej({
76
+ code: 'error',
77
+ msg: '内部已调用loadCoreCode, 无需重复调用'
78
+ })];
79
+ }
80
+ _a = window;
81
+ _b = window;
82
+ return [4 /*yield*/, (0, dynamicImport_1.dynamicImport)('jquery')];
83
+ case 1:
84
+ _a.$ = _b.jQuery = _c.sent();
85
+ window.MxDocumentReady = undefined;
86
+ window.MxUiMain = function (requireFun) {
87
+ var MxFun = requireFun('./MxFun').MxFun;
88
+ store_1.default.commit('setMxFun', MxFun);
89
+ store_1.default.events.emit('MxUiMain', requireFun);
90
+ window.MxUiMain = undefined;
91
+ };
92
+ // 与MxMain有冲突(执行顺序有问题)
93
+ // window.MxDocumentReady = (requireFun: (path: string) => RequireFunReturnObjectType, mxinit: () => void) => {
94
+ // store.events.emit("MxDocumentReady", requireFun, mxinit)
95
+ // mxinit()
96
+ // }
97
+ window.MxMain = function (requireFun) {
98
+ store_1.default.events.emit('MxMain', requireFun);
99
+ window.MxMain = undefined;
100
+ rxInitMxEntity();
101
+ res();
102
+ return 0;
103
+ };
104
+ (0, mxcadassembly_es5_js_1.default)().then(function (mxassembly) {
105
+ //console.log(mxassembly);
106
+ store_1.default.commit('setMxassembly', mxassembly);
107
+ });
108
+ // 加载mxfun.min.js,mxfun()相当直接模拟了mxfun.min.js的加载。
109
+ (0, mxfun_es5_js_1.default)();
110
+ return [3 /*break*/, 3];
111
+ case 2:
112
+ e_1 = _c.sent();
113
+ rej({
114
+ code: 'error',
115
+ msg: e_1
116
+ });
117
+ return [3 /*break*/, 3];
118
+ case 3: return [2 /*return*/];
119
+ }
120
+ });
121
+ }); })];
122
+ });
123
+ });
124
+ }
125
+ exports.default = loadCoreCode;
@@ -1 +1,312 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MxVueInterface=void 0;var MxVueComandLine=function(){function t(){var t=this;this.msCmdText="",this.msCmdDisplay="",this.msCmdTip="",this.mUpDisplayFun=void 0,this.mxFunObject=void 0,this.mountUpDisplayFun=function(n){t.mUpDisplayFun=n},this.setCmdText=function(n){t.msCmdText=n},this.getCmdText=function(){return t.msCmdText},this.getCmdDisplay=function(){return t.msCmdDisplay},this.setCmdDisplay=function(n){t.msCmdDisplay=n},this.addCmdDisplay=function(n){t.msCmdDisplay.length>1024?(t.msCmdDisplay=t.msCmdDisplay.substring(t.msCmdDisplay.length-1024,t.msCmdDisplay.length),t.msCmdDisplay=t.msCmdDisplay+n):t.msCmdDisplay=t.msCmdDisplay+n},this.setCmdTip=function(n){t.msCmdTip=n},this.getCmdTip=function(){return t.msCmdTip}}return t.prototype.upDisplay=function(){var t=this.msCmdTip,n=this.msCmdDisplay,e=this.msCmdText;void 0!=this.mUpDisplayFun&&this.mUpDisplayFun({msCmdTip:t,msCmdDisplay:n,msCmdText:e})},t}(),MxInputType={kNoInput:0,kXYCoordInput:1,kDistanceInput:2,kDynTip:3},MxInputPostionType={kRelative:0,kAbsolutely:1},MxDynamicInput=function(){return function(){var t=this;this.mType=MxInputType.kNoInput,this.mPos=[0,0],this.mTip="",this.mValue1="",this.mValue1Pos=[0,0],this.mValue2="",this.mValue2Pos=[0,0],this.misShow=!1,this.mOnKeydownEvent=void 0,this.mFocusValue="",this.setFocusValue=function(n){t.mFocusValue=n},this.getFocusValue=function(){return t.mFocusValue},this.mountKeydownEvent=function(n){t.mOnKeydownEvent=n},this.onKeydown=function(n){void 0!=t.mOnKeydownEvent&&t.mOnKeydownEvent(n)},this.setType=function(n){t.mType=n},this.getType=function(){return t.mType},this.isShow=function(){return t.misShow},this.setPos=function(n){t.mPos=n},this.setTip=function(n){t.mTip=n},this.setValue1=function(n){t.mValue1=n},this.getValue1=function(){return t.mValue1},this.setValue1Pos=function(n){t.mValue1Pos=n},this.setValue2=function(n){t.mValue2=n},this.getValue2=function(){return t.mValue2},this.setValue2Pos=function(n){t.mValue2Pos=n},this.setShow=function(n){t.misShow=n},this.getData=function(){if(t.misShow){var n={list:[{value:"",readonly:!0},{value:"",readonly:!1},{value:"",readonly:!1}],pos:t.mPos,postype:MxInputPostionType.kRelative};if(t.mType!=MxInputType.kNoInput)return t.mType==MxInputType.kXYCoordInput?(n.list[0].show=!0,n.list[0].value=t.mTip,n.list[0].readonly=!0,n.list[1].show=!0,n.list[1].value=t.mValue1,n.list[1].readonly=!1,n.list[2].show=!0,n.list[2].value=t.mValue2,n.list[2].readonly=!1):t.mType==MxInputType.kDistanceInput?(n.list[0].show=!0,n.list[0].value=t.mTip,n.list[0].readonly=!0,n.list[1].show=!0,n.list[1].value=t.mValue1,n.list[1].readonly=!1,n.list[1].pos=t.mValue1Pos,n.list[2].show=!0,n.list[2].value=t.mValue2,n.list[2].readonly=!0,n.list[2].pos=t.mValue2Pos,n.postype=MxInputPostionType.kAbsolutely):t.mType==MxInputType.kDynTip?(n.list[0].show=!0,n.list[0].value=t.mTip,n.list[0].readonly=!0,n.list[1].show=!1,n.list[2].show=!1):n=void 0,n}}}}(),CursorType={kNormal:"cursor3",kRect:"cursor1",kCross:"cursor2"},MxVueInterface=function(){return function(){var t=this;this.mSetCoordFun=void 0,this.mUpdateCursorFun=void 0,this.mOnKeydownEvent=void 0,this.mCursorType=CursorType.kNormal,this.mComandLine=new MxVueComandLine,this.mdynamicInput=new MxDynamicInput,this.mMxEvents={},this.mountSetCoordFun=function(n){t.mSetCoordFun=n},this.mountUpdateCursorFun=function(n){t.mUpdateCursorFun=n},this.mountKeydownEvent=function(n){t.mOnKeydownEvent=n},this.onKeydown=function(n){void 0!=t.mOnKeydownEvent&&t.mOnKeydownEvent(n)},this.setTipCoord=function(n){void 0!=t.mSetCoordFun&&t.mSetCoordFun(n)},this.getCursorType=function(){return t.mCursorType},this.setCursorType=function(n){if("number"==typeof n)switch(n){case 0:t.mCursorType=CursorType.kNormal;break;case 1:t.mCursorType=CursorType.kRect;break;case 2:t.mCursorType=CursorType.kCross}else t.mCursorType=n;void 0!=t.mUpdateCursorFun&&t.mUpdateCursorFun()},this.getTitle=function(){return t.mTitle},this.getTopButtonBarData=function(){return t.mTopButtonBarData},this.getMenuBarData=function(){return t.mMenuBarData},this.getRighButtonBarData=function(){return t.mRighButtonBarData},this.getLeftButtonBarData=function(){return t.mLeftButtonBarData},this.getTitleButtonBarData=function(){return t.mTitleButtonBarData},this.getLayerComboxData=function(){return t.mLayerComboxData},this.getColorComboxData=function(){return t.mColorComboxData},this.getLinetypeComboxData=function(){return t.mLinetypeComboxData},this.getFooterData=function(){return t.mFooterData},this.sendStringToExecute=function(n){t.mxFunObject.sendStringToExecute(n)},this.getCmdLine=function(){return t.mComandLine},this.getDynamicInput=function(){return t.mdynamicInput},this.init=function(n){t.mxFunObject=n},this.OnMxEvent=function(n){var e=n.name;if(void 0!=e){var i=t.mMxEvents[e];void 0!=i&&i(n.param)}},this.mountMxEvent=function(n,e){t.mMxEvents[n]=e}}}();exports.MxVueInterface=MxVueInterface,exports.default=new MxVueInterface;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MxVueInterface = void 0;
4
+ var MxVueComandLine = /** @class */ (function () {
5
+ function MxVueComandLine() {
6
+ var _this = this;
7
+ // 命令行
8
+ this.msCmdText = '';
9
+ this.msCmdDisplay = '';
10
+ this.msCmdTip = '';
11
+ this.mUpDisplayFun = undefined;
12
+ this.mxFunObject = undefined;
13
+ // 命令行更新
14
+ this.mountUpDisplayFun = function (fun) {
15
+ _this.mUpDisplayFun = fun;
16
+ };
17
+ this.setCmdText = function (str) {
18
+ _this.msCmdText = str;
19
+ };
20
+ this.getCmdText = function () {
21
+ return _this.msCmdText;
22
+ };
23
+ this.getCmdDisplay = function () {
24
+ return _this.msCmdDisplay;
25
+ };
26
+ this.setCmdDisplay = function (str) {
27
+ _this.msCmdDisplay = str;
28
+ };
29
+ this.addCmdDisplay = function (str) {
30
+ if (_this.msCmdDisplay.length > 1024) {
31
+ _this.msCmdDisplay = _this.msCmdDisplay.substring(_this.msCmdDisplay.length - 1024, _this.msCmdDisplay.length);
32
+ _this.msCmdDisplay = _this.msCmdDisplay + str;
33
+ }
34
+ else {
35
+ _this.msCmdDisplay = _this.msCmdDisplay + str;
36
+ }
37
+ };
38
+ this.setCmdTip = function (str) {
39
+ _this.msCmdTip = str;
40
+ };
41
+ this.getCmdTip = function () {
42
+ return _this.msCmdTip;
43
+ };
44
+ }
45
+ MxVueComandLine.prototype.upDisplay = function () {
46
+ var _a = this, msCmdTip = _a.msCmdTip, msCmdDisplay = _a.msCmdDisplay, msCmdText = _a.msCmdText;
47
+ if (this.mUpDisplayFun == undefined) {
48
+ return;
49
+ }
50
+ this.mUpDisplayFun({
51
+ msCmdTip: msCmdTip,
52
+ msCmdDisplay: msCmdDisplay,
53
+ msCmdText: msCmdText
54
+ });
55
+ };
56
+ return MxVueComandLine;
57
+ }());
58
+ var MxInputType = {
59
+ kNoInput: 0,
60
+ kXYCoordInput: 1,
61
+ kDistanceInput: 2,
62
+ kDynTip: 3
63
+ };
64
+ var MxInputPostionType = {
65
+ kRelative: 0,
66
+ kAbsolutely: 1 // 绝对位置,指定位置。
67
+ };
68
+ var MxDynamicInput = /** @class */ (function () {
69
+ function MxDynamicInput() {
70
+ var _this = this;
71
+ this.mType = MxInputType.kNoInput;
72
+ this.mPos = [0, 0];
73
+ this.mTip = '';
74
+ this.mValue1 = '';
75
+ this.mValue1Pos = [0, 0];
76
+ this.mValue2 = '';
77
+ this.mValue2Pos = [0, 0];
78
+ this.misShow = false;
79
+ this.mOnKeydownEvent = undefined;
80
+ this.mFocusValue = '';
81
+ this.setFocusValue = function (value) {
82
+ _this.mFocusValue = value;
83
+ };
84
+ this.getFocusValue = function () {
85
+ return _this.mFocusValue;
86
+ };
87
+ this.mountKeydownEvent = function (fun) {
88
+ _this.mOnKeydownEvent = fun;
89
+ };
90
+ this.onKeydown = function (keyCode) {
91
+ if (_this.mOnKeydownEvent == undefined) {
92
+ return;
93
+ }
94
+ _this.mOnKeydownEvent(keyCode);
95
+ };
96
+ this.setType = function (type) {
97
+ _this.mType = type;
98
+ };
99
+ this.getType = function () {
100
+ return _this.mType;
101
+ };
102
+ this.isShow = function () {
103
+ return _this.misShow;
104
+ };
105
+ this.setPos = function (pos) {
106
+ _this.mPos = pos;
107
+ };
108
+ this.setTip = function (tip) {
109
+ _this.mTip = tip;
110
+ };
111
+ this.setValue1 = function (val) {
112
+ _this.mValue1 = val;
113
+ };
114
+ this.getValue1 = function () {
115
+ return _this.mValue1;
116
+ };
117
+ this.setValue1Pos = function (pos) {
118
+ _this.mValue1Pos = pos;
119
+ };
120
+ this.setValue2 = function (val) {
121
+ _this.mValue2 = val;
122
+ };
123
+ this.getValue2 = function () {
124
+ return _this.mValue2;
125
+ };
126
+ this.setValue2Pos = function (pos) {
127
+ _this.mValue2Pos = pos;
128
+ };
129
+ this.setShow = function (isShow) {
130
+ _this.misShow = isShow;
131
+ };
132
+ this.getData = function () {
133
+ if (!_this.misShow) {
134
+ return undefined;
135
+ }
136
+ var ret = {
137
+ list: [
138
+ { value: '', readonly: true },
139
+ { value: '', readonly: false },
140
+ { value: '', readonly: false }
141
+ ],
142
+ pos: _this.mPos,
143
+ postype: MxInputPostionType.kRelative
144
+ };
145
+ if (_this.mType == MxInputType.kNoInput) {
146
+ return undefined;
147
+ }
148
+ else if (_this.mType == MxInputType.kXYCoordInput) {
149
+ ret.list[0].show = true;
150
+ ret.list[0].value = _this.mTip;
151
+ ret.list[0].readonly = true;
152
+ ret.list[1].show = true;
153
+ ret.list[1].value = _this.mValue1;
154
+ ret.list[1].readonly = false;
155
+ ret.list[2].show = true;
156
+ ret.list[2].value = _this.mValue2;
157
+ ret.list[2].readonly = false;
158
+ }
159
+ else if (_this.mType == MxInputType.kDistanceInput) {
160
+ ret.list[0].show = true;
161
+ ret.list[0].value = _this.mTip;
162
+ ret.list[0].readonly = true;
163
+ ret.list[1].show = true;
164
+ ret.list[1].value = _this.mValue1;
165
+ ret.list[1].readonly = false;
166
+ ret.list[1].pos = _this.mValue1Pos;
167
+ ret.list[2].show = true;
168
+ ret.list[2].value = _this.mValue2;
169
+ ret.list[2].readonly = true;
170
+ ret.list[2].pos = _this.mValue2Pos;
171
+ ret.postype = MxInputPostionType.kAbsolutely;
172
+ }
173
+ else if (_this.mType == MxInputType.kDynTip) {
174
+ ret.list[0].show = true;
175
+ ret.list[0].value = _this.mTip;
176
+ ret.list[0].readonly = true;
177
+ ret.list[1].show = false;
178
+ ret.list[2].show = false;
179
+ }
180
+ else {
181
+ ret = undefined;
182
+ }
183
+ return ret;
184
+ };
185
+ }
186
+ return MxDynamicInput;
187
+ }());
188
+ var CursorType = {
189
+ kNormal: 'cursor3',
190
+ kRect: 'cursor1',
191
+ kCross: 'cursor2'
192
+ };
193
+ var MxVueInterface = /** @class */ (function () {
194
+ function MxVueInterface() {
195
+ var _this = this;
196
+ this.mSetCoordFun = undefined;
197
+ this.mUpdateCursorFun = undefined;
198
+ this.mOnKeydownEvent = undefined;
199
+ this.mCursorType = CursorType.kNormal;
200
+ this.mComandLine = new MxVueComandLine();
201
+ this.mdynamicInput = new MxDynamicInput();
202
+ this.mMxEvents = {};
203
+ this.mountSetCoordFun = function (fun) {
204
+ _this.mSetCoordFun = fun;
205
+ };
206
+ this.mountUpdateCursorFun = function (fun) {
207
+ _this.mUpdateCursorFun = fun;
208
+ };
209
+ this.mountKeydownEvent = function (fun) {
210
+ _this.mOnKeydownEvent = fun;
211
+ };
212
+ this.onKeydown = function (keyCode) {
213
+ if (_this.mOnKeydownEvent == undefined) {
214
+ return;
215
+ }
216
+ _this.mOnKeydownEvent(keyCode);
217
+ };
218
+ this.setTipCoord = function (str) {
219
+ if (_this.mSetCoordFun == undefined) {
220
+ return;
221
+ }
222
+ _this.mSetCoordFun(str);
223
+ };
224
+ this.getCursorType = function () {
225
+ return _this.mCursorType;
226
+ };
227
+ this.setCursorType = function (curtype) {
228
+ if (typeof curtype == 'number') {
229
+ switch (curtype) {
230
+ case 0: {
231
+ _this.mCursorType = CursorType.kNormal;
232
+ break;
233
+ }
234
+ case 1: {
235
+ _this.mCursorType = CursorType.kRect;
236
+ break;
237
+ }
238
+ case 2: {
239
+ _this.mCursorType = CursorType.kCross;
240
+ break;
241
+ }
242
+ }
243
+ }
244
+ else {
245
+ _this.mCursorType = curtype;
246
+ }
247
+ if (_this.mUpdateCursorFun == undefined) {
248
+ return;
249
+ }
250
+ _this.mUpdateCursorFun();
251
+ };
252
+ this.getTitle = function () {
253
+ return _this.mTitle;
254
+ };
255
+ this.getTopButtonBarData = function () {
256
+ return _this.mTopButtonBarData;
257
+ };
258
+ this.getMenuBarData = function () {
259
+ return _this.mMenuBarData;
260
+ };
261
+ this.getRighButtonBarData = function () {
262
+ return _this.mRighButtonBarData;
263
+ };
264
+ this.getLeftButtonBarData = function () {
265
+ return _this.mLeftButtonBarData;
266
+ };
267
+ this.getTitleButtonBarData = function () {
268
+ return _this.mTitleButtonBarData;
269
+ };
270
+ this.getLayerComboxData = function () {
271
+ return _this.mLayerComboxData;
272
+ };
273
+ this.getColorComboxData = function () {
274
+ return _this.mColorComboxData;
275
+ };
276
+ this.getLinetypeComboxData = function () {
277
+ return _this.mLinetypeComboxData;
278
+ };
279
+ this.getFooterData = function () {
280
+ return _this.mFooterData;
281
+ };
282
+ this.sendStringToExecute = function (sCmd) {
283
+ _this.mxFunObject.sendStringToExecute(sCmd);
284
+ };
285
+ this.getCmdLine = function () {
286
+ return _this.mComandLine;
287
+ };
288
+ this.getDynamicInput = function () {
289
+ return _this.mdynamicInput;
290
+ };
291
+ this.init = function (mxFun) {
292
+ _this.mxFunObject = mxFun;
293
+ };
294
+ this.OnMxEvent = function (event) {
295
+ var eventName = event.name;
296
+ if (eventName == undefined) {
297
+ return;
298
+ }
299
+ var call = _this.mMxEvents[eventName];
300
+ if (call == undefined) {
301
+ return;
302
+ }
303
+ call(event.param);
304
+ };
305
+ this.mountMxEvent = function (name, call) {
306
+ _this.mMxEvents[name] = call;
307
+ };
308
+ }
309
+ return MxVueInterface;
310
+ }());
311
+ exports.MxVueInterface = MxVueInterface;
312
+ exports.default = new MxVueInterface();