dxfview 0.0.4-beta.3 → 0.0.4-beta.5

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.
@@ -113,6 +113,7 @@ export declare class AnnotationPlugin extends Plugin {
113
113
  * @description {zh} 取消当前的标注绘制。这并不会退出标注,用户可以开始一个新的标注。
114
114
  */
115
115
  cancel(): void;
116
+ private getLastDrawable;
116
117
  /**
117
118
  *
118
119
  * @param {AnnotationData[]} dataArray
@@ -95,10 +95,16 @@ export declare abstract class BaseAnnotation extends Event<AnnotationEvents> {
95
95
  dblclick: () => void;
96
96
  protected onMouseClick(e: EventInfo): void;
97
97
  protected selectAnnotationByEvent(e: EventInfo): void;
98
+ /**
99
+ * 撤销当前绘制的最后一个点。
100
+ * @returns 是否成功撤销
101
+ */
102
+ undoLastPoint(): boolean;
98
103
  keydown: (e: EventInfo) => void;
99
104
  abstract exitDrawing(): void;
100
105
  abstract cancel(): void;
101
106
  protected abstract complete(): void;
107
+ protected getMinPointsToComplete(): number;
102
108
  protected abstract setTooltipContent(): void;
103
109
  protected abstract createAnnotationDrawable(): BaseAnnotationDrawable | undefined;
104
110
  protected onMouseMove(position: THREE.Vector3): void;
@@ -58,6 +58,10 @@ export declare abstract class BaseAnnotationDrawable extends Drawable {
58
58
  protected details: ClosedShape;
59
59
  protected ctx?: CanvasRenderingContext2D;
60
60
  parent?: BaseAnnotationDrawable;
61
+ protected segmentLabelOffset: number;
62
+ protected segmentLabelFontSize: number;
63
+ protected segmentLabelPaddingX: number;
64
+ protected segmentLabelPaddingY: number;
61
65
  protected annotationType?: AnnotationType;
62
66
  protected titleText?: string;
63
67
  protected annotationProperty?: AnnotationProperty;
@@ -136,4 +140,9 @@ export declare abstract class BaseAnnotationDrawable extends Drawable {
136
140
  * 停用射线检测器
137
141
  */
138
142
  deactivateRaycaster(): void;
143
+ protected drawSegmentLengths(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
144
+ private drawSegmentLengthLabel;
145
+ private drawRoundedRect;
146
+ protected getPointsForSegmentLength(): THREE.Vector3[];
147
+ protected shouldCloseSegments(): boolean;
139
148
  }
@@ -50,4 +50,5 @@ export declare class RectAnnotation extends BaseAnnotation {
50
50
  * 重写鼠标移动处理,用于实时预览
51
51
  */
52
52
  protected onMouseMove(position: THREE.Vector3): void;
53
+ private updateRectanglePoints;
53
54
  }
@@ -18,6 +18,7 @@ export declare class RectDrawable extends BaseAnnotationDrawable {
18
18
  private getRectPoints;
19
19
  isPointInPath(p: THREE.Vector3): boolean;
20
20
  getVertexes(): THREE.Vector3[];
21
+ protected getPointsForSegmentLength(): THREE.Vector3[];
21
22
  getClassType(): string;
22
23
  /**
23
24
  * 重写更新方法,绘制时保持2个对角点,完成时转换为4个顶点
@@ -43,4 +44,5 @@ export declare class RectDrawable extends BaseAnnotationDrawable {
43
44
  * 根据拖拽的顶点更新矩形的两个对角点
44
45
  */
45
46
  private updateRectFromVertexDrag;
47
+ private computeRectFromDiagonal;
46
48
  }
@@ -8,6 +8,7 @@ export declare class FreeDrawDrawable extends BaseAnnotationDrawable {
8
8
  draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
9
9
  isPointInPath(p: THREE.Vector3): boolean;
10
10
  getVertexes(): THREE.Vector3[];
11
+ protected shouldCloseSegments(): boolean;
11
12
  getClassType(): string;
12
13
  /**
13
14
  * 检查当前图形是否为闭合图形
package/package.json CHANGED
@@ -1,90 +1,90 @@
1
- {
2
- "name": "dxfview",
3
- "version": "0.0.4-beta.3",
4
- "homepage": "",
5
- "module": "dist/dxfview.esm.min.js",
6
- "main": "dist/dxfview.esm.min.js",
7
- "types": "dist/types/index.d.ts",
8
- "type": "module",
9
- "scripts": {
10
- "clean": "rimraf dist build",
11
- "build:release": "node --loader ts-node/esm esbuild.config.ts -mode=production",
12
- "build:prebuild": "node --loader ts-node/esm esbuild.config.ts -mode=prebuild",
13
- "build:datatype": "tsc && tsc-alias",
14
- "build": "npm run clean && npm run lint-fix && npm run build:datatype && npm run build:release",
15
- "build:dev": "npm run clean && npm run lint-fix && npm run build:prebuild",
16
- "build:dev:watch": "npm run clean && npm run lint-fix && npm run build:datatype && node --loader ts-node/esm esbuild.config.ts -mode=devwatch",
17
- "demo": "npm run build:dev && node demo/index.cjs",
18
- "start": "node --loader ts-node/esm esbuild.config.ts -mode=development",
19
- "lint": "eslint src --ext ts",
20
- "lint-fix": "npm run lint -- --fix",
21
- "docs": "typedoc src/export.doc.ts --excludePrivate --excludeProtected --excludeInternal --exclude src/pathes/*"
22
- },
23
- "files": [
24
- "/dist"
25
- ],
26
- "repository": {
27
- "type": "git"
28
- },
29
- "author": "dxfview",
30
- "license": "UNLICENSED",
31
- "dependencies": {
32
- "@noble/ed25519": "^2.0.0",
33
- "@noble/hashes": "^1.4.0",
34
- "@types/concaveman": "^1.1.3",
35
- "@types/lodash": "^4.14.165",
36
- "@types/resize-observer-browser": "^0.1.7",
37
- "2d-polygon-boolean": "^1.0.1",
38
- "2d-polygon-self-intersections": "^1.3.1",
39
- "camera-controls": "^1.37.4",
40
- "clipper-lib": "^6.4.2",
41
- "concaveman": "^1.2.1",
42
- "core-js": "^3.27.1",
43
- "disable-devtool": "^0.3.9",
44
- "i18next": "^21.6.0",
45
- "intl-pluralrules": "^1.3.1",
46
- "javascript-obfuscator": "^4.1.1",
47
- "js-base64": "^3.7.2",
48
- "jsbi": "^4.3.0",
49
- "lodash": "^4.17.20",
50
- "loglevel": "^1.8.0",
51
- "mitt": "^3.0.0",
52
- "opentype.js": "^1.3.4",
53
- "poly-extrude": "^0.2.0",
54
- "polybooljs": "^1.2.0",
55
- "polygon-clipping": "^0.15.3",
56
- "regenerator-runtime": "^0.13.11",
57
- "screenfull": "^6.0.0",
58
- "stream": "^0.0.2",
59
- "three": "^0.155.0",
60
- "three-mesh-bvh": "^0.5.21"
61
- },
62
- "devDependencies": {
63
- "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
64
- "@types/eslint": "^8.21.1",
65
- "@types/node": "^18.11.19",
66
- "@types/resize-observer-browser": "^0.1.7",
67
- "@types/sha256": "^0.2.0",
68
- "@types/three": "^0.155.0",
69
- "@typescript-eslint/eslint-plugin": "^5.0.0",
70
- "@typescript-eslint/parser": "^5.47.1",
71
- "esbuild": "^0.16.17",
72
- "esbuild-plugin-inline-worker": "^0.1.1",
73
- "esbuild-plugin-sass": "^1.0.1",
74
- "eslint": "^8.15.0",
75
- "eslint-config-prettier": "^8.5.0",
76
- "eslint-import-resolver-typescript": "^3.5.2",
77
- "eslint-plugin-import": "2.26.0",
78
- "eslint-plugin-prettier": "^4.2.1",
79
- "express": "^4.17.1",
80
- "live-server": "^1.2.2",
81
- "prettier": "^2.5.1",
82
- "rimraf": "^3.0.2",
83
- "sha256": "^0.2.0",
84
- "terser": "^5.16.2",
85
- "ts-node": "^10.9.1",
86
- "tsc-alias": "^1.8.2",
87
- "typedoc": "^0.22.12",
88
- "typescript": "^4.5.2"
89
- }
90
- }
1
+ {
2
+ "name": "dxfview",
3
+ "version": "0.0.4-beta.5",
4
+ "homepage": "",
5
+ "module": "dist/dxfview.esm.min.js",
6
+ "main": "dist/dxfview.esm.min.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "type": "module",
9
+ "scripts": {
10
+ "clean": "rimraf dist build",
11
+ "build:release": "node --loader ts-node/esm esbuild.config.ts -mode=production",
12
+ "build:prebuild": "node --loader ts-node/esm esbuild.config.ts -mode=prebuild",
13
+ "build:datatype": "tsc && tsc-alias",
14
+ "build": "npm run clean && npm run lint-fix && npm run build:datatype && npm run build:release",
15
+ "build:dev": "npm run clean && npm run lint-fix && npm run build:prebuild",
16
+ "build:dev:watch": "npm run clean && npm run lint-fix && npm run build:datatype && node --loader ts-node/esm esbuild.config.ts -mode=devwatch",
17
+ "demo": "npm run build:dev && node demo/index.cjs",
18
+ "start": "node --loader ts-node/esm esbuild.config.ts -mode=development",
19
+ "lint": "eslint src --ext ts",
20
+ "lint-fix": "npm run lint -- --fix",
21
+ "docs": "typedoc src/export.doc.ts --excludePrivate --excludeProtected --excludeInternal --exclude src/pathes/*"
22
+ },
23
+ "files": [
24
+ "/dist"
25
+ ],
26
+ "repository": {
27
+ "type": "git"
28
+ },
29
+ "author": "dxfview",
30
+ "license": "UNLICENSED",
31
+ "dependencies": {
32
+ "@noble/ed25519": "^2.0.0",
33
+ "@noble/hashes": "^1.4.0",
34
+ "@types/concaveman": "^1.1.3",
35
+ "@types/lodash": "^4.14.165",
36
+ "@types/resize-observer-browser": "^0.1.7",
37
+ "2d-polygon-boolean": "^1.0.1",
38
+ "2d-polygon-self-intersections": "^1.3.1",
39
+ "camera-controls": "^1.37.4",
40
+ "clipper-lib": "^6.4.2",
41
+ "concaveman": "^1.2.1",
42
+ "core-js": "^3.27.1",
43
+ "disable-devtool": "^0.3.9",
44
+ "i18next": "^21.6.0",
45
+ "intl-pluralrules": "^1.3.1",
46
+ "javascript-obfuscator": "^4.1.1",
47
+ "js-base64": "^3.7.2",
48
+ "jsbi": "^4.3.0",
49
+ "lodash": "^4.17.20",
50
+ "loglevel": "^1.8.0",
51
+ "mitt": "^3.0.0",
52
+ "opentype.js": "^1.3.4",
53
+ "poly-extrude": "^0.2.0",
54
+ "polybooljs": "^1.2.0",
55
+ "polygon-clipping": "^0.15.3",
56
+ "regenerator-runtime": "^0.13.11",
57
+ "screenfull": "^6.0.0",
58
+ "stream": "^0.0.2",
59
+ "three": "^0.155.0",
60
+ "three-mesh-bvh": "^0.5.21"
61
+ },
62
+ "devDependencies": {
63
+ "@fal-works/esbuild-plugin-global-externals": "^2.1.2",
64
+ "@types/eslint": "^8.21.1",
65
+ "@types/node": "^18.11.19",
66
+ "@types/resize-observer-browser": "^0.1.7",
67
+ "@types/sha256": "^0.2.0",
68
+ "@types/three": "^0.155.0",
69
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
70
+ "@typescript-eslint/parser": "^5.47.1",
71
+ "esbuild": "^0.16.17",
72
+ "esbuild-plugin-inline-worker": "^0.1.1",
73
+ "esbuild-plugin-sass": "^1.0.1",
74
+ "eslint": "^8.15.0",
75
+ "eslint-config-prettier": "^8.5.0",
76
+ "eslint-import-resolver-typescript": "^3.5.2",
77
+ "eslint-plugin-import": "2.26.0",
78
+ "eslint-plugin-prettier": "^4.2.1",
79
+ "express": "^4.17.1",
80
+ "live-server": "^1.2.2",
81
+ "prettier": "^2.5.1",
82
+ "rimraf": "^3.0.2",
83
+ "sha256": "^0.2.0",
84
+ "terser": "^5.16.2",
85
+ "ts-node": "^10.9.1",
86
+ "tsc-alias": "^1.8.2",
87
+ "typedoc": "^0.22.12",
88
+ "typescript": "^4.5.2"
89
+ }
90
+ }