mxdraw 0.1.60 → 0.1.63
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/lib/MxModule/MxCADObject/MxCADObject.js +1 -1
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +1 -1
- package/dist/lib/MxModule/MxFun/MxFun.js +1 -1
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +1 -1
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -1
- package/dist/mxdraw.es5.js +1 -1
- package/dist/mxdraw.umd.js +1 -1
- package/dist/types/MxModule/MxCADObject/MxCADObject.d.ts +21 -0
- package/dist/types/MxModule/MxDbSVG/MxDbSVG.d.ts +1 -0
- package/dist/types/MxModule/MxFun/MxFun.d.ts +7 -41
- package/dist/types/MxModule/MxThreeJS/MxThreeJS.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxCADObject=function(){function e(e){this._mxCAD=e}return e.prototype.newFile=function(){this._mxCAD.newFile()},e.prototype.openFile=function(e,t){this._mxCAD.openFile(e,t)},e.prototype.saveFile=function(e,t){this._mxCAD.saveFile(e,t)},e.prototype.getDisplayFromServer=function(){this._mxCAD.getDisplayFromServer()},e}();exports.default=MxCADObject;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxCADObject=function(){function e(e){this._mxCAD=e}return e.prototype.newFile=function(){this._mxCAD.newFile()},e.prototype.undo=function(){this._mxCAD.undo()},e.prototype.openFile=function(e,t){this._mxCAD.openFile(e,t)},e.prototype.saveFile=function(e,t){this._mxCAD.saveFile(e,t)},e.prototype.getDisplayFromServer=function(){this._mxCAD.getDisplayFromServer()},e.prototype.getFileName=function(){return this._mxCAD.getFileName()},e.prototype.getAllLayerData=function(){return this._mxCAD.getAllLayerData()},e}();exports.default=MxCADObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function s(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),__awaiter=this&&this.__awaiter||function(t,e,i,s){return new(i||(i=Promise))(function(o,r){function n(t){try{g(s.next(t))}catch(t){r(t)}}function a(t){try{g(s.throw(t))}catch(t){r(t)}}function g(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}g((s=s.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var i,s,o,r,n={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,s&&(o=2&r[0]?s.return:r[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,r[1])).done)return o;switch(s=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return n.label++,{value:r[1],done:!1};case 5:n.label++,s=r[1],r=[0];continue;case 7:r=n.ops.pop(),n.trys.pop();continue;default:if(!(o=(o=n.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){n=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){n.label=r[1];break}if(6===r[0]&&n.label<o[1]){n.label=o[1],o=r;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(r);break}o[2]&&n.ops.pop(),n.trys.pop();continue}r=e.call(t,n)}catch(t){r=[6,t],s=0}finally{i=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}};Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),MxDbEntity_1=require("../MxDbEntity"),MxDbSVGText_1=require("../MxDbSVGText"),MxThreeJS_1=require("../MxThreeJS"),MxType_1=require("../MxType"),MxDbSVG=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.svgPos=new THREE.Vector3,e.svg=null,e.svgPath="",e.svgSize=new THREE.Vector2(50,50),e.svgAlignmentRatio=new THREE.Vector2(0,0),e.svgRotate=0,e.svgReverse=!1,e.svgMirror=!1,e.svgMargin=new THREE.Vector2(0,0),e.isSvgDirtyLocation=!1,e.isLoadFromPath=!0,e.aryText=[],e.svgBoxSize=null,e.fixedSize=!1,e.useSvgColor=!1,e}return __extends(e,t),e.prototype.calcVewSize=function(t){var e=this.svgSize.x,i=this.svgSize.y;return i<=0&&(i=this.svgBoxSize?this.svgBoxSize.y/this.svgBoxSize.x*e:e),this.fixedSize&&(e=t.screenCoordLong2Doc(e),i=t.screenCoordLong2Doc(i)),[e,i]},e.prototype.worldDraw=function(t){var e=this,i=t.getMxObject();this.calcSvgPosition(i);var s=this.calcVewSize(i),o=s[0],r=s[1],n=new THREE.Matrix4;n.makeScale(this.svgMirror?-1:1,this.svgReverse?-1:1,1);var a=new THREE.Matrix4;a.makeRotationZ(this.svgRotate);var g=new THREE.Matrix4,c=new THREE.Vector3(this.svgPos.x-o*this.svgAlignmentRatio.x,this.svgPos.y-r*this.svgAlignmentRatio.y,0);g.makeTranslation(c.x,c.y,c.z),a.multiply(n),a.premultiply(g);var v=new THREE.Vector3(0,0,0),h=new THREE.Vector3(o,0,0),x=new THREE.Vector3(o,r,0),l=new THREE.Vector3(0,r,0);if(v.applyMatrix4(a),h.applyMatrix4(a),x.applyMatrix4(a),l.applyMatrix4(a),1==t.getType()){if(this.aryText.forEach(function(s){if(s.txt.length>0){var o=new THREE.Vector3(s.txtPos.x,s.txtPos.y,0);e.fixedSize&&(s.txtPos.x>0?o.x=e.svgPos.x+i.screenCoordLong2Doc(s.txtPos.x):o.x=e.svgPos.x-i.screenCoordLong2Doc(s.txtPos.x),s.txtPos.y>0?o.y=e.svgPos.y+i.screenCoordLong2Doc(s.txtPos.y):o.y=e.svgPos.y-i.screenCoordLong2Doc(s.txtPos.y));var r=void 0;s.color&&(r=t.getColor(),t.setColor(s.color));var n=s.txtHeight;e.fixedSize&&(n=i.screenCoordLong2Doc(s.txtHeight)),s._txtObject=t.drawText(s.txt,n,0,o),s._txtAspectRatio=-1,r&&t.setColor(r)}}),this.svg)t.drawEntity(this.svg);else if(this.svgPath.length>0&&this.isLoadFromPath){var u=this,p=t.getMxObject();MxThreeJS_1.default.loadSVG(this.svgPath,void 0,function(e){if(e){var s=e;if(s.boxSize)u.svgBoxSize=s.boxSize.clone();else{var o=(new THREE.Box3).setFromObject(e);u.svgBoxSize||(u.svgBoxSize=new THREE.Vector3),u.svgBoxSize.x=o.max.x-o.min.x,u.svgBoxSize.y=o.max.y-o.min.y}var r=u.calcVewSize(i),n=r[0],a=r[1];u.svgBoxSize&&(e.scale.x=n/u.svgBoxSize.x,e.scale.y=a/u.svgBoxSize.y),e.scale.z=e.scale.x,u.svgReverse&&(e.scale.y*=-1),u.svgMirror&&(e.scale.x*=-1),e.rotateZ(u.svgRotate),u.isSvgDirtyLocation=!0;var g=new THREE.Color(t.getColor());e.traverse(function(t){t.material&&(t.material=t.material.clone(),t.material.transparent=!0,t.material.depthTest=!1,u.useSvgColor||(t.material.color=g))}),u.svg=e,u.setNeedUpdateDisplay(),p.updateDisplay()}else console.log("mx LoadSVG:"+u.svgPath+" failed");u.isLoadFromPath=!1})}t.drawSelectLine(v,x),t.drawSelectLine(h,l),t.drawSelectLine(v,h),t.drawSelectLine(h,x),t.drawSelectLine(x,l),t.drawSelectLine(l,v)}else t.drawLine(v,h),t.drawLine(h,x),t.drawLine(x,l),t.drawLine(l,v)},e.prototype.setSvgPath=function(t,e){return void 0===e&&(e=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(i){switch(i.label){case 0:return this.svgPath=t,this.svg=null,this.isLoadFromPath=!0,this.svgBoxSize=null,e?[4,MxThreeJS_1.default.loadSVG(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.getSvgPath=function(){return this.svgPath},e.prototype.setSvgPostion=function(t){this.svgPos=t.clone(),this.isSvgDirtyLocation=!0},e.prototype.getSvgPostion=function(){return this.svgPos},e.prototype.setSvgSize=function(t){this.svgSize=t,this.isSvgDirtyLocation=!0},e.prototype.getSvgSize=function(){return this.svgSize},e.prototype.setSvgAlignmentRatio=function(t){this.svgAlignmentRatio=t,this.isSvgDirtyLocation=!0},e.prototype.getSvgAlignmentRatio=function(){return this.svgAlignmentRatio},e.prototype.getText=function(t){return t<this.aryText.length?this.aryText[t]:null},e.prototype.addText=function(t){this.aryText.push(t)},e.prototype.getGripPoints=function(){var t=[];return t.push(this.svgPos),t},e.prototype.moveGripPointsAt=function(t,e){return 0==t&&(this.svgPos.add(e),this.fixedSize||this.aryText.forEach(function(t){t.txtPos.add(e)})),this.isSvgDirtyLocation=!0,!0},e.prototype.calcSvgPosition=function(t){if(this.svg&&this.isSvgDirtyLocation){this.isSvgDirtyLocation=!1;var e=this.calcVewSize(t),i=e[0],s=e[1];this.svg.position.x=this.svgPos.x-i*this.svgAlignmentRatio.x-this.svgMargin.x*i,this.svg.position.y=this.svgPos.y-s*this.svgAlignmentRatio.y-this.svgMargin.y*s}},e.prototype.dwgIn=function(t){var e=this;this.onDwgIn(t),this.fixedSize=t.fixedSize,this.fixedSize?this.svg=null:t.type==MxType_1.default.MxCloneType.kClone&&t.svg&&(this.svg=t.svg.clone()),this.svgPos.copy(t.svgPos),this.svgPath=t.svgPath.substr(0),this.svgSize.copy(t.svgSize),this.svgAlignmentRatio.copy(t.svgAlignmentRatio),this.isSvgDirtyLocation=!0,this.svg||(this.isLoadFromPath=!0),this.svgBoxSize=null;var i=t.txts;return this.aryText=[],i.forEach(function(t){var i=new MxDbSVGText_1.default;i.txt=t.txt,i.txtHeight=t.txtHeight,i.txtPos.copy(t.txtPos),e.aryText.push(i)}),this.svgRotate=t.svgRotate,this.useSvgColor=t.useSvgColor,this.svgReverse=t.svgReverse,this.svgMirror=t.svgMirror,this.svgMargin=t.svgMargin,!0},e.prototype.dwgOut=function(t){return this.onDwgOut(t),t.type==MxType_1.default.MxCloneType.kClone&&(t.svg=this.svg),t.svgPath=this.svgPath,t.svgPos=this.svgPos,t.svgSize=this.svgSize,t.svgAlignmentRatio=this.svgAlignmentRatio,t.txts=[],this.aryText.forEach(function(e){var i={txtPos:e.txtPos,txt:e.txt,txtHeight:e.txtHeight,color:e.color,_txtAspectRatio:e._txtAspectRatio};t.txts.push(i)}),t.fixedSize=this.fixedSize,t.svgRotate=this.svgRotate,t.useSvgColor=this.useSvgColor,t.svgReverse=this.svgReverse,t.svgMirror=this.svgMirror,t.svgMargin=this.svgMargin,t},e.prototype.create=function(){return new e},e.prototype.transformBy=function(t){this.svgPos.applyMatrix4(t),this.isSvgDirtyLocation=!0,this.fixedSize||this.aryText.forEach(function(e){e.txtPos.applyMatrix4(t)})},e.prototype.getTypeName=function(){return"MxDbSVG"},e.prototype.setColor=function(e){if(t.prototype.setColor.call(this,e),this.svg){var i=new THREE.Color(this.color);this.svg.traverse(function(t){t.material&&(t.material.color=i)})}},e.prototype.setSvg=function(t){this.svg=t,this.isLoadFromPath=!1,this.svgBoxSize=null},e.prototype.calcSvgBoxSize=function(t){if(!this.svgBoxSize)if(t.boxSize)this.svgBoxSize=t.boxSize.clone();else{var e=(new THREE.Box3).setFromObject(t);this.svgBoxSize||(this.svgBoxSize=new THREE.Vector3),this.svgBoxSize.x=e.max.x-e.min.x,this.svgBoxSize.y=e.max.y-e.min.y}},e.prototype.reComputeSVG=function(){if(this.svg){var t=this.getMxObject();if(t){this.calcSvgBoxSize(this.svg);var e=this.calcVewSize(t),i=e[0],s=e[1];this.svgBoxSize&&(this.svg.scale.x=i/this.svgBoxSize.x,this.svg.scale.y=s/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}}},e.prototype.onViewChange=function(){if(!this.fixedSize)return!1;var t=this.getMxObject();if(null==t)return!1;if(this.svg){this.calcSvgBoxSize(this.svg);var e=this.calcVewSize(t),i=e[0],s=e[1];this.svgBoxSize&&(this.svg.scale.x=i/this.svgBoxSize.x,this.svg.scale.y=s/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}var o=this;return this.aryText.forEach(function(e){if(e._txtObject&&t){var i=t.screenCoordLong2Doc(e.txtHeight);i>1e-5&&(e._txtAspectRatio<=0&&(e._txtAspectRatio=e._txtObject.scale.x/e._txtObject.scale.y),e._txtObject.scale.set(e._txtAspectRatio*i,i,1),e.txtPos.x>0?e._txtObject.position.x=o.svgPos.x+t.screenCoordLong2Doc(e.txtPos.x):e._txtObject.position.x=o.svgPos.x-t.screenCoordLong2Doc(e.txtPos.x),e.txtPos.y>0?e._txtObject.position.y=o.svgPos.y+t.screenCoordLong2Doc(e.txtPos.y):e._txtObject.position.y=o.svgPos.y-t.screenCoordLong2Doc(e.txtPos.y),e._txtObject.updateMatrix())}}),!0},e}(MxDbEntity_1.default);exports.default=MxDbSVG;
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function s(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),__awaiter=this&&this.__awaiter||function(t,e,i,s){return new(i||(i=Promise))(function(o,r){function n(t){try{g(s.next(t))}catch(t){r(t)}}function a(t){try{g(s.throw(t))}catch(t){r(t)}}function g(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}g((s=s.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var i,s,o,r,n={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,s&&(o=2&r[0]?s.return:r[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,r[1])).done)return o;switch(s=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return n.label++,{value:r[1],done:!1};case 5:n.label++,s=r[1],r=[0];continue;case 7:r=n.ops.pop(),n.trys.pop();continue;default:if(!(o=(o=n.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){n=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){n.label=r[1];break}if(6===r[0]&&n.label<o[1]){n.label=o[1],o=r;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(r);break}o[2]&&n.ops.pop(),n.trys.pop();continue}r=e.call(t,n)}catch(t){r=[6,t],s=0}finally{i=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}};Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),MxDbEntity_1=require("../MxDbEntity"),MxDbSVGText_1=require("../MxDbSVGText"),MxThreeJS_1=require("../MxThreeJS"),MxType_1=require("../MxType"),MxDbSVG=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.svgPos=new THREE.Vector3,e.svg=null,e.svgPath="",e.svgSize=new THREE.Vector2(50,50),e.svgAlignmentRatio=new THREE.Vector2(0,0),e.svgRotate=0,e.svgReverse=!1,e.svgMirror=!1,e.svgChildColor=[],e.svgMargin=new THREE.Vector2(0,0),e.isSvgDirtyLocation=!1,e.isLoadFromPath=!0,e.aryText=[],e.svgBoxSize=null,e.fixedSize=!1,e.useSvgColor=!1,e}return __extends(e,t),e.prototype.calcVewSize=function(t){var e=this.svgSize.x,i=this.svgSize.y;return i<=0&&(i=this.svgBoxSize?this.svgBoxSize.y/this.svgBoxSize.x*e:e),this.fixedSize&&(e=t.screenCoordLong2Doc(e),i=t.screenCoordLong2Doc(i)),[e,i]},e.prototype.worldDraw=function(t){var e=this,i=t.getMxObject();this.calcSvgPosition(i);var s=this.calcVewSize(i),o=s[0],r=s[1],n=new THREE.Matrix4;n.makeScale(this.svgMirror?-1:1,this.svgReverse?-1:1,1);var a=new THREE.Matrix4;a.makeRotationZ(this.svgRotate);var g=new THREE.Matrix4,v=new THREE.Vector3(this.svgPos.x-o*this.svgAlignmentRatio.x,this.svgPos.y-r*this.svgAlignmentRatio.y,0);g.makeTranslation(v.x,v.y,v.z),a.multiply(n),a.premultiply(g);var c=new THREE.Vector3(0,0,0),h=new THREE.Vector3(o,0,0),l=new THREE.Vector3(o,r,0),x=new THREE.Vector3(0,r,0);if(c.applyMatrix4(a),h.applyMatrix4(a),l.applyMatrix4(a),x.applyMatrix4(a),1==t.getType()){if(this.aryText.forEach(function(s){if(s.txt.length>0){var o=new THREE.Vector3(s.txtPos.x,s.txtPos.y,0);e.fixedSize&&(s.txtPos.x>0?o.x=e.svgPos.x+i.screenCoordLong2Doc(s.txtPos.x):o.x=e.svgPos.x-i.screenCoordLong2Doc(s.txtPos.x),s.txtPos.y>0?o.y=e.svgPos.y+i.screenCoordLong2Doc(s.txtPos.y):o.y=e.svgPos.y-i.screenCoordLong2Doc(s.txtPos.y));var r=void 0;s.color&&(r=t.getColor(),t.setColor(s.color));var n=s.txtHeight;e.fixedSize&&(n=i.screenCoordLong2Doc(s.txtHeight)),s._txtObject=t.drawText(s.txt,n,0,o),s._txtAspectRatio=-1,r&&t.setColor(r)}}),this.svg)t.drawEntity(this.svg);else if(this.svgPath.length>0&&this.isLoadFromPath){var u=this,p=t.getMxObject();MxThreeJS_1.default.loadSVG(this.svgPath,void 0,function(e){if(e){var s=e;if(s.boxSize)u.svgBoxSize=s.boxSize.clone();else{var o=(new THREE.Box3).setFromObject(e);u.svgBoxSize||(u.svgBoxSize=new THREE.Vector3),u.svgBoxSize.x=o.max.x-o.min.x,u.svgBoxSize.y=o.max.y-o.min.y}var r=u.calcVewSize(i),n=r[0],a=r[1];u.svgBoxSize&&(e.scale.x=n/u.svgBoxSize.x,e.scale.y=a/u.svgBoxSize.y),e.scale.z=e.scale.x,u.svgReverse&&(e.scale.y*=-1),u.svgMirror&&(e.scale.x*=-1),e.rotateZ(u.svgRotate),u.isSvgDirtyLocation=!0;var g=new THREE.Color(t.getColor()),v=0;e.traverse(function(t){t.material&&(t.material=t.material.clone(),t.material.transparent=!0,t.material.depthTest=!1,u.useSvgColor||(v<u.svgChildColor.length?t.material.color=new THREE.Color(u.svgChildColor[v]):t.material.color=g),v++)}),u.svg=e,u.setNeedUpdateDisplay(),p.updateDisplay()}else console.log("mx LoadSVG:"+u.svgPath+" failed");u.isLoadFromPath=!1})}t.drawSelectLine(c,l),t.drawSelectLine(h,x),t.drawSelectLine(c,h),t.drawSelectLine(h,l),t.drawSelectLine(l,x),t.drawSelectLine(x,c)}else t.drawLine(c,h),t.drawLine(h,l),t.drawLine(l,x),t.drawLine(x,c)},e.prototype.setSvgPath=function(t,e){return void 0===e&&(e=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(i){switch(i.label){case 0:return this.svgPath=t,this.svg=null,this.isLoadFromPath=!0,this.svgBoxSize=null,e?[4,MxThreeJS_1.default.loadSVG(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.getSvgPath=function(){return this.svgPath},e.prototype.setSvgPostion=function(t){this.svgPos=t.clone(),this.isSvgDirtyLocation=!0},e.prototype.getSvgPostion=function(){return this.svgPos},e.prototype.setSvgSize=function(t){this.svgSize=t,this.isSvgDirtyLocation=!0},e.prototype.getSvgSize=function(){return this.svgSize},e.prototype.setSvgAlignmentRatio=function(t){this.svgAlignmentRatio=t,this.isSvgDirtyLocation=!0},e.prototype.getSvgAlignmentRatio=function(){return this.svgAlignmentRatio},e.prototype.getText=function(t){return t<this.aryText.length?this.aryText[t]:null},e.prototype.addText=function(t){this.aryText.push(t)},e.prototype.getGripPoints=function(){var t=[];return t.push(this.svgPos),t},e.prototype.moveGripPointsAt=function(t,e){return 0==t&&(this.svgPos.add(e),this.fixedSize||this.aryText.forEach(function(t){t.txtPos.add(e)})),this.isSvgDirtyLocation=!0,!0},e.prototype.calcSvgPosition=function(t){if(this.svg&&this.isSvgDirtyLocation){this.isSvgDirtyLocation=!1;var e=this.calcVewSize(t),i=e[0],s=e[1];this.svg.position.x=this.svgPos.x-i*this.svgAlignmentRatio.x-this.svgMargin.x*i,this.svg.position.y=this.svgPos.y-s*this.svgAlignmentRatio.y-this.svgMargin.y*s}},e.prototype.dwgIn=function(t){var e=this;this.onDwgIn(t),this.fixedSize=t.fixedSize,this.fixedSize?this.svg=null:t.type==MxType_1.default.MxCloneType.kClone&&t.svg&&(this.svg=t.svg.clone()),this.svgPos.copy(t.svgPos),this.svgPath=t.svgPath.substr(0),this.svgSize.copy(t.svgSize),this.svgAlignmentRatio.copy(t.svgAlignmentRatio),this.isSvgDirtyLocation=!0,this.svg||(this.isLoadFromPath=!0),this.svgBoxSize=null;var i=t.txts;return this.aryText=[],i.forEach(function(t){var i=new MxDbSVGText_1.default;i.txt=t.txt,i.txtHeight=t.txtHeight,i.txtPos.copy(t.txtPos),e.aryText.push(i)}),this.svgRotate=t.svgRotate,this.useSvgColor=t.useSvgColor,this.svgReverse=t.svgReverse,this.svgMirror=t.svgMirror,this.svgMargin=t.svgMargin,t.svgChildColor?this.svgChildColor=t.svgChildColor:this.svgChildColor=[],!0},e.prototype.dwgOut=function(t){return this.onDwgOut(t),t.type==MxType_1.default.MxCloneType.kClone&&(t.svg=this.svg),t.svgPath=this.svgPath,t.svgPos=this.svgPos,t.svgSize=this.svgSize,t.svgAlignmentRatio=this.svgAlignmentRatio,t.txts=[],this.aryText.forEach(function(e){var i={txtPos:e.txtPos,txt:e.txt,txtHeight:e.txtHeight,color:e.color,_txtAspectRatio:e._txtAspectRatio};t.txts.push(i)}),t.fixedSize=this.fixedSize,t.svgRotate=this.svgRotate,t.useSvgColor=this.useSvgColor,t.svgReverse=this.svgReverse,t.svgMirror=this.svgMirror,t.svgMargin=this.svgMargin,t.svgChildColor=this.svgChildColor,t},e.prototype.create=function(){return new e},e.prototype.transformBy=function(t){this.svgPos.applyMatrix4(t),this.isSvgDirtyLocation=!0,this.fixedSize||this.aryText.forEach(function(e){e.txtPos.applyMatrix4(t)})},e.prototype.getTypeName=function(){return"MxDbSVG"},e.prototype.setColor=function(e){if(t.prototype.setColor.call(this,e),this.svg){var i=new THREE.Color(this.color);this.svg.traverse(function(t){t.material&&(t.material.color=i)})}},e.prototype.setSvg=function(t){this.svg=t,this.isLoadFromPath=!1,this.svgBoxSize=null},e.prototype.calcSvgBoxSize=function(t){if(!this.svgBoxSize)if(t.boxSize)this.svgBoxSize=t.boxSize.clone();else{var e=(new THREE.Box3).setFromObject(t);this.svgBoxSize||(this.svgBoxSize=new THREE.Vector3),this.svgBoxSize.x=e.max.x-e.min.x,this.svgBoxSize.y=e.max.y-e.min.y}},e.prototype.reComputeSVG=function(){if(this.svg){var t=this.getMxObject();if(t){this.calcSvgBoxSize(this.svg);var e=this.calcVewSize(t),i=e[0],s=e[1];this.svgBoxSize&&(this.svg.scale.x=i/this.svgBoxSize.x,this.svg.scale.y=s/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}}},e.prototype.onViewChange=function(){if(!this.fixedSize)return!1;var t=this.getMxObject();if(null==t)return!1;if(this.svg){this.calcSvgBoxSize(this.svg);var e=this.calcVewSize(t),i=e[0],s=e[1];this.svgBoxSize&&(this.svg.scale.x=i/this.svgBoxSize.x,this.svg.scale.y=s/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}var o=this;return this.aryText.forEach(function(e){if(e._txtObject&&t){var i=t.screenCoordLong2Doc(e.txtHeight);i>1e-5&&(e._txtAspectRatio<=0&&(e._txtAspectRatio=e._txtObject.scale.x/e._txtObject.scale.y),e._txtObject.scale.set(e._txtAspectRatio*i,i,1),e.txtPos.x>0?e._txtObject.position.x=o.svgPos.x+t.screenCoordLong2Doc(e.txtPos.x):e._txtObject.position.x=o.svgPos.x-t.screenCoordLong2Doc(e.txtPos.x),e.txtPos.y>0?e._txtObject.position.y=o.svgPos.y+t.screenCoordLong2Doc(e.txtPos.y):e._txtObject.position.y=o.svgPos.y-t.screenCoordLong2Doc(e.txtPos.y),e._txtObject.updateMatrix())}}),!0},e}(MxDbEntity_1.default);exports.default=MxDbSVG;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __spreadArray=this&&this.__spreadArray||function(t,e,o){if(o||2===arguments.length)for(var r,n=0,a=e.length;n<a;n++)!r&&n in e||(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(exports,"__esModule",{value:!0});var random_1=require("../../tools/algorithm/random"),create_1=require("../../tools/dom/create"),MxDrawObject_1=require("../MxDrawObject"),store_1=require("../store"),useCanvasResizeListener_1=require("../useCanvasResizeListener"),MrxDbgUiPrPoint_1=require("../MrxDbgUiPrPoint"),mxUiData_1=require("../loadCoreCode/mxUiData"),MxDbDatabase_1=require("../MxDbDatabase"),MxFun=function(){function t(){this.listenForUpdateCursor=function(t){mxUiData_1.default.mountUpdateCursorFun(t)}}return t.prototype.createMxObject=function(t){var e=t.canvasId,o=void 0===e?(0,random_1.createReandomId)():e,r=t.cadFile,n=void 0===r?"":r,a=t.callback,u=t.isNewFile,i=void 0!==u&&u,s=t.useWebsocket,d=void 0!==s&&s,c=t.isAutoResize,l=void 0===c||c,p=t.mapBox,f=t.isMxCAD,x=void 0!==f&&f;if(this.initUiDataObject(mxUiData_1.default),!d&&i&&(i=!1),p){var M=p.canvas;store_1.default.state.MxFun.createMxObject(M,n,function(t){var e=new MxDrawObject_1.default(t);t.setIniset({EnableOsnapFunction:!0}),a&&a(e,{canvas:M,canvasParent:void 0})},void 0,i,d,p)}else{var
|
|
1
|
+
"use strict";var __spreadArray=this&&this.__spreadArray||function(t,e,o){if(o||2===arguments.length)for(var r,n=0,a=e.length;n<a;n++)!r&&n in e||(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(exports,"__esModule",{value:!0});var random_1=require("../../tools/algorithm/random"),create_1=require("../../tools/dom/create"),MxDrawObject_1=require("../MxDrawObject"),store_1=require("../store"),useCanvasResizeListener_1=require("../useCanvasResizeListener"),MrxDbgUiPrPoint_1=require("../MrxDbgUiPrPoint"),mxUiData_1=require("../loadCoreCode/mxUiData"),MxDbDatabase_1=require("../MxDbDatabase"),MxCADObject_1=require("../MxCADObject"),MxFun=function(){function t(){this.listenForUpdateCursor=function(t){mxUiData_1.default.mountUpdateCursorFun(t)}}return t.prototype.createMxObject=function(t){var e=t.canvasId,o=void 0===e?(0,random_1.createReandomId)():e,r=t.cadFile,n=void 0===r?"":r,a=t.callback,u=t.isNewFile,i=void 0!==u&&u,s=t.useWebsocket,d=void 0!==s&&s,c=t.isAutoResize,l=void 0===c||c,p=t.mapBox,f=t.isMxCAD,x=void 0!==f&&f;if(this.initUiDataObject(mxUiData_1.default),!d&&i&&(i=!1),p){var M=p.canvas;store_1.default.state.MxFun.createMxObject(M,n,function(t){var e=new MxDrawObject_1.default(t);t.setIniset({EnableOsnapFunction:!0}),a&&a(e,{canvas:M,canvasParent:void 0})},void 0,i,d,p)}else{var _=(0,create_1.createCanvas)(o),y=(0,create_1.createCanvasParent)(_);y.parentNode&&11!=y.parentNode.nodeType||document.body.appendChild(y);var C=void 0;x&&(C=!0,d=!0),store_1.default.state.MxFun.createMxObject(o,n,function(t){var e=new MxDrawObject_1.default(t);if(x){t.initRunMode(2)}t.setMouseRightRotate(!1),t.setIniset({EnableOsnapFunction:!0}),t.addEvent("onResize",function(){return y.tabindex=3,{width:y.clientWidth,height:y.clientHeight}}),l&&(0,useCanvasResizeListener_1.default)(e,_),a&&a(e,{canvas:_,canvasParent:y})},C,i,d,void 0)}},t.prototype.setMxServer=function(t){void 0===t&&(t="ws://localhost:5090"),store_1.default.state.MxFun.setMxServer(t)},t.prototype.enablStaticLoad=function(t){store_1.default.state.MxFun.enablStaticLoad(t)},t.prototype.setStaticServer=function(t){store_1.default.state.MxFun.setStaticServer(t)},t.prototype.addCommand=function(t,e){store_1.default.state.MxFun.addCommand(t,e)},t.prototype.sendStringToExecute=function(t){for(var e,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];return(e=store_1.default.state.MxFun).sendStringToExecute.apply(e,__spreadArray([t],o,!1))},t.prototype.call=function(t,e,o){return store_1.default.state.MxFun.call(t,e,o)},t.prototype.getCurrentDraw=function(){return new MxDrawObject_1.default(store_1.default.state.MxFun.getCurrentDraw())},t.prototype.getCurrentDatabase=function(){var t=store_1.default.state.MxFun.getCurrentDraw();return new MxDbDatabase_1.default(t.getMxDatabase())},t.prototype.screenCoordLong2World=function(t){return store_1.default.state.MxFun.screenCoordLong2World(t)},t.prototype.screenCoordLong2Doc=function(t){return store_1.default.state.MxFun.screenCoordLong2Doc(t)},t.prototype.docCoordLong2Screen=function(t){return store_1.default.state.MxFun.docCoordLong2Screen(t)},t.prototype.worldCoordLong2Doc=function(t){return store_1.default.state.MxFun.worldCoordLong2Doc(t)},t.prototype.docCoordLong2World=function(t){return store_1.default.state.MxFun.docCoordLong2World(t)},t.prototype.screenCoord2World=function(t,e,o){return store_1.default.state.MxFun.screenCoord2World(t,e,o)},t.prototype.worldCoord2Screen=function(t,e,o){return store_1.default.state.MxFun.worldCoord2Screen(t,e,o)},t.prototype.docCoord2World=function(t,e,o){return store_1.default.state.MxFun.docCoord2World(t,e,o)},t.prototype.worldCoord2Doc=function(t,e,o){return store_1.default.state.MxFun.worldCoord2Doc(t,e,o)},t.prototype.screenCoord2Doc=function(t,e){return store_1.default.state.MxFun.screenCoord2Doc(t,e,0)},t.prototype.docCoord2Screen=function(t,e){return store_1.default.state.MxFun.docCoord2Screen(t,e,0)},t.prototype.updateDisplay=function(){return store_1.default.state.MxFun.updateDisplay()},t.prototype.addWindowsEvent=function(t){return store_1.default.state.MxFun.addWindowsEvent(t)},t.prototype.isRunningCommand=function(){return store_1.default.state.MxFun.isRunningCommand()},t.prototype.zoomW=function(t,e,o,r,n){return store_1.default.state.MxFun.zoomW(t,e,o,r,n)},t.prototype.showLayer=function(t,e,o){return store_1.default.state.MxFun.showLayer(t,e,o)},t.prototype.getCurrentMxCAD=function(){var t=store_1.default.state.MxFun.getCurrentMxCAD();return new MxCADObject_1.default(t)},t.prototype.getQueryString=function(t){return store_1.default.state.MxFun.getQueryString(t)},t.prototype.setIniset=function(t){return store_1.default.state.MxFun.setIniset(t)},t.prototype.upDisplayForLayerData=function(t){return store_1.default.state.MxFun.upDisplayForLayerData(t)},t.prototype.initUiDataObject=function(t){return store_1.default.state.MxFun.initUiDataObject(t)},t.prototype.testMX=function(t){return 11},t.prototype.loadImageMaterial=function(t,e){return e?(store_1.default.state.MxFun.loadImageMaterial(t,e),new Promise(function(t,e){t(null)})):new Promise(function(e,o){store_1.default.state.MxFun.loadImageMaterial(t,function(t){e(t||null)})})},t.prototype.openFile=function(t,e){return void 0===e&&(e=!1),store_1.default.state.MxFun.openFile(t,e)},t.prototype.addToCurrentSpace=function(t){return this.getCurrentDraw().addMxEntity(t)},t.prototype.selectEnt=function(t,e){var o=this;return void 0===e&&(e=null),new Promise(function(r,n){var a=new MrxDbgUiPrPoint_1.default;a.setMessage(t),a.go(function(t){if(0==t){for(var n=a.value(),u=o.getCurrentDraw().findMxEntityAtPoint(n),i=0;0!=u.length;){for(var s=u.length,d=0;d<s;d++){var c=u[d];if(!e||!e.type||e.type==c.getTypeName()){i=c.objectId();break}}break}r(i)}else r(0)})})},t.prototype.listenForCommandLineInput=function(t){mxUiData_1.default.getCmdLine().mountUpDisplayFun(t)},t.prototype.setCommandLineInputData=function(t,e){mxUiData_1.default.getCmdLine().setCmdText(t),mxUiData_1.default.onKeydown(e)},t.prototype.listenForCoordTip=function(t){mxUiData_1.default.mountSetCoordFun(t)},t.prototype.getMxFunTHREE=function(){return store_1.default.state.MxFun.getTHREE()},t.prototype.getMxFunThreeTool=function(){return store_1.default.state.MxFun.getMxThreeJS()},t.prototype.ceneratecursor=function(t,e,o){return void 0===t&&(t=128),void 0===e&&(e=10),void 0===o&&(o=!0),store_1.default.state.MxFun.ceneratecursor(t,e,o)},t.prototype.callCommand=function(t,e,o){return store_1.default.state.MxFun.callCommand(t,e,o)},t}();exports.default=MxFun;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var three_1=require("three"),store_1=require("../store"),MxThreeJS=function(){function e(){}return e.prototype.createLine=function(e,t,r){var n=new three_1.Geometry,o=new three_1.LineBasicMaterial({color:r});return n.vertices.push(e,t),new three_1.Line(n,o)},e.prototype.createCircle=function(e,t,r){var n=new three_1.CircleGeometry(t,64,3,2*Math.PI),o=new three_1.LineBasicMaterial({color:r});n.vertices.shift();var i=new three_1.LineLoop(n,o);return i.position.x=e.x,i.position.y=e.y,i.position.z=e.z,i},e.prototype.createPoint=function(e,t){var r=new three_1.Geometry;r.vertices.push(e);var n=new three_1.PointsMaterial({color:t,size:3});return new three_1.Points(r,n)},e.prototype.creatTextSprite=function(e,t,r,n,o){return store_1.default.state.MxFun.getMxThreeJS().creatTextSprite(e,t,r,n,o)},e.prototype.createTriangle=function(e,t,r){if(void 0===r&&(r=1),e.length<3)return null;for(var n=e.length,o=new three_1.Geometry,i=0;i+2<n;i+=3){o.vertices.push(e[i]),o.vertices.push(e[i+1]),o.vertices.push(e[i+2]);var a=new three_1.Face3(i,i+1,i+2);o.faces.push(a)}o.computeFaceNormals(),o.computeVertexNormals();var s=new three_1.MeshBasicMaterial({color:t,transparent:!0,depthTest:!1,side:three_1.DoubleSide,opacity:r});return new three_1.Mesh(o,s)},e.prototype.createLines=function(e,t){var r=new three_1.Geometry;r.vertices=e;var n=new three_1.LineBasicMaterial({color:t});return new three_1.Line(r,n)},e.prototype.createDashedLines=function(e,t,r,n){var o=new three_1.Geometry;o.vertices=e;var i=new three_1.Line(o,new three_1.LineDashedMaterial({color:t,dashSize:r,gapSize:n}));return i.computeLineDistances(),i},e.prototype.createImage=function(e,t,r,n,o){},e.prototype.loadSVG=function(e,t,r){return r?(store_1.default.state.MxFun.loadSVG(e,t,r),new Promise(function(e){e(null)})):new Promise(function(r){store_1.default.state.MxFun.loadSVG(e,t,function(e){r(e)})})},e}();exports.default=MxThreeJS;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var three_1=require("three"),store_1=require("../store"),MxThreeJS=function(){function e(){}return e.prototype.createLine=function(e,t,r){var n=new three_1.Geometry,o=new three_1.LineBasicMaterial({color:r});return n.vertices.push(e,t),new three_1.Line(n,o)},e.prototype.createCircle=function(e,t,r){var n=new three_1.CircleGeometry(t,64,3,2*Math.PI),o=new three_1.LineBasicMaterial({color:r});n.vertices.shift();var i=new three_1.LineLoop(n,o);return i.position.x=e.x,i.position.y=e.y,i.position.z=e.z,i},e.prototype.createPoint=function(e,t){var r=new three_1.Geometry;r.vertices.push(e);var n=new three_1.PointsMaterial({color:t,size:3});return new three_1.Points(r,n)},e.prototype.creatTextSprite=function(e,t,r,n,o){return store_1.default.state.MxFun.getMxThreeJS().creatTextSprite(e,t,r,n,o)},e.prototype.createTriangle=function(e,t,r){if(void 0===r&&(r=1),e.length<3)return null;for(var n=e.length,o=new three_1.Geometry,i=0;i+2<n;i+=3){o.vertices.push(e[i]),o.vertices.push(e[i+1]),o.vertices.push(e[i+2]);var a=new three_1.Face3(i,i+1,i+2);o.faces.push(a)}o.computeFaceNormals(),o.computeVertexNormals();var s=new three_1.MeshBasicMaterial({color:t,transparent:!0,depthTest:!1,side:three_1.DoubleSide,opacity:r});return new three_1.Mesh(o,s)},e.prototype.createLines=function(e,t){var r=new three_1.Geometry;r.vertices=e;var n=new three_1.LineBasicMaterial({color:t});return new three_1.Line(r,n)},e.prototype.createDashedLines=function(e,t,r,n){var o=new three_1.Geometry;o.vertices=e;var i=new three_1.Line(o,new three_1.LineDashedMaterial({color:t,dashSize:r,gapSize:n}));return i.computeLineDistances(),i},e.prototype.createImage=function(e,t,r,n,o){},e.prototype.loadSVG=function(e,t,r,n){return r?(store_1.default.state.MxFun.loadSVG(e,t,r,n),new Promise(function(e){e(null)})):new Promise(function(r){store_1.default.state.MxFun.loadSVG(e,t,function(e){r(e)},n)})},e}();exports.default=MxThreeJS;
|