mxdraw 0.1.45 → 0.1.48

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxType_1=require("../MxType"),store_1=require("../store/store"),MxDbEntity=function(){function t(){this.color=16777215,this.renderOrder=30,this.opacity=1,this.visible=!0,this.userData={},this.dLineWidth=0,this.lineWidthByPixels=!0,this.dDashArray=0,this.dDashRatio=0,this.layer=""}return t.prototype.dwgInHelp=function(t,e){var i=function(t){return"object"==typeof t?function(t){return!!(t.isVector3||t.isVector2||t.isVector4)}(t)?t.clone():n(t,Object.create(null)):t instanceof Array?r(t):t},r=function(t){return t.map(function(t){return i(t)})},n=function(t,e){for(var r in t)t[r]&&(e[r]=i(t[r]));return e},o=this;return e.forEach(function(e){t[e]&&(o[e]=i(t[e]))}),!0},t.prototype.dwgOutHelp=function(t,e){var i=this;return e.forEach(function(e){t[e]=i[e]}),t},t.prototype.getTypeName=function(){return this.constructor.name},t.prototype.create=function(){return new(0,this.constructor)},t.prototype.transformBy=function(t){},t.prototype.getImp=function(){return this.MxDbEntityImp},t.prototype.setNeedUpdateDisplay=function(t){var e=this.getImp();return!!e&&(t?e.upDisplay():e.setDirtyDisplay(!0),!0)},t.prototype.getMxObject=function(){var t=this.getImp();return t?t.getMxObject():null},t.prototype.onViewChange=function(){return!1},t.prototype.objectId=function(){var t=this.getImp();return t?t.objectId():0},t.prototype.erase=function(){var t=this.getImp();return!!t&&t.erase()},t.prototype.setLayer=function(t){var e=this.getImp();e&&e.nodifySetLayer(),this.layer=t},t.prototype.getLayer=function(){return this.layer},t.prototype.setColor=function(t){this.color=t},t.prototype.getColor=function(){return this.color},t.prototype.clone=function(t){var e=this.create(),i={type:t||MxType_1.default.MxCloneType.kClone};return this.dwgOut(i),e.dwgIn(i),e},t.prototype.onDwgIn=function(t){this.color=t.color,this.renderOrder=t.renderOrder,this.opacity=t.opacity,this.visible=t.visible,t.userData?this.userData=JSON.parse(JSON.stringify(t.userData)):this.userData={},this.dLineWidth=t.lineWidth,this.lineWidthByPixels=t.lineWidthByPixels,this.dDashArray=t.dashArray,this.dDashRatio=t.dashRatio,this.layer=t.layer},t.prototype.onDwgOut=function(t){t.color=this.color,t.renderOrder=this.renderOrder,t.opacity=this.opacity,t.visible=this.visible,Object.keys(this.userData).length>0&&(t.userData=this.userData),t.lineWidth=this.dLineWidth,t.lineWidthByPixels=this.lineWidthByPixels,t.dashArray=this.dDashArray,t.dashRatio=this.dDashRatio,t.layer=this.layer},t.prototype.rxInit=function(){store_1.default.state.MxFun.initMxDbEntityType(this)},t.prototype.setRenderOrder=function(t){this.renderOrder=t},t.prototype.getRenderOrder=function(){return this.renderOrder},t.prototype.setDash=function(t,e){this.dDashArray=t,this.dDashRatio=e,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)},t.prototype.getDash=function(){return{dDashArray:this.dDashArray,dDashRatio:this.dDashRatio}},t.prototype.setDashLineDisplay=function(t){t?(this.dDashArray=.03,this.dDashRatio=.1,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)):(this.dDashArray=0,this.dDashRatio=0)},t.prototype.isDashLineDisplay=function(){return this.dDashArray>0&&this.dDashRatio>0},t.prototype.setLineWidthByPixels=function(t){this.lineWidthByPixels=t},t.prototype.getLineWidthByPixels=function(){return this.lineWidthByPixels},t.prototype.setLineWidth=function(t){this.dLineWidth=t},t.prototype.getLineWidth=function(){return this.dLineWidth},t}();exports.default=MxDbEntity;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),MxType_1=require("../MxType"),store_1=require("../store/store"),MxDbEntity=function(){function t(){this.color=16777215,this.renderOrder=30,this.opacity=1,this.visible=!0,this.userData={},this.dLineWidth=0,this.lineWidthByPixels=!0,this.dDashArray=0,this.dDashRatio=0,this.layer=""}return t.prototype.dwgInHelp=function(t,e){var i=function(t){return"object"==typeof t?function(t){return!!(t.isVector3||t.isVector2||t.isVector4)}(t)?t.clone():2==t.datatype?new THREE.Vector2(t.x,t.y):3==t.datatype?new THREE.Vector3(t.x,t.y,t.z):4==t.datatype?new THREE.Vector4(t.x,t.y,t.z,t.w):n(t,Object.create(null)):t instanceof Array?r(t):t},r=function(t){return t.map(function(t){return i(t)})},n=function(t,e){for(var r in t)t[r]&&(e[r]=i(t[r]));return e},o=this;return e.forEach(function(e){t[e]&&(o[e]=i(t[e]))}),!0},t.prototype.dwgOutHelp=function(t,e){var i=this;return e.forEach(function(e){t[e]=i[e];var r,n=(r=i[e]).isVector3?3:r.isVector2?2:r.isVector4?4:0;n&&(t[e].datatype=n)}),t},t.prototype.getTypeName=function(){return this.constructor.name},t.prototype.create=function(){return new(0,this.constructor)},t.prototype.transformBy=function(t){},t.prototype.getImp=function(){return this.MxDbEntityImp},t.prototype.setNeedUpdateDisplay=function(t){var e=this.getImp();return!!e&&(t?e.upDisplay():e.setDirtyDisplay(!0),!0)},t.prototype.getMxObject=function(){var t=this.getImp();return t?t.getMxObject():null},t.prototype.onViewChange=function(){return!1},t.prototype.objectId=function(){var t=this.getImp();return t?t.objectId():0},t.prototype.erase=function(){var t=this.getImp();return!!t&&t.erase()},t.prototype.setLayer=function(t){var e=this.getImp();e&&e.nodifySetLayer(),this.layer=t},t.prototype.getLayer=function(){return this.layer},t.prototype.setColor=function(t){this.color=t},t.prototype.getColor=function(){return this.color},t.prototype.clone=function(t){var e=this.create(),i={type:t||MxType_1.default.MxCloneType.kClone};return this.dwgOut(i),e.dwgIn(i),e},t.prototype.onDwgIn=function(t){this.color=t.color,this.renderOrder=t.renderOrder,this.opacity=t.opacity,this.visible=t.visible,t.userData?this.userData=JSON.parse(JSON.stringify(t.userData)):this.userData={},this.dLineWidth=t.lineWidth,this.lineWidthByPixels=t.lineWidthByPixels,this.dDashArray=t.dashArray,this.dDashRatio=t.dashRatio,this.layer=t.layer},t.prototype.onDwgOut=function(t){t.color=this.color,t.renderOrder=this.renderOrder,t.opacity=this.opacity,t.visible=this.visible,Object.keys(this.userData).length>0&&(t.userData=this.userData),t.lineWidth=this.dLineWidth,t.lineWidthByPixels=this.lineWidthByPixels,t.dashArray=this.dDashArray,t.dashRatio=this.dDashRatio,t.layer=this.layer},t.prototype.rxInit=function(){store_1.default.state.MxFun.initMxDbEntityType(this)},t.prototype.setRenderOrder=function(t){this.renderOrder=t},t.prototype.getRenderOrder=function(){return this.renderOrder},t.prototype.setDash=function(t,e){this.dDashArray=t,this.dDashRatio=e,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)},t.prototype.getDash=function(){return{dDashArray:this.dDashArray,dDashRatio:this.dDashRatio}},t.prototype.setDashLineDisplay=function(t){t?(this.dDashArray=.03,this.dDashRatio=.1,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)):(this.dDashArray=0,this.dDashRatio=0)},t.prototype.isDashLineDisplay=function(){return this.dDashArray>0&&this.dDashRatio>0},t.prototype.setLineWidthByPixels=function(t){this.lineWidthByPixels=t},t.prototype.getLineWidthByPixels=function(){return this.lineWidthByPixels},t.prototype.setLineWidth=function(t){this.dLineWidth=t},t.prototype.getLineWidth=function(){return this.dLineWidth},t}();exports.default=MxDbEntity;
@@ -0,0 +1 @@
1
+ "use strict";var __extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),MxDbEntity_1=require("../MxDbEntity"),MxThreeJS_1=require("../MxThreeJS"),MxDbLeadTag=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.point=new THREE.Vector3,t.leadLen=88,t.text="",t.textHeight=24,t}return __extends(t,e),t.prototype.createDots=function(e,t){var n=e.x,o=e.y,r=(e.z,new THREE.Shape);r.arc(n,o,t.screenCoordLong2Doc(6),0,2*Math.PI,!0);var i=new THREE.Path;i.arc(n,o,t.screenCoordLong2Doc(3),0,2*Math.PI,!0),r.holes.push(i);var a=new THREE.ShapeGeometry(r),s=new THREE.MeshPhongMaterial({color:"#ff0000",transparent:!0}),c=new THREE.Shape;c.arc(n,o,t.screenCoordLong2Doc(3),0,2*Math.PI,!0);var p=new THREE.ShapeGeometry(c),d=new THREE.MeshPhongMaterial({color:"#e2da8f",transparent:!0}),x=new THREE.Mesh(a,s),u=new THREE.Mesh(p,d);return x.add(u),x},t.prototype.worldDraw=function(e){var t=e.getMxObject(),n=this.createDots(this.point,t);if(e.drawEntity(n),n.geometry.computeBoundingBox(),e.drawSelectLine(n.geometry.boundingBox.max,n.geometry.boundingBox.min),2!==e.getType()){var o=e.getMxObject().screenCoordLong2Doc(this.leadLen),r=new THREE.Vector3(this.point.x+2*o,this.point.y+o,0),i=r.x-o,a=new THREE.Vector3(i,r.y,r.z);e.setLineWidth(4),e.setColor("#ffe605"),e.drawLines([this.point,a,r]);var s=e.getMxObject().screenCoordLong2Doc(this.textHeight),c=r.clone().setX(r.x);e.setColor(16744448);var p=MxThreeJS_1.default.creatTextSprite(this.text,c,s,0,e.getColor());if(p){var d=new THREE.Box3,x=new THREE.Vector3;d.expandByObject(p),d.getSize(x),p.position.setX(p.position.x+x.x/2);var u=e.getMxObject().screenCoordLong2Doc(5),E=d.min.clone().setX(d.min.x+x.x/2).setY(d.min.y-u),h=d.max.clone().setX(d.max.x+x.x/2).setY(d.min.y+u);h.setY(d.max.y+u);var w=new THREE.Vector3(E.x,h.y),y=new THREE.Vector3(h.x,E.y);e.setColor("#ffffff"),e.setLineWidth(0),e.drawLine(E,w),e.drawLine(h,y),e.drawLine(E,y),e.drawLine(w,h);var l=u/2,f=[],g=[];f.push(new THREE.Vector3(w.x+l,w.y-u,w.z),new THREE.Vector3(w.x+l,w.y-l,w.z),new THREE.Vector3(w.x+u,w.y-l,w.z)),g.push(new THREE.Vector3(y.x-l,y.y+u,y.z),new THREE.Vector3(y.x-l,y.y+l,y.z),new THREE.Vector3(y.x-u,y.y+l,y.z)),e.drawLines(f),e.drawLines(g),e.setOpacity(.5),e.setColor("#663244"),e.setRenderOrder(-100),e.drawSolid([E,w,h,y]),e.setRenderOrder(100),e.drawEntity(p)}}},t.prototype.getGripPoints=function(){return[this.point]},t.prototype.onViewChange=function(){return this.setNeedUpdateDisplay(),!0},t.prototype.moveGripPointsAt=function(e,t){return 0===e&&this.point.add(t),!0},t.prototype.dwgIn=function(e){return this.onDwgIn(e),this.dwgInHelp(e,["point","text","textHeight","leadLen"]),!0},t.prototype.dwgOut=function(e){return this.onDwgOut(e),this.dwgOutHelp(e,["point","text","textHeight","leadLen"]),e},t}(MxDbEntity_1.default);exports.default=MxDbLeadTag;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxDbLeadTag_1=require("./MxDbLeadTag");exports.default=MxDbLeadTag_1.default;
@@ -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{c(s.next(t))}catch(t){r(t)}}function a(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}c((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.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;this.svgReverse&&n.makeScale(1,-1,1);var a=new THREE.Matrix4;a.makeRotationZ(this.svgRotate);var c=new THREE.Matrix4,g=new THREE.Vector3(this.svgPos.x-o*this.svgAlignmentRatio.x,this.svgPos.y-r*this.svgAlignmentRatio.y,0);c.makeTranslation(g.x,g.y,g.z),a.multiply(n),a.premultiply(c);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,y=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),e.rotateZ(u.svgRotate),u.isSvgDirtyLocation=!0;var c=new THREE.Color(t.getColor());e.traverse(function(t){t.material&&(t.material=t.material.clone(),t.material.transparent=!0,u.useSvgColor||(t.material.color=c))}),u.svg=e,u.setNeedUpdateDisplay(),y.updateDisplay()}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.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.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.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.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.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,y=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,u.useSvgColor||(t.material.color=g))}),u.svg=e,u.setNeedUpdateDisplay(),y.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 +1 @@
1
- "use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,o){return new(r||(r=Promise))(function(n,i){function a(t){try{d(o.next(t))}catch(t){i(t)}}function u(t){try{d(o.throw(t))}catch(t){i(t)}}function d(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,u)}d((o=o.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{r=n=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 MxDbDatabase_1=require("../MxDbDatabase"),MxThreeJS_1=require("../MxThreeJS"),MxDrawObject=function(){function t(t){this._mxdrawObj=t}return t.prototype.getScene=function(){return this._mxdrawObj.getScene()},t.prototype.getCamera=function(){return this._mxdrawObj.getCamera()},t.prototype.getRenderer=function(){return this._mxdrawObj.renderer},t.prototype.setMouseRightRotate=function(t){return void 0===t&&(t=!0),this._mxdrawObj.setMouseRightRotate(t)},t.prototype.getFullDisplayRange=function(){return this._mxdrawObj.getFullDisplayRange()},t.prototype.getCanvas=function(){return this._mxdrawObj.getCanvas()},t.prototype.updateDisplay=function(){return this._mxdrawObj.updateDisplay()},t.prototype.createCanvasImageData=function(t,e){return this._mxdrawObj.createCanvasImageData(t,e)},t.prototype.setViewColor=function(t){return this._mxdrawObj.setViewColor(t)},t.prototype.setSize=function(t,e){return this._mxdrawObj.setSize(t,e)},t.prototype.getIntersectObjects=function(t){return this._mxdrawObj.getIntersectObjects(t)},t.prototype.addObject=function(t,e){return void 0===e&&(e=!0),this._mxdrawObj.addObject(t,e)},t.prototype.addViewObject=function(t){return this._mxdrawObj.addViewObject(t)},t.prototype.getViewWidth=function(){return this._mxdrawObj.getViewWidth()},t.prototype.getViewHeight=function(){return this._mxdrawObj.getViewHeight()},t.prototype.removeObject=function(t,e){return void 0===e&&(e=!0),this._mxdrawObj.removeObject(t,e)},t.prototype.zoomInitialStates=function(){return this._mxdrawObj.zoomInitialStates()},t.prototype.zoomScale=function(t){return this._mxdrawObj.zoomScale(t)},t.prototype.zoomW=function(t,e,r){return this._mxdrawObj.zoomW(t,e,r)},t.prototype.zoomCenter=function(t,e){return this._mxdrawObj.zoomCenter(t,e)},t.prototype.initZoomW=function(t,e){return this._mxdrawObj.initZoomW(t,e)},t.prototype.addEvent=function(t,e){return this._mxdrawObj.addEvent(t,e)},t.prototype.setIniset=function(t){return this._mxdrawObj.setIniset(t)},t.prototype.screenCoord2World=function(t,e,r){return this._mxdrawObj.screenCoord2World(t,e,r)},t.prototype.worldCoord2Screen=function(t,e,r){return this._mxdrawObj.worldCoord2Screen(t,e,r)},t.prototype.screenCoord2Doc=function(t,e){return this._mxdrawObj.screenCoord2Doc(t,e,0)},t.prototype.worldCoordLong2Doc=function(t){return this._mxdrawObj.worldCoordLong2Doc(t)},t.prototype.docCoordLong2World=function(t){return this._mxdrawObj.docCoordLong2World(t)},t.prototype.docCoord2World=function(t,e,r){return this._mxdrawObj.docCoord2World(t,e,r)},t.prototype.docCoord2World2=function(t){return this._mxdrawObj.docCoord2World(t.x,t.y,t.z)},t.prototype.worldCoord2Doc=function(t,e,r){return this._mxdrawObj.worldCoord2Doc(t,e,r)},t.prototype.worldCoord2Doc2=function(t){return this._mxdrawObj.worldCoord2Doc(t.x,t.y,t.z)},t.prototype.docCoord2Screen=function(t,e){return this._mxdrawObj.docCoord2Screen(t,e,0)},t.prototype.screenCoordLong2Doc=function(t){return this._mxdrawObj.screenCoordLong2Doc(t)},t.prototype.docCoordLong2Screen=function(t){return this._mxdrawObj.docCoordLong2Screen(t)},t.prototype.screenCoordLong2World=function(t){return this._mxdrawObj.screenCoordLong2World(t)},t.prototype.worldCoordLong2Screen=function(t){return this._mxdrawObj.worldCoordLong2Screen(t)},t.prototype.initRendererParam=function(t){return this._mxdrawObj.initRendererParam(t)},t.prototype.addMxEntity=function(t){return this._mxdrawObj.addMxEntity(t)},t.prototype.getMxCurrentSelect=function(){return this._mxdrawObj.getMxAllSelect()},t.prototype.addMxCurrentSelect=function(t){return this._mxdrawObj.addMxCurrentSelect(t)},t.prototype.clearMxCurrentSelect=function(){return this._mxdrawObj.clearMxCurrentSelect()},t.prototype.getMxEntity=function(t){return this._mxdrawObj.getMxEntityUserObject(t)},t.prototype.findMxEntityAtPoint=function(t){return this._mxdrawObj.findMxEntityAtPoint(t)},t.prototype.getAllMxEntity=function(){return this._mxdrawObj.getAllMxEntity()},t.prototype.setMouseMiddlePan=function(t){return this._mxdrawObj.setMouseMiddlePan(t)},t.prototype.resetThreeJSControls=function(){return this._mxdrawObj.resetThreeJSControls()},t.prototype.enableZoom=function(t){return this._mxdrawObj.enableZoom(t)},t.prototype.enablePan=function(t){return this._mxdrawObj.enablePan(t)},t.prototype.eraseMxEntity=function(t){return this._mxdrawObj.eraseMxEntity(t)},t.prototype.removeViewObject=function(t){this._mxdrawObj.removeViewObject(t)},t.prototype.saveMxEntityToJson=function(){return this._mxdrawObj.saveMxEntityToJson()},t.prototype.loadMxEntityFromJson=function(t,e){return void 0===e&&(e=null),__awaiter(this,void 0,void 0,function(){var r,o;return __generator(this,function(n){switch(n.label){case 0:if(!e)return[3,4];r=e.length,o=0,n.label=1;case 1:return o<r?[4,MxThreeJS_1.default.loadSVG(e[o])]:[3,4];case 2:n.sent(),n.label=3;case 3:return o++,[3,1];case 4:return[2,this._mxdrawObj.loadMxEntityFromJson(t)]}})})},t.prototype.eraseAllMxEntity=function(){return this._mxdrawObj.eraseAllMxEntity()},t.prototype.makeCurrent=function(){this._mxdrawObj.makeCurrent()},t.prototype.getViewCenterDocCoord=function(){return this._mxdrawObj.getViewCenterDocCoord()},t.prototype.updateCanvasSize=function(){this._mxdrawObj.updateCanvasSize()},t.prototype.newFile=function(t,e,r,o){return this._mxdrawObj.newFile(t,e,r,o)},t.prototype.stopAllLoading=function(){return this._mxdrawObj.stopAllLoading()},t.prototype.getOrbitControls=function(){return this._mxdrawObj.getOrbitControls()},t.prototype.getMxDatabase=function(){return new MxDbDatabase_1.default(this._mxdrawObj.getMxDatabase())},t}();exports.default=MxDrawObject;
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,o){return new(r||(r=Promise))(function(n,i){function a(t){try{d(o.next(t))}catch(t){i(t)}}function u(t){try{d(o.throw(t))}catch(t){i(t)}}function d(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(a,u)}d((o=o.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{r=n=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 MxDbDatabase_1=require("../MxDbDatabase"),MxThreeJS_1=require("../MxThreeJS"),MxDrawObject=function(){function t(t){this._mxdrawObj=t}return t.prototype.getScene=function(){return this._mxdrawObj.getScene()},t.prototype.getCamera=function(){return this._mxdrawObj.getCamera()},t.prototype.getRenderer=function(){return this._mxdrawObj.renderer},t.prototype.setMouseRightRotate=function(t){return void 0===t&&(t=!0),this._mxdrawObj.setMouseRightRotate(t)},t.prototype.getFullDisplayRange=function(){return this._mxdrawObj.getFullDisplayRange()},t.prototype.getCanvas=function(){return this._mxdrawObj.getCanvas()},t.prototype.updateDisplay=function(){return this._mxdrawObj.updateDisplay()},t.prototype.createCanvasImageData=function(t,e){return this._mxdrawObj.createCanvasImageData(t,e)},t.prototype.setViewColor=function(t){return this._mxdrawObj.setViewColor(t)},t.prototype.setSize=function(t,e){return this._mxdrawObj.setSize(t,e)},t.prototype.getIntersectObjects=function(t){return this._mxdrawObj.getIntersectObjects(t)},t.prototype.addObject=function(t,e){return void 0===e&&(e=!0),this._mxdrawObj.addObject(t,e)},t.prototype.addViewObject=function(t){return this._mxdrawObj.addViewObject(t)},t.prototype.getViewWidth=function(){return this._mxdrawObj.getViewWidth()},t.prototype.getViewHeight=function(){return this._mxdrawObj.getViewHeight()},t.prototype.removeObject=function(t,e){return void 0===e&&(e=!0),this._mxdrawObj.removeObject(t,e)},t.prototype.zoomInitialStates=function(){return this._mxdrawObj.zoomInitialStates()},t.prototype.zoomScale=function(t){return this._mxdrawObj.zoomScale(t)},t.prototype.zoomW=function(t,e,r){return this._mxdrawObj.zoomW(t,e,r)},t.prototype.zoomCenter=function(t,e){return this._mxdrawObj.zoomCenter(t,e)},t.prototype.initZoomW=function(t,e){return this._mxdrawObj.initZoomW(t,e)},t.prototype.addEvent=function(t,e){return this._mxdrawObj.addEvent(t,e)},t.prototype.on=function(t,e){return this._mxdrawObj.addEvent(t,e)},t.prototype.setIniset=function(t){return this._mxdrawObj.setIniset(t)},t.prototype.screenCoord2World=function(t,e,r){return this._mxdrawObj.screenCoord2World(t,e,r)},t.prototype.worldCoord2Screen=function(t,e,r){return this._mxdrawObj.worldCoord2Screen(t,e,r)},t.prototype.screenCoord2Doc=function(t,e){return this._mxdrawObj.screenCoord2Doc(t,e,0)},t.prototype.worldCoordLong2Doc=function(t){return this._mxdrawObj.worldCoordLong2Doc(t)},t.prototype.docCoordLong2World=function(t){return this._mxdrawObj.docCoordLong2World(t)},t.prototype.docCoord2World=function(t,e,r){return this._mxdrawObj.docCoord2World(t,e,r)},t.prototype.docCoord2World2=function(t){return this._mxdrawObj.docCoord2World(t.x,t.y,t.z)},t.prototype.worldCoord2Doc=function(t,e,r){return this._mxdrawObj.worldCoord2Doc(t,e,r)},t.prototype.worldCoord2Doc2=function(t){return this._mxdrawObj.worldCoord2Doc(t.x,t.y,t.z)},t.prototype.docCoord2Screen=function(t,e){return this._mxdrawObj.docCoord2Screen(t,e,0)},t.prototype.screenCoordLong2Doc=function(t){return this._mxdrawObj.screenCoordLong2Doc(t)},t.prototype.docCoordLong2Screen=function(t){return this._mxdrawObj.docCoordLong2Screen(t)},t.prototype.screenCoordLong2World=function(t){return this._mxdrawObj.screenCoordLong2World(t)},t.prototype.worldCoordLong2Screen=function(t){return this._mxdrawObj.worldCoordLong2Screen(t)},t.prototype.initRendererParam=function(t){return this._mxdrawObj.initRendererParam(t)},t.prototype.addMxEntity=function(t){return this._mxdrawObj.addMxEntity(t)},t.prototype.getMxCurrentSelect=function(){return this._mxdrawObj.getMxAllSelect()},t.prototype.addMxCurrentSelect=function(t){return this._mxdrawObj.addMxCurrentSelect(t)},t.prototype.clearMxCurrentSelect=function(){return this._mxdrawObj.clearMxCurrentSelect()},t.prototype.getMxEntity=function(t){return this._mxdrawObj.getMxEntityUserObject(t)},t.prototype.findMxEntityAtPoint=function(t){return this._mxdrawObj.findMxEntityAtPoint(t)},t.prototype.getAllMxEntity=function(){return this._mxdrawObj.getAllMxEntity()},t.prototype.setMouseMiddlePan=function(t){return this._mxdrawObj.setMouseMiddlePan(t)},t.prototype.resetThreeJSControls=function(){return this._mxdrawObj.resetThreeJSControls()},t.prototype.enableZoom=function(t){return this._mxdrawObj.enableZoom(t)},t.prototype.enablePan=function(t){return this._mxdrawObj.enablePan(t)},t.prototype.eraseMxEntity=function(t){return this._mxdrawObj.eraseMxEntity(t)},t.prototype.removeViewObject=function(t){this._mxdrawObj.removeViewObject(t)},t.prototype.saveMxEntityToJson=function(){return this._mxdrawObj.saveMxEntityToJson()},t.prototype.loadMxEntityFromJson=function(t,e){return void 0===e&&(e=null),__awaiter(this,void 0,void 0,function(){var r,o;return __generator(this,function(n){switch(n.label){case 0:if(!e)return[3,4];r=e.length,o=0,n.label=1;case 1:return o<r?[4,MxThreeJS_1.default.loadSVG(e[o])]:[3,4];case 2:n.sent(),n.label=3;case 3:return o++,[3,1];case 4:return[2,this._mxdrawObj.loadMxEntityFromJson(t)]}})})},t.prototype.eraseAllMxEntity=function(){return this._mxdrawObj.eraseAllMxEntity()},t.prototype.makeCurrent=function(){this._mxdrawObj.makeCurrent()},t.prototype.getViewCenterDocCoord=function(){return this._mxdrawObj.getViewCenterDocCoord()},t.prototype.updateCanvasSize=function(){this._mxdrawObj.updateCanvasSize()},t.prototype.newFile=function(t,e,r,o){return this._mxdrawObj.newFile(t,e,r,o)},t.prototype.stopAllLoading=function(){return this._mxdrawObj.stopAllLoading()},t.prototype.getOrbitControls=function(){return this._mxdrawObj.getOrbitControls()},t.prototype.getMxDatabase=function(){return new MxDbDatabase_1.default(this._mxdrawObj.getMxDatabase())},t}();exports.default=MxDrawObject;
@@ -1 +1 @@
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"),mxfun_es5_js_1=require("./mxfun.es5.js"),mxcadassembly_es5_js_1=require("./mxcadassembly_es5.js");function rxInitMxEntity(){var e;null===(e=store_1.default.state.MxFun)||void 0===e||e.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";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"),mxfun_es5_js_1=require("./mxfun.es5.js"),mxcadassembly_es5_js_1=require("./mxcadassembly_es5.js");function rxInitMxEntity(){var e;null===(e=store_1.default.state.MxFun)||void 0===e||e.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("mx loadCoreCode ady call"),t(),[2]):(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;