mxdraw 0.1.24 → 0.1.25
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/Mx3PointArc/Mx3PointArc.js +1 -0
- package/dist/lib/MxModule/Mx3PointArc/index.js +1 -0
- package/dist/lib/MxModule/MxDb2LineAngularDimension/MxDb2LineAngularDimension.js +1 -0
- package/dist/lib/MxModule/MxDb2LineAngularDimension/index.js +1 -0
- package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +1 -1
- package/dist/lib/MxModule/MxDbAnyLine/MxDbAnyLine.js +1 -0
- package/dist/lib/MxModule/MxDbAnyLine/index.js +1 -0
- package/dist/lib/MxModule/MxDbArea/MxDbArea.js +1 -1
- package/dist/lib/MxModule/MxDbCoord/MxDbCoord.js +1 -0
- package/dist/lib/MxModule/MxDbCoord/index.js +1 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -1
- package/dist/lib/mxdraw.js +1 -1
- package/dist/lib/tools/dynamicImport/index.js +1 -1
- package/dist/lib/tools/three/index.js +1 -1
- package/dist/mxdraw.es5.js +1 -1
- package/dist/mxdraw.umd.js +1 -1
- package/dist/types/MxModule/Mx3PointArc/Mx3PointArc.d.ts +19 -0
- package/dist/types/MxModule/Mx3PointArc/index.d.ts +3 -0
- package/dist/types/MxModule/MxDb2LineAngularDimension/MxDb2LineAngularDimension.d.ts +22 -0
- package/dist/types/MxModule/MxDb2LineAngularDimension/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbAnyLine/MxDbAnyLine.d.ts +18 -0
- package/dist/types/MxModule/MxDbAnyLine/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbArea/MxDbArea.d.ts +1 -1
- package/dist/types/MxModule/MxDbCoord/MxDbCoord.d.ts +19 -0
- package/dist/types/MxModule/MxDbCoord/index.d.ts +3 -0
- package/dist/types/MxModule/MxFun/MxFun.d.ts +4 -4
- package/dist/types/mxdraw.d.ts +9 -1
- package/dist/types/tools/three/index.d.ts +28 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(n,o){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])})(n,o)};return function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=n}t(n,o),n.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:!0});var three_1=require("three"),MxDbEntity_1=require("../MxDbEntity"),index_1=require("../../tools/three/index"),Mx3PointArc=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.point1=new three_1.Vector3,n.point2=new three_1.Vector3,n.point3=new three_1.Vector3,n}return __extends(n,t),n.prototype.getTypeName=function(){return"Mx3PointArc"},n.prototype.create=function(){return new n},n.prototype.worldDraw=function(t){var n=(0,index_1.createThreePointArc)(this.point1,this.point2,this.point3,!0).arc;t.drawEntity(n)},n.prototype.getGripPoints=function(){return[this.point1,this.point2,this.point3]},n.prototype.moveGripPointsAt=function(t,n){return 0===t?this.point1.add(n):1===t?this.point2.add(n):2===t&&this.point3.add(n),!0},n.prototype.dwgIn=function(t){return this.onDwgIn(t),this.point1.copy(t.point1),this.point2.copy(t.point2),this.point3.copy(t.point3),t},n.prototype.dwgOut=function(t){return this.onDwgOut(t),t.point1=this.point1,t.point2=this.point2,t.point3=this.point3,t},n}(MxDbEntity_1.default);exports.default=Mx3PointArc;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Mx3PointArc_1=require("./Mx3PointArc");exports.default=Mx3PointArc_1.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),three_1=require("three"),McGiWorldDrawType_1=require("../McGiWorldDrawType"),MxDbEntity_1=require("../MxDbEntity"),MxThreeJS_1=require("../MxThreeJS"),MxDb2LineAngularDimension=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.point1=new THREE.Vector3,e.point2=new THREE.Vector3,e.point3=new THREE.Vector3,e}return __extends(e,t),e.prototype.calculateLineAngle=function(t,e,n){var i=2*Math.PI/360;return{startAngle:180*Math.atan2(e.y-t.y,e.x-t.x)/Math.PI*i,endAngle:180*Math.atan2(n.y-t.y,n.x-t.x)/Math.PI*i}},e.prototype.worldDraw=function(t){if(t.getType()==McGiWorldDrawType_1.default.kWorldDraw||t.getType()==McGiWorldDrawType_1.default.kDynDragDraw){var e=t.getColor(),n=t.getMxObject(),i=MxThreeJS_1.default.createLine(this.point1,this.point2,e);t.drawEntity(i);var o=MxThreeJS_1.default.createLine(this.point2,this.point3,e);t.drawEntity(o);var r=this.calculateLineAngle(this.point2,this.point1,this.point3),p=r.startAngle,a=r.endAngle,s=this.point2.distanceTo(this.point1),h=this.point2.distanceTo(this.point3),u=(s>h?h:s)/4,c=three_1.MathUtils.radToDeg(p-a);c<0&&(c+=360);var l=n.screenCoordLong2Doc(50),y=new three_1.ArcCurve(this.point2.x,this.point2.y,u,p,a,!0),d=(new three_1.BufferGeometry).setFromPoints(y.getPoints(50)),f=new three_1.LineBasicMaterial({color:"#ff0000"}),w=new three_1.Line(d,f);t.drawEntity(w);var _=y.getPoint(.5),x=new THREE.Vector3(_.x,_.y,0),g=x.sub(this.point2),M=g.length()+.5*l;g.normalize().multiplyScalar(M),x=this.point2.clone().add(g);var D=MxThreeJS_1.default.creatTextSprite(c.toFixed(3)+"°",x,.5*l,0,e);null!=D&&t.drawEntity(D)}else t.drawLine(this.point1,this.point2),t.drawLine(this.point3,this.point2)},e.prototype.getGripPoints=function(){return[this.point1,this.point2,this.point3]},e.prototype.moveGripPointsAt=function(t,e){return 0===t?this.point1.add(e):1===t?this.point2.add(e):2===t&&this.point3.add(e),!0},e.prototype.dwgIn=function(t){return this.onDwgIn(t),this.point1.copy(t.point1),this.point2.copy(t.point2),this.point3.copy(t.point3),t},e.prototype.dwgOut=function(t){return this.onDwgOut(t),t.point1=this.point1,t.point2=this.point2,t.point3=this.point3,t},e.prototype.create=function(){return new e},e.prototype.transformBy=function(t){this.point1.applyMatrix4(t),this.point2.applyMatrix4(t)},e.prototype.getTypeName=function(){return"MxDb2LineAngularDimension"},e}(MxDbEntity_1.default);exports.default=MxDb2LineAngularDimension;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxDb2LineAngularDimension_1=require("./MxDb2LineAngularDimension");exports.default=MxDb2LineAngularDimension_1.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),McGiWorldDrawType_1=require("../McGiWorldDrawType"),MxDbEntity_1=require("../MxDbEntity"),
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),McGiWorldDrawType_1=require("../McGiWorldDrawType"),MxDbEntity_1=require("../MxDbEntity"),MxThreeJS_1=require("../MxThreeJS"),MxDbAlignedDimension=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.pt1=new THREE.Vector3,e.pt2=new THREE.Vector3,e}return __extends(e,t),e.prototype.getTypeName=function(){return"MxDbAlignedDimension"},e.prototype.getDirection=function(t,e,r){var n=new THREE.Vector3(t.x,t.y,0),o=new THREE.Vector3(1,0,0),a=t.angleTo(o),i=-1;(a<7*Math.PI/18||a>10*Math.PI/18)&&e.x>r.x&&(i=1);var p=new THREE.Matrix4;return p.makeRotationZ(Math.PI/2*i),n.applyMatrix4(p),n},e.prototype.worldDraw=function(t){if(t.getType()==McGiWorldDrawType_1.default.kWorldDraw||t.getType()==McGiWorldDrawType_1.default.kDynDragDraw){var e,r,n,o,a,i,p,y=this.pt1,c=this.pt2,x=new THREE.Vector3(y.x-c.x,y.y-c.y,0),E=this.getDirection(x,y,c),u=x.length(),l=new THREE.Matrix4;l.makeScale(.01,.01,.01),(d=new THREE.Vector3(E.x,E.y,0)).applyMatrix4(l);var w=new THREE.Vector3(y.x+d.x,y.y+d.y,0),T=new THREE.Vector3(c.x+d.x,c.y+d.y,0),s=16777215;i=MxThreeJS_1.default.createPoint(y,s),p=MxThreeJS_1.default.createPoint(c,s),l.identity(),l.makeScale(.2,.2,0),new THREE.Vector3(E.x,E.y,0).applyMatrix4(l),l.identity(),l.makeScale(.02,.02,0);var h=new THREE.Vector3(E.x,E.y,0);h.applyMatrix4(l),t.drawLine(w,T),e=MxThreeJS_1.default.createLine(new THREE.Vector3(w.x+2*h.x,w.y+2*h.y,0),new THREE.Vector3(y.x+h.x,y.y+h.y,0),s),r=MxThreeJS_1.default.createLine(new THREE.Vector3(T.x+2*h.x,T.y+2*h.y,0),new THREE.Vector3(c.x+h.x,c.y+h.y,0),s);var d,M=new THREE.Vector3(1,0,0),f=x.angleTo(M);(d=new THREE.Vector3(E.x,E.y,0)).normalize();var R=y.distanceTo(c);x.y<0?f=f<Math.PI/2?2*Math.PI-f:Math.PI-f:f>Math.PI/2&&(f=Math.PI+f),null!=(n=MxThreeJS_1.default.creatTextSprite(u.toFixed(3),new THREE.Vector3(T.x+x.x/2+d.x*R/30,T.y+x.y/2+d.y*R/30,0),.07*R,f,s))&&t.drawEntity(n),l.identity(),l.makeScale(.08,.08,.08);var H=new THREE.Matrix4;H.makeRotationZ(17*Math.PI/18);var _=new THREE.Vector3(x.x,x.y,0);_.applyMatrix4(l),_.applyMatrix4(H),H.identity(),H.makeRotationZ(17*-Math.PI/18);var V=new THREE.Vector3(x.x,x.y,0);V.applyMatrix4(l),V.applyMatrix4(H);var D=new Array;D.push(new THREE.Vector3(w.x,w.y,0),new THREE.Vector3(w.x+_.x,w.y+_.y,0),new THREE.Vector3(w.x+V.x,w.y+V.y,0)),o=MxThreeJS_1.default.createTriangle(D,s),H.identity(),H.makeRotationZ(Math.PI/18),(_=new THREE.Vector3(x.x,x.y,0)).applyMatrix4(l),_.applyMatrix4(H),H.identity(),H.makeRotationZ(-Math.PI/18),(V=new THREE.Vector3(x.x,x.y,0)).applyMatrix4(l),V.applyMatrix4(H);var v=new Array;v.push(new THREE.Vector3(T.x,T.y,0),new THREE.Vector3(T.x+_.x,T.y+_.y,0),new THREE.Vector3(T.x+V.x,T.y+V.y,0)),a=MxThreeJS_1.default.createTriangle(v,s),t.drawEntity(e),t.drawEntity(r),o&&t.drawEntity(o),a&&t.drawEntity(a),t.drawEntity(i),t.drawEntity(p)}else t.drawLine(this.pt1,this.pt2)},e.prototype.setPoint1=function(t){this.pt1=t},e.prototype.setPoint2=function(t){this.pt2=t},e.prototype.getGripPoints=function(){var t=[];return t.push(this.pt1),t.push(this.pt2),t},e.prototype.moveGripPointsAt=function(t,e){return 0==t?this.pt1.add(e):(t=1)&&this.pt2.add(e),!0},e.prototype.dwgIn=function(t){return this.onDwgIn(t),this.pt1.copy(t.pt1),this.pt2.copy(t.pt2),!0},e.prototype.dwgOut=function(t){return this.onDwgOut(t),t.pt1=this.pt1,t.pt2=this.pt2,t},e.prototype.create=function(){return new e},e}(MxDbEntity_1.default);exports.default=MxDbAlignedDimension;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(exports,"__esModule",{value:!0});var index_1=require("../../tools/three/index"),three_1=require("three"),MxDbEntity_1=require("../MxDbEntity"),McGiWorldDrawType_1=require("../McGiWorldDrawType"),MxDbAnyLine=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.points=[],e}return __extends(e,t),e.prototype.getTypeName=function(){return"MxDbAnyLine"},e.prototype.create=function(){return new e},e.prototype.worldDraw=function(t){var e=t.getMxObject(),n=(0,index_1.createAnyLine)(this.points);n.geometry.computeBoundingBox();var r=new three_1.Vector3;if(n.geometry.boundingBox.getCenter(r),t.drawEntity(n),t.getType()===McGiWorldDrawType_1.default.kSelectDraw){var o=new three_1.Vector3;n.geometry.boundingBox.getSize(o),o.addScalar(e.screenCoordLong2Doc(20));var i=o.x/2,u=o.y/2,p={x:r.x-i,y:r.y-u},y={x:r.x+i,y:r.y-u},c={x:r.x+i,y:r.y+u},s={x:r.x-i,y:r.y+u};t.drawLine(p.x,p.y,y.x,y.y),t.drawLine(y.x,y.y,c.x,c.y),t.drawLine(c.x,c.y,s.x,s.y),t.drawLine(s.x,s.y,p.x,p.y)}},e.prototype.getCenter=function(){var t=new three_1.Geometry;t.vertices=this.points;var e=new three_1.Vector3;return t.computeBoundingBox(),t.boundingBox.getCenter(e),e},e.prototype.getGripPoints=function(){return[this.getCenter()]},e.prototype.moveGripPointsAt=function(t,e){return this.points.forEach(function(t){t.add(e)}),!0},e.prototype.dwgIn=function(t){var e=this;this.onDwgIn(t);var n=t.points;return this.points=[],n.forEach(function(t){e.points.push(new three_1.Vector3(t.x,t.y,t.z))}),!0},e.prototype.dwgOut=function(t){return this.onDwgOut(t),t.points=this.points,t},e}(MxDbEntity_1.default);exports.default=MxDbAnyLine;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxDbAnyLine_1=require("./MxDbAnyLine");exports.default=MxDbAnyLine_1.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __extends=this&&this.__extends||function(){var t=function(
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(n,e){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])})(n,e)};return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=n}t(n,e),n.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),McGeTool_1=require("../McGeTool"),MxDbEntity_1=require("../MxDbEntity"),MxFun_1=require("../MxFun"),MxThreeJS_1=require("../MxThreeJS"),MxDbArea=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.points=[],n}return __extends(n,t),n.prototype.getTypeName=function(){return"MxDbArea"},n.prototype.create=function(){return new n},n.prototype.worldDraw=function(t){if(this.points.length<3)2==this.points.length&&t.drawLine(this.points[0],this.points[1]);else{for(var n=this.points[0],e=n.clone(),o=n.clone(),r=this.points.length,i=1;i<r;i++){var s=this.points[i];e.x>s.x&&(e.x=s.x),e.y>s.y&&(e.y=s.y),o.x<s.x&&(o.x=s.x),o.y<s.y&&(o.y=s.y),t.drawLine(n,s),n=s}t.drawLine(n,this.points[0]);var p=McGeTool_1.default.calcArea(this.points),u=new THREE.Vector3(e.x+.5*(o.x-e.x),e.y+.5*(o.y-e.y)),c=MxFun_1.default.screenCoordLong2Doc(20),a=MxThreeJS_1.default.creatTextSprite(p.toFixed(2),u,c,0,16777215);null!=a&&t.drawEntity(a)}},n.prototype.getGripPoints=function(){return this.points},n.prototype.moveGripPointsAt=function(t,n){return!(t>=this.points.length)&&(this.points[t].add(n),!0)},n.prototype.dwgIn=function(t){var n=this;this.onDwgIn(t);var e=t.points;return this.points=[],e.forEach(function(t){n.points.push(new THREE.Vector3(t.x,t.y,t.z))}),!0},n.prototype.dwgOut=function(t){return this.onDwgOut(t),t.points=this.points,t},n.prototype.addPoint=function(t){this.points.push(t.clone())},n.prototype.getPoints=function(){return this.points},n.prototype.clearPoint=function(){this.points=[]},n}(MxDbEntity_1.default);exports.default=MxDbArea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(o,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])})(o,n)};return function(o,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=o}t(o,n),o.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),MxDbEntity_1=require("../MxDbEntity"),MxDbCoord=function(t){function o(){var o=null!==t&&t.apply(this,arguments)||this;return o.point1=new THREE.Vector3,o.point2=new THREE.Vector3,o}return __extends(o,t),o.prototype.worldDraw=function(t){var o=t.getMxObject();t.drawLine(this.point1,this.point2);var n=this.point2.clone(),i=o.screenCoordLong2Doc(20),r=6*i;n.x=n.x+r,t.drawLine(this.point2,n);var e=new THREE.Vector3,p=new THREE.Vector3,s=this.point1.x.toFixed(3),u=this.point1.y.toFixed(3);e.x=this.point2.x+.3*i+.5*r,e.y=this.point2.y+.1*i+.5*i,t.drawText(s,i,0,e),p.x=this.point2.x+.3*i+.5*r,p.y=this.point2.y-.1*i-.5*i,t.drawText(u,i,0,p)},o.prototype.getGripPoints=function(){var t=[];return t.push(this.point1),t.push(this.point2),t},o.prototype.moveGripPointsAt=function(t,o){return 0==t?this.point1.add(o):1==t&&this.point2.add(o),!0},o.prototype.dwgIn=function(t){return this.onDwgIn(t),this.point1.copy(t.point1),this.point2.copy(t.point2),!0},o.prototype.dwgOut=function(t){return this.onDwgOut(t),t.point1=this.point1,t.point2=this.point2,t},o.prototype.create=function(){return new o},o.prototype.transformBy=function(t){this.point1.applyMatrix4(t),this.point2.applyMatrix4(t)},o.prototype.getTypeName=function(){return"MxDbCoord"},o}(MxDbEntity_1.default);exports.default=MxDbCoord;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxDbCoord_1=require("./MxDbCoord");exports.default=MxDbCoord_1.default;
|