mxdraw 0.1.3 → 0.1.4
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/MxDbImage/MxDbImage.js +2 -5
- package/dist/lib/MxModule/MxDbLine/MxDbLine.js +94 -0
- package/dist/lib/MxModule/MxDbLine/index.js +5 -0
- package/dist/lib/MxModule/MxDbRect/MxDbRect.js +219 -0
- package/dist/lib/MxModule/MxDbRect/index.js +4 -0
- package/dist/lib/MxModule/MxFilters/MxFilters.js +201 -0
- package/dist/lib/MxModule/MxFilters/index.js +4 -0
- package/dist/lib/MxModule/MxFun/MxFun.js +5 -2
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +1 -1
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +2 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +20 -14
- package/dist/lib/doc.js +9 -1
- package/dist/lib/mxdraw.js +13 -9
- package/dist/lib/tools/three/index.js +100 -3
- package/dist/mxdraw.es5.js +3 -3
- package/dist/mxdraw.es5.js.map +1 -1
- package/dist/mxdraw.umd.js +3 -3
- package/dist/mxdraw.umd.js.map +1 -1
- package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +1 -1
- package/dist/types/MxModule/MxDbLine/MxDbLine.d.ts +22 -0
- package/dist/types/MxModule/MxDbLine/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbRect/MxDbRect.d.ts +74 -0
- package/dist/types/MxModule/MxDbRect/index.d.ts +2 -0
- package/dist/types/MxModule/MxFilters/MxFilters.d.ts +94 -0
- package/dist/types/MxModule/MxFilters/index.d.ts +2 -0
- package/dist/types/MxModule/MxFun/MxFun.d.ts +2 -1
- package/dist/types/doc.d.ts +5 -1
- package/dist/types/mxdraw.d.ts +9 -7
- package/dist/types/tools/three/index.d.ts +20 -1
- package/dist/types/types/MxFun.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @module MxDbLine*/
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import McGiWorldDraw from '../McGiWorldDraw';
|
|
4
|
+
import MxDbEntity from '../MxDbEntity';
|
|
5
|
+
/**
|
|
6
|
+
* MxDbLine 直线对象.
|
|
7
|
+
*/
|
|
8
|
+
export default class MxDbLine extends MxDbEntity {
|
|
9
|
+
private pt1;
|
|
10
|
+
private pt2;
|
|
11
|
+
getTypeName(): string;
|
|
12
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
13
|
+
setPoint1(pt1: THREE.Vector3): void;
|
|
14
|
+
getPoint1(): THREE.Vector3;
|
|
15
|
+
setPoint2(pt2: THREE.Vector3): void;
|
|
16
|
+
getPoint2(): THREE.Vector3;
|
|
17
|
+
getGripPoints(): Array<THREE.Vector3>;
|
|
18
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
19
|
+
dwgIn(obj: any): boolean;
|
|
20
|
+
dwgOut(obj: any): object;
|
|
21
|
+
create(): MxDbEntity;
|
|
22
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import MxDbEntity from '../MxDbEntity';
|
|
2
|
+
import { Color, Matrix4, Vector2, Vector3 } from 'three';
|
|
3
|
+
import MxFilters from '../MxFilters';
|
|
4
|
+
import McGiWorldDraw from '../McGiWorldDraw';
|
|
5
|
+
/**
|
|
6
|
+
* MxRectEntity 矩形对象.
|
|
7
|
+
*/
|
|
8
|
+
export default class MxDbRect extends MxDbEntity {
|
|
9
|
+
/**
|
|
10
|
+
* pt1: 构成矩形的第一个点
|
|
11
|
+
* */
|
|
12
|
+
pt1: Vector3;
|
|
13
|
+
/**
|
|
14
|
+
* pt1: 构成矩形的第二个点(对角点)
|
|
15
|
+
* */
|
|
16
|
+
pt2: Vector3;
|
|
17
|
+
/**
|
|
18
|
+
* width: 在绘制时自动计算矩形像素宽度 单位px
|
|
19
|
+
* */
|
|
20
|
+
width: number;
|
|
21
|
+
/**
|
|
22
|
+
* height: 在绘制时自动计算矩形像素高度 单位px
|
|
23
|
+
* */
|
|
24
|
+
height: number;
|
|
25
|
+
/**
|
|
26
|
+
* cornerRadius(优先级大于radius属性): 圆角的半径 如[3, 2, 1, 4]分别对应左上角圆角半径3 右上角2 右下角1 左下角4
|
|
27
|
+
* */
|
|
28
|
+
cornerRadius: number[];
|
|
29
|
+
/**
|
|
30
|
+
* radius(优先级低于cornerRadius属性): 所有圆角统一半径 (radius = 4) 通过MxFun.screenCoordLong2Doc方法转换为 (cornerRadius = [MxFun.screenCoordLong2Doc(4)...])
|
|
31
|
+
* */
|
|
32
|
+
radius: number | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* fillColor(优先级低于fillImageSrc属性): 设置颜色后 矩形线框会填充为带颜色的矩形
|
|
35
|
+
* */
|
|
36
|
+
fillColor: Color | string | number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* transparent 开启透明度
|
|
39
|
+
* */
|
|
40
|
+
transparent: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* opacity 设置透明度 0 ~ 1
|
|
43
|
+
* */
|
|
44
|
+
opacity: number;
|
|
45
|
+
/**
|
|
46
|
+
* visible 该矩形对象是否可见
|
|
47
|
+
* */
|
|
48
|
+
visible: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* fillImageSrc(优先级低于fillColor属性) 填充背景图片的地址
|
|
51
|
+
* */
|
|
52
|
+
fillImageSrc: string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* fillImageParam 填充背景图片的参数设置(如果使用了滤镜则部分参数功能失效)
|
|
55
|
+
* */
|
|
56
|
+
fillImageParam: {
|
|
57
|
+
offset?: Vector2;
|
|
58
|
+
repeat?: Vector2;
|
|
59
|
+
rotation?: number;
|
|
60
|
+
center?: Vector2;
|
|
61
|
+
} | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* 设置滤镜对象{@link MxFilters} 默认为undefined | null 则不使用该滤镜效果
|
|
64
|
+
* */
|
|
65
|
+
filter: MxFilters | undefined | null;
|
|
66
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
67
|
+
getGripPoints(): Array<Vector3>;
|
|
68
|
+
moveGripPointsAt(index: number, offset: Vector3): boolean;
|
|
69
|
+
dwgIn(obj: any): boolean;
|
|
70
|
+
dwgOut(obj: any): object;
|
|
71
|
+
create(): MxDbEntity;
|
|
72
|
+
transformBy(mat: Matrix4): void;
|
|
73
|
+
getTypeName(): string;
|
|
74
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** 简单颜色滤镜矩阵 */
|
|
2
|
+
import { Matrix4, Matrix3, Color } from 'three';
|
|
3
|
+
interface ChannelParamTypes {
|
|
4
|
+
r?: number;
|
|
5
|
+
g?: number;
|
|
6
|
+
b?: number;
|
|
7
|
+
}
|
|
8
|
+
export default class MxFilters {
|
|
9
|
+
private uniformObj;
|
|
10
|
+
private filtersStr;
|
|
11
|
+
private filtersTypes;
|
|
12
|
+
private VSHADER_SOURCE;
|
|
13
|
+
private FSHADER_SOURCE;
|
|
14
|
+
private _matrix;
|
|
15
|
+
/**
|
|
16
|
+
* 过滤或增强某个颜色通道
|
|
17
|
+
* @param {ChannelParamTypes}
|
|
18
|
+
* */
|
|
19
|
+
channel({ r, g, b }: ChannelParamTypes): this;
|
|
20
|
+
/**
|
|
21
|
+
* 改变亮度
|
|
22
|
+
* @param {number} p
|
|
23
|
+
* p = 0 全暗,p > 0 且 p < 1 调暗,p = 1 原色, p > 1 调亮
|
|
24
|
+
* */
|
|
25
|
+
brightness(p: number): this;
|
|
26
|
+
/**
|
|
27
|
+
* 饱和度
|
|
28
|
+
* @param {number} p
|
|
29
|
+
* p = 0 完全灰度化,p = 1 原色,p > 1 增强饱和度
|
|
30
|
+
* */
|
|
31
|
+
saturate(p: number): this;
|
|
32
|
+
/**
|
|
33
|
+
* 对比度
|
|
34
|
+
* @param {number} p
|
|
35
|
+
* p = 1 原色, p < 1 减弱对比度,p > 1 增强对比度
|
|
36
|
+
* */
|
|
37
|
+
contrast(p: number): this;
|
|
38
|
+
/**
|
|
39
|
+
* 透明度
|
|
40
|
+
* @param {number} p
|
|
41
|
+
* p = 0 全透明,p = 1 原色
|
|
42
|
+
* */
|
|
43
|
+
opacity(p: number): this;
|
|
44
|
+
/**
|
|
45
|
+
* 反色
|
|
46
|
+
* @param {number} p
|
|
47
|
+
* p = 0 原色, p = 1 完全反色
|
|
48
|
+
* */
|
|
49
|
+
invert(p: number): this;
|
|
50
|
+
/**
|
|
51
|
+
* 灰度
|
|
52
|
+
* @param {number} p 0~1
|
|
53
|
+
* */
|
|
54
|
+
grayscale(p?: number): this;
|
|
55
|
+
/**
|
|
56
|
+
* 深褐色
|
|
57
|
+
* @param {number} p 0~1
|
|
58
|
+
* */
|
|
59
|
+
sepia(p?: number): this;
|
|
60
|
+
/**
|
|
61
|
+
* 色相旋转,将色调沿极坐标转过deg角度
|
|
62
|
+
* @param {number} deg 0~360
|
|
63
|
+
* */
|
|
64
|
+
hueRotate(deg: number): this;
|
|
65
|
+
/**
|
|
66
|
+
* 色相旋转,将色调沿极坐标转过deg角度
|
|
67
|
+
* @param {number} deg 0~360
|
|
68
|
+
* */
|
|
69
|
+
/**
|
|
70
|
+
* 卷积
|
|
71
|
+
* @param {Matrix3} cKernel 3*3的矩阵
|
|
72
|
+
* @param {number} stStep 1 / 9
|
|
73
|
+
* @param {number} scaleFactor 521
|
|
74
|
+
* */
|
|
75
|
+
convolution(cKernel: Matrix3, stStep?: number, scaleFactor?: number): this;
|
|
76
|
+
/**
|
|
77
|
+
* 重置所有滤镜效果
|
|
78
|
+
* */
|
|
79
|
+
reset(): this;
|
|
80
|
+
_getFilterShaderData(texture: THREE.Texture): {
|
|
81
|
+
uniforms: {
|
|
82
|
+
e_Texture: {
|
|
83
|
+
value: import("three").Texture;
|
|
84
|
+
};
|
|
85
|
+
colorMatrix: {
|
|
86
|
+
value: Matrix4;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
vertexShader: string;
|
|
90
|
+
fragmentShader: string;
|
|
91
|
+
};
|
|
92
|
+
_getFilterColor(color?: string | number | Color, opacity?: number): Color;
|
|
93
|
+
}
|
|
94
|
+
export {};
|
|
@@ -35,7 +35,7 @@ export default class MxFun {
|
|
|
35
35
|
* })
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
createMxObject({ canvasId, cadFile, callback, isNewFile }: {
|
|
38
|
+
createMxObject({ canvasId, cadFile, callback, isNewFile, useWebsocket }: {
|
|
39
39
|
canvasId?: string;
|
|
40
40
|
cadFile?: string;
|
|
41
41
|
callback?: (mxDraw: MxDrawObject, dom: {
|
|
@@ -43,6 +43,7 @@ export default class MxFun {
|
|
|
43
43
|
canvasParent: CanvasParent;
|
|
44
44
|
}) => void;
|
|
45
45
|
isNewFile?: boolean;
|
|
46
|
+
useWebsocket?: boolean;
|
|
46
47
|
}): void;
|
|
47
48
|
/**
|
|
48
49
|
* 为程序设置服务器地址
|
package/dist/types/doc.d.ts
CHANGED
|
@@ -14,4 +14,8 @@ import MrxDbgUiPrBaseReturn from './MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBase
|
|
|
14
14
|
import McGiWorldDraw from './MxModule/McGiWorldDraw/McGiWorldDraw';
|
|
15
15
|
import McGiWorldDrawType from './MxModule/McGiWorldDrawType/McGiWorldDrawType';
|
|
16
16
|
import MxDbEntity from './MxModule/MxDbEntity/MxDbEntity';
|
|
17
|
-
|
|
17
|
+
import MxDbImage from './MxModule/MxDbImage/MxDbImage';
|
|
18
|
+
import MxDbSVG from './MxModule/MxDbSVG/MxDbSVG';
|
|
19
|
+
import MxDbLine from './MxModule/MxDbLine/MxDbLine';
|
|
20
|
+
import MxDbRect from './MxModule/MxDbRect/MxDbRect';
|
|
21
|
+
export { MxFun, MxThreeJS, MxDrawObject, MrxDbgUiPrPoint, McEdGetPointWorldDrawObject, MrxDbgUiPrBaseReturn, loadCoreCode, useCanvasResizeListener, McGiWorldDraw, McGiWorldDrawType, MxDbEntity, MxDbImage, MxDbSVG, MxDbLine, MxDbRect };
|
package/dist/types/mxdraw.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import loadCoreCode from './MxModule/loadCoreCode';
|
|
2
2
|
import store from './MxModule/store';
|
|
3
|
-
import
|
|
3
|
+
import MxFun from './MxModule/MxFun';
|
|
4
4
|
import MxThreeJS from './MxModule/MxThreeJS';
|
|
5
5
|
import MrxDbgUiPrPoint from './MxModule/MrxDbgUiPrPoint';
|
|
6
6
|
import McEdGetPointWorldDrawObject from './MxModule/McEdGetPointWorldDrawObject';
|
|
@@ -9,24 +9,26 @@ import MrxDbgUiPrBaseReturn from './MxModule/MrxDbgUiPrBaseReturn';
|
|
|
9
9
|
import MxDbEntity from './MxModule/MxDbEntity';
|
|
10
10
|
import MxDbImage from './MxModule/MxDbImage';
|
|
11
11
|
import MxDbSVG from './MxModule/MxDbSVG';
|
|
12
|
+
import MxDbLine from './MxModule/MxDbLine';
|
|
13
|
+
import MxDbRect from './MxModule/MxDbRect';
|
|
12
14
|
import MxDbAlignedDimension from './MxModule/MxDbAlignedDimension';
|
|
13
15
|
import McGiWorldDraw from './MxModule/McGiWorldDraw';
|
|
14
16
|
import McGiWorldDrawType from './MxModule/McGiWorldDrawType';
|
|
15
17
|
import MxType from './MxModule/MxType';
|
|
16
|
-
import
|
|
18
|
+
import Mxassembly from './MxModule/Mxassembly';
|
|
17
19
|
import McGeVector3d from './MxModule/McGeVector3d';
|
|
18
|
-
|
|
19
|
-
declare const Mxassembly: MxassemblyModule;
|
|
20
|
-
export { MxFun, Mxassembly, MxThreeJS, McEdGetPointWorldDrawObject, MrxDbgUiPrPoint, McGeVector3d, MxDbEntity, MxDbImage, MxDbSVG, MxDbAlignedDimension, useCanvasResizeListener, loadCoreCode, store, McGiWorldDraw, McGiWorldDrawType, MrxDbgUiPrBaseReturn, MxType };
|
|
20
|
+
export { MxFun, Mxassembly, MxThreeJS, McEdGetPointWorldDrawObject, MrxDbgUiPrPoint, McGeVector3d, MxDbEntity, MxDbImage, MxDbLine, MxDbSVG, MxDbRect, MxDbAlignedDimension, useCanvasResizeListener, loadCoreCode, store, McGiWorldDraw, McGiWorldDrawType, MrxDbgUiPrBaseReturn, MxType };
|
|
21
21
|
declare const _default: {
|
|
22
|
-
MxFun:
|
|
23
|
-
Mxassembly:
|
|
22
|
+
MxFun: import("./doc").MxFun;
|
|
23
|
+
Mxassembly: import("./MxModule/Mxassembly/Mxassembly").default;
|
|
24
24
|
MxThreeJS: import("./doc").MxThreeJS;
|
|
25
25
|
McEdGetPointWorldDrawObject: typeof McEdGetPointWorldDrawObject;
|
|
26
26
|
MrxDbgUiPrPoint: typeof MrxDbgUiPrPoint;
|
|
27
27
|
MxDbEntity: typeof MxDbEntity;
|
|
28
28
|
MxDbImage: typeof MxDbImage;
|
|
29
|
+
MxDbLine: typeof MxDbLine;
|
|
29
30
|
MxDbSVG: typeof MxDbSVG;
|
|
31
|
+
MxDbRect: typeof MxDbRect;
|
|
30
32
|
MxDbAlignedDimension: typeof MxDbAlignedDimension;
|
|
31
33
|
useCanvasResizeListener: typeof useCanvasResizeListener;
|
|
32
34
|
loadCoreCode: typeof loadCoreCode;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
1
2
|
/**
|
|
2
3
|
* 移动geometry坐标。
|
|
3
4
|
* @param geometry Three的Geometry对象
|
|
@@ -8,4 +9,22 @@
|
|
|
8
9
|
* ```
|
|
9
10
|
*
|
|
10
11
|
*/
|
|
11
|
-
export declare function
|
|
12
|
+
export declare function setGeometrPostion(geometry: THREE.Geometry, pos: THREE.Vector3): void;
|
|
13
|
+
/**
|
|
14
|
+
* 生成圆角时修复纹理对应的 uvs
|
|
15
|
+
* @param geometry 几何体
|
|
16
|
+
* */
|
|
17
|
+
export declare function repairGeometryFaceVertexUvs(geometry: THREE.Geometry): import("three").Geometry;
|
|
18
|
+
/**
|
|
19
|
+
* 获取生成圆角的points定点位置
|
|
20
|
+
* @param points 生成圆角前
|
|
21
|
+
* @param cornerRadius 圆角值
|
|
22
|
+
* @param isClose 生成圆角的图形是否是闭合的
|
|
23
|
+
* */
|
|
24
|
+
export declare function getToGenerateRoundedCorners(points: THREE.Vector3[], cornerRadius: number[], isClose?: boolean): THREE.Vector3[];
|
|
25
|
+
/**
|
|
26
|
+
* 计算矩形点位
|
|
27
|
+
* @param pt1 点1
|
|
28
|
+
* @param pt3 点3
|
|
29
|
+
* */
|
|
30
|
+
export declare function computeRectPoints(pt1: Vector3, pt3: Vector3): Vector3[];
|
|
@@ -2,7 +2,7 @@ import { MxDrawObjectType } from './MxDrawObject';
|
|
|
2
2
|
import { MeshLambertMaterial } from 'three';
|
|
3
3
|
import { MxCADObject } from './MxCADObject';
|
|
4
4
|
export interface MxFunType {
|
|
5
|
-
createMxObject(canvasId: string, arg1: string, arg2: (mxDraw: MxDrawObjectType) => void,
|
|
5
|
+
createMxObject(canvasId: string, arg1: string, arg2: (mxDraw: MxDrawObjectType) => void, is2d: boolean | undefined, isNewCreate?: boolean, isStaticLoad?: boolean): void;
|
|
6
6
|
setMxServer(MXSERVER: string): void;
|
|
7
7
|
addCommand(cmdName: string, fun: Function): void;
|
|
8
8
|
sendStringToExecute(sCmd: string, ...params: any[]): boolean;
|