mxdraw 0.1.122 → 0.1.123
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/index.d.ts +10 -9
- package/dist/lib/MxModule/MxDbArcShape/index.d.ts +0 -1
- package/dist/lib/MxModule/MxDbArcShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbEllipseArc/index.d.ts +3 -6
- package/dist/lib/MxModule/MxDbEllipseArc/index.js +1 -1
- package/dist/lib/MxModule/MxDbShape/index.d.ts +3 -1
- package/dist/lib/MxModule/MxDbShape/index.js +1 -1
- package/dist/lib/MxModule/MxDbStarShape/index.d.ts +4 -1
- package/dist/mxdraw.es.js +1 -1
- package/dist/mxdraw.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3495,7 +3495,9 @@ declare class MxDbShape extends MxDbEntity {
|
|
|
3495
3495
|
isFill: boolean;
|
|
3496
3496
|
setIsFill(isFill: boolean): this;
|
|
3497
3497
|
/** 填充图片路径 */
|
|
3498
|
-
|
|
3498
|
+
protected _fillImageSrc: string | false | null;
|
|
3499
|
+
get fillImageSrc(): string | false | null;
|
|
3500
|
+
set fillImageSrc(src: string | false | null);
|
|
3499
3501
|
setFillImageSrc(fillImageSrc: string): this;
|
|
3500
3502
|
/**
|
|
3501
3503
|
* fillImageParam 填充背景图片的参数设置(如果使用了滤镜则部分参数功能失效)
|
|
@@ -4291,11 +4293,11 @@ declare class MxDbGradientLine extends MxDbEntity {
|
|
|
4291
4293
|
dwgOut(obj: any): object;
|
|
4292
4294
|
}
|
|
4293
4295
|
|
|
4296
|
+
/**
|
|
4297
|
+
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
4298
|
+
* */
|
|
4294
4299
|
declare class MxDbEllipseArc extends MxDbEllipseShape {
|
|
4295
4300
|
getTypeName(): string;
|
|
4296
|
-
/**
|
|
4297
|
-
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
4298
|
-
* */
|
|
4299
4301
|
constructor();
|
|
4300
4302
|
/** 椭圆弧决定开始点 控制x轴半径和开始角度 */
|
|
4301
4303
|
startPoint: THREE.Vector3;
|
|
@@ -4303,9 +4305,6 @@ declare class MxDbEllipseArc extends MxDbEllipseShape {
|
|
|
4303
4305
|
/** 椭圆弧决定结束点 控制y轴半径和结束角度*/
|
|
4304
4306
|
endPoint: THREE.Vector3;
|
|
4305
4307
|
setEndPoint(endPoint: THREE.Vector3): this;
|
|
4306
|
-
/** 控制椭圆弧旋转角度的点 */
|
|
4307
|
-
rotationPoint: THREE.Vector3;
|
|
4308
|
-
setRotationPoint(rotationPoint: THREE.Vector3): this;
|
|
4309
4308
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
4310
4309
|
getGripPoints(): three.Vector3[];
|
|
4311
4310
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
@@ -4331,7 +4330,6 @@ declare class MxDbArcShape extends MxDbCircleArc {
|
|
|
4331
4330
|
/** 环形 */
|
|
4332
4331
|
constructor();
|
|
4333
4332
|
getTypeName(): string;
|
|
4334
|
-
create(): MxDbArcShape;
|
|
4335
4333
|
center: three.Vector3;
|
|
4336
4334
|
innerRadius: number;
|
|
4337
4335
|
outerRadius: number;
|
|
@@ -4358,13 +4356,16 @@ declare class MxDbRingShape extends MxDbArcShape {
|
|
|
4358
4356
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
4359
4357
|
}
|
|
4360
4358
|
|
|
4359
|
+
/** 星形 */
|
|
4361
4360
|
declare class MxDbStarShape extends MxDbShape {
|
|
4362
4361
|
getTypeName(): string;
|
|
4363
|
-
/** 星形 */
|
|
4364
4362
|
constructor();
|
|
4365
4363
|
center: three.Vector3;
|
|
4364
|
+
/** 顶点数量 */
|
|
4366
4365
|
numPoints: number;
|
|
4366
|
+
/** 内部半径 */
|
|
4367
4367
|
innerRadius: number;
|
|
4368
|
+
/** 外部半径 */
|
|
4368
4369
|
outerRadius: number;
|
|
4369
4370
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
4370
4371
|
getGripPoints(): THREE.Vector3[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import MxDbCircleArc from"../MxDbCircleArc";export default class MxDbArcShape extends MxDbCircleArc{constructor(){super(),this.center=new THREE.Vector3,this.innerRadius=10,this.outerRadius=20,this._propertyDbKeys=[...this._propertyDbKeys,"center","innerRadius","outerRadius"]}getTypeName(){return"MxDbArcShape"}
|
|
1
|
+
import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbCircleArc from"../MxDbCircleArc";export default class MxDbArcShape extends MxDbCircleArc{constructor(){super(),this.center=new THREE.Vector3,this.innerRadius=10,this.outerRadius=20,this._propertyDbKeys=[...this._propertyDbKeys,"center","innerRadius","outerRadius"]}getTypeName(){return"MxDbArcShape"}worldDraw(e){e.getType()===McGiWorldDrawType.kDynDragDraw?(e.drawCircle(this.center,this.innerRadius),e.drawCircle(this.center,this.outerRadius)):this.drawArcShape(e)}drawArcShape(e){const{center:r,startAngle:t,endAngle:i,clockwise:s}=this,{x:a,y:n}=r;this.isClosedToCenter=!1;const c=this.createEllipseCurve(a,n,this.innerRadius,this.innerRadius,t,i,s),h=this.createEllipseCurve(a,n,this.outerRadius,this.outerRadius,i,t,!s),o=this.createPaths([c,h]);let d=this.getShapePoints(o);this._draw(e,d),this._drawStoreLine(e,d)}getGripPoints(){return[this.center]}moveGripPointsAt(e,r){return 0===e&&this.center.add(r),!0}};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbEllipseShape from "../MxDbEllipseShape";
|
|
3
|
+
/**
|
|
4
|
+
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
5
|
+
* */
|
|
3
6
|
export default class MxDbEllipseArc extends MxDbEllipseShape {
|
|
4
7
|
getTypeName(): string;
|
|
5
|
-
/**
|
|
6
|
-
* 根据中心点、椭圆开始点和结束点确定椭圆弧
|
|
7
|
-
* */
|
|
8
8
|
constructor();
|
|
9
9
|
/** 椭圆弧决定开始点 控制x轴半径和开始角度 */
|
|
10
10
|
startPoint: THREE.Vector3;
|
|
@@ -12,9 +12,6 @@ export default class MxDbEllipseArc extends MxDbEllipseShape {
|
|
|
12
12
|
/** 椭圆弧决定结束点 控制y轴半径和结束角度*/
|
|
13
13
|
endPoint: THREE.Vector3;
|
|
14
14
|
setEndPoint(endPoint: THREE.Vector3): this;
|
|
15
|
-
/** 控制椭圆弧旋转角度的点 */
|
|
16
|
-
rotationPoint: THREE.Vector3;
|
|
17
|
-
setRotationPoint(rotationPoint: THREE.Vector3): this;
|
|
18
15
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
19
16
|
getGripPoints(): import("three").Vector3[];
|
|
20
17
|
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{calculateArcAngle}from"../../tools/three";import MxDbEllipseShape from"../MxDbEllipseShape";export default class MxDbEllipseArc extends MxDbEllipseShape{constructor(){super(),this._propertyDbKeys=[...this._propertyDbKeys,"startPoint","endPoint"
|
|
1
|
+
import{calculateArcAngle}from"../../tools/three";import MxDbEllipseShape from"../MxDbEllipseShape";export default class MxDbEllipseArc extends MxDbEllipseShape{constructor(){super(),this._propertyDbKeys=[...this._propertyDbKeys,"startPoint","endPoint"]}getTypeName(){return"MxDbEllipseArc"}setStartPoint(t){return this.startPoint=t,this}setEndPoint(t){return this.endPoint=t,this}worldDraw(t){let{center:e,startPoint:i,endPoint:s}=this;i&&(this.xRadius=e.distanceTo(i),this.startAngle=THREE.MathUtils.degToRad(calculateArcAngle(i,e,this.xRadius).angle)),s&&(this.yRadius=e.distanceTo(s),this.endAngle=THREE.MathUtils.degToRad(calculateArcAngle(s,e,this.yRadius).angle)),this.drawEllipseShape(t)}getGripPoints(){return[this.center,this.startPoint,this.endPoint]}moveGripPointsAt(t,e){return 0===t&&(this.center.add(e),this.startPoint.add(e),this.endPoint.add(e)),1===t&&this.startPoint.add(e),2===t&&this.endPoint.add(e),!0}};
|
|
@@ -25,7 +25,9 @@ export default class MxDbShape extends MxDbEntity {
|
|
|
25
25
|
isFill: boolean;
|
|
26
26
|
setIsFill(isFill: boolean): this;
|
|
27
27
|
/** 填充图片路径 */
|
|
28
|
-
|
|
28
|
+
protected _fillImageSrc: string | false | null;
|
|
29
|
+
get fillImageSrc(): string | false | null;
|
|
30
|
+
set fillImageSrc(src: string | false | null);
|
|
29
31
|
setFillImageSrc(fillImageSrc: string): this;
|
|
30
32
|
/**
|
|
31
33
|
* fillImageParam 填充背景图片的参数设置(如果使用了滤镜则部分参数功能失效)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getToGenerateRoundedCorners,repairGeometryFaceVertexUvs}from"../../tools/three";import McGeTool from"../McGeTool";import MxDbEntity from"../MxDbEntity";import MxFilters from"../MxFilters";import MxFun from"../MxFun";import MxType from"../MxType";export default class MxDbShape extends MxDbEntity{constructor(){super(...arguments),this.isLoadMaterialFromPath=!0,this.strokeLineWidth=2,this.isStrokeDashLine=!1,this.isFill=!1,this.curveSegments=50,this.closed=!0,this.cornerRadius=[],this._propertyDbKeys=["isFill","stroke","strokeLineWidth","isStrokeDashLine","closed","cornerRadius","fillImageSrc","fillImageParam"]}setStroke(t){return this.stroke=t,this}setStrokeLineWidth(t){return this.strokeLineWidth=t,this}setIsStrokeDashLine(t){return this.isStrokeDashLine=t,this}setIsFill(t){return this.isFill=t,this}setFillImageSrc(t){return this.fillImageSrc=t,this}setCurveSegments(t){return this.curveSegments=t,this}setClosed(t){return this.closed=t,this}setCornerRadius(t,e=!0){t instanceof Array?this.cornerRadius=t.map(t=>e?MxFun.screenCoordLong2Doc(t):t):this.cornerRadius=e?MxFun.screenCoordLong2Doc(t):t}getTypeName(){return"MxDbShape"}getShapePoints(t){const{curveSegments:e}=this;return this.points=t.getPoints(e).map(t=>t instanceof THREE.Vector2?new THREE.Vector3(t.x,t.y,0):t),this.points}createPaths(t){return this._paths=new THREE.CurvePath,Array.isArray(t)?t.forEach(t=>this._paths.add(t)):this._paths.add(t),this._paths}_draw(t,e){
|
|
1
|
+
import{getToGenerateRoundedCorners,repairGeometryFaceVertexUvs}from"../../tools/three";import McGeTool from"../McGeTool";import MxDbEntity from"../MxDbEntity";import MxFilters from"../MxFilters";import MxFun from"../MxFun";import MxType from"../MxType";export default class MxDbShape extends MxDbEntity{constructor(){super(...arguments),this.isLoadMaterialFromPath=!0,this.strokeLineWidth=2,this.isStrokeDashLine=!1,this.isFill=!1,this.curveSegments=50,this.closed=!0,this.cornerRadius=[],this._propertyDbKeys=["isFill","stroke","strokeLineWidth","isStrokeDashLine","closed","cornerRadius","fillImageSrc","fillImageParam"]}setStroke(t){return this.stroke=t,this}setStrokeLineWidth(t){return this.strokeLineWidth=t,this}setIsStrokeDashLine(t){return this.isStrokeDashLine=t,this}setIsFill(t){return this.isFill=t,this}get fillImageSrc(){return this._fillImageSrc}set fillImageSrc(t){this._fillImageSrc=t,this.isLoadMaterialFromPath=!0,this.material=null}setFillImageSrc(t){return this.fillImageSrc=t,this}setCurveSegments(t){return this.curveSegments=t,this}setClosed(t){return this.closed=t,this}setCornerRadius(t,e=!0){t instanceof Array?this.cornerRadius=t.map(t=>e?MxFun.screenCoordLong2Doc(t):t):this.cornerRadius=e?MxFun.screenCoordLong2Doc(t):t}getTypeName(){return"MxDbShape"}getShapePoints(t){const{curveSegments:e}=this;return this.points=t.getPoints(e).map(t=>t instanceof THREE.Vector2?new THREE.Vector3(t.x,t.y,0):t),this.points}createPaths(t){return this._paths=new THREE.CurvePath,Array.isArray(t)?t.forEach(t=>this._paths.add(t)):this._paths.add(t),this._paths}_draw(t,e){let{isFill:i,closed:s}=this;const r=t.getColor();t.setColor(this.filter?this.filter._getFilterColor(this.color,this.opacity):this.color);const o=this.getCornerRadiusPoints(s||i?this.getClosedPoints(e):e);i?!this.fillImageSrc&&t.drawSolid(o):t.drawLines(o),this._fillImg(t,o),t.setColor(r)}getCornerRadiusPoints(t){const{cornerRadius:e}=this;if(!e)return t;const i="number"==typeof e?t.map(()=>e):e;return i.length>0?getToGenerateRoundedCorners(t,i):t}_drawStoreLine(t,e,i){const{isFill:s,stroke:r,strokeLineWidth:o}=this,a=t.getLineWidth(),n=t.getColor(),l=t.isDashLineDisplay();r&&s&&(t.setDashLineDisplay(this.isStrokeDashLine),t.setColor(r),t.setLineWidth(o),i?i(t):t.drawLines(this.getCornerRadiusPoints(this.getClosedPoints(e))),t.setColor(n),t.setLineWidth(a),t.setDashLineDisplay(l))}getClosedPoints(t){return[...t,t[0]]}getTotalLength(){return this._paths?this._paths.getLength()+(this.closedLine?this.closedLine.getLength():0):0}getArea(){return this.points?McGeTool.calcArea(this.closed?this.getClosedPoints(this.points):this.points):0}worldDraw(t){const e=this.createPaths(new THREE.Curve),i=this.getShapePoints(e);this._draw(t,i),this._drawStoreLine(t,i)}_fillImg(t,e){const i={transparent:!0,depthTest:!1,opacity:this.opacity,visible:this.visible};if(!this.isFill||!this.fillImageSrc)return;if(!this.material){let t=this;return void MxFun.loadImageMaterial(this.fillImageSrc,e=>{t.isLoadMaterialFromPath=!1,e&&(t.material=e,t.setNeedUpdateDisplay(),MxFun.updateDisplay())})}const s=e.map(({x:t,y:e})=>new THREE.Vector2(t,e));let r=this.material,o=new THREE.ShapeGeometry(new THREE.Shape(s));if(o=repairGeometryFaceVertexUvs(o),this.filter){const t=r.map,e=this.filter._getFilterShaderData(t);r=new THREE.ShaderMaterial(Object.assign(Object.assign({},e),i))}if(r.depthTest=!1,r.transparent=!0,r.opacity=this.opacity,r.visible=this.visible,this.fillImageParam){const t=this.fillImageParam;for(let e in this.fillImageParam){this.material.map[e]=t[e]}}let a=new THREE.Mesh(o,r);t.drawEntity(a)}getGripPoints(){return[]}moveGripPointsAt(t,e){return!0}dwgIn(t){return this.dwgInHelp(t,this._propertyDbKeys),this.isLoadMaterialFromPath=!0,this.material=null,t.type===MxType.MxCloneType.kMxFileClone?this.filter=MxFilters.fromJSON(t.filter):t.filter&&(this.filter=t.filter),!0}dwgOut(t){var e;return this.dwgOutHelp(t,this._propertyDbKeys),t.type===MxType.MxCloneType.kMxFileClone?this.filter&&(t.filter=null===(e=this.filter)||void 0===e?void 0:e.toJSON()):t.filter=this.filter,t}};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import McGiWorldDraw from "../McGiWorldDraw";
|
|
2
2
|
import MxDbShape from "../MxDbShape";
|
|
3
|
+
/** 星形 */
|
|
3
4
|
export default class MxDbStarShape extends MxDbShape {
|
|
4
5
|
getTypeName(): string;
|
|
5
|
-
/** 星形 */
|
|
6
6
|
constructor();
|
|
7
7
|
center: import("three").Vector3;
|
|
8
|
+
/** 顶点数量 */
|
|
8
9
|
numPoints: number;
|
|
10
|
+
/** 内部半径 */
|
|
9
11
|
innerRadius: number;
|
|
12
|
+
/** 外部半径 */
|
|
10
13
|
outerRadius: number;
|
|
11
14
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
12
15
|
getGripPoints(): THREE.Vector3[];
|