build-dxf 0.0.20-9 → 0.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-dxf",
3
- "version": "0.0.20-9",
3
+ "version": "0.0.20",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.d.ts CHANGED
@@ -14,7 +14,6 @@ export declare function createEditor(dom: HTMLDivElement, camera?: THREE.Camera,
14
14
  obj: File;
15
15
  glb: File;
16
16
  gltf: File;
17
- json: File;
18
17
  }>;
19
18
  }>;
20
19
  /**
@@ -26,7 +25,6 @@ export declare function getFileAll(dxfSystem?: DxfSystem): Promise<{
26
25
  obj: File;
27
26
  glb: File;
28
27
  gltf: File;
29
- json: File;
30
28
  }>;
31
29
  /** 获取全局DxfSystem
32
30
  * @returns
package/src/build.js CHANGED
@@ -365,11 +365,10 @@ class Point {
365
365
  this.x = p.x ?? 0;
366
366
  this.y = p.y ?? 0;
367
367
  }
368
- toJson(z = 0) {
368
+ toJson() {
369
369
  return {
370
370
  x: this.x,
371
- y: this.y,
372
- z
371
+ y: this.y
373
372
  };
374
373
  }
375
374
  static from(arr) {
@@ -1476,7 +1475,7 @@ class Dxf extends Component {
1476
1475
  filterLines.push(line2);
1477
1476
  } else filterLines.push(line);
1478
1477
  }
1479
- return filterLines.length > 3 ? linesToPath(this.mergeSameDirectionLine(filterLines)) : [];
1478
+ return filterLines.length > 2 ? linesToPath(this.mergeSameDirectionLine(filterLines)) : [];
1480
1479
  }
1481
1480
  /**
1482
1481
  * 移除短线段
@@ -1486,7 +1485,7 @@ class Dxf extends Component {
1486
1485
  removeShortLine(path, shortLine = this.shortLine) {
1487
1486
  const lines = pathToLines(path), filterLines = [], PI_1 = Math.PI / 180;
1488
1487
  for (let i = 0; i < lines.length; i++) {
1489
- const line = lines[i], len = line.length(), currentIndex = i;
1488
+ const line = lines[i], len = line.length();
1490
1489
  if (len > shortLine || filterLines.length === 0) {
1491
1490
  filterLines.push(line);
1492
1491
  continue;
@@ -1500,29 +1499,24 @@ class Dxf extends Component {
1500
1499
  } else break;
1501
1500
  }
1502
1501
  if (!nextline) continue;
1503
- const targetLine = lines[i - 1];
1504
- if (preLine.length() > targetLine.length()) {
1505
- const intersectPoint = preLine.getIntersection(nextline);
1506
- if (intersectPoint) {
1507
- const p0 = preLine.points[1].clone(), p1 = nextline.points[0].clone();
1508
- preLine.points[1].copy(intersectPoint);
1509
- nextline.points[0].copy(intersectPoint);
1510
- if (preLine.length() < this.width) {
1511
- preLine.points[1].copy(p0);
1512
- nextline.points[0].copy(p0);
1513
- } else if (nextline.length() < this.width) {
1514
- preLine.points[1].copy(p1);
1515
- nextline.points[0].copy(p1);
1516
- }
1517
- } else {
1518
- preLine.points[1].copy(nextline.points[0]);
1502
+ const intersectPoint = preLine.getIntersection(nextline);
1503
+ if (intersectPoint) {
1504
+ const p0 = preLine.points[1].clone(), p1 = nextline.points[0].clone();
1505
+ preLine.points[1].copy(intersectPoint);
1506
+ nextline.points[0].copy(intersectPoint);
1507
+ if (preLine.length() < this.width) {
1508
+ preLine.points[1].copy(p0);
1509
+ nextline.points[0].copy(p0);
1510
+ } else if (nextline.length() < this.width) {
1511
+ preLine.points[1].copy(p1);
1512
+ nextline.points[0].copy(p1);
1519
1513
  }
1520
- filterLines.push(nextline);
1521
1514
  } else {
1522
- i = currentIndex;
1515
+ preLine.points[1].copy(nextline.points[0]);
1523
1516
  }
1517
+ filterLines.push(nextline);
1524
1518
  }
1525
- return filterLines.length > 3 ? linesToPath(filterLines) : [];
1519
+ return filterLines.length > 2 ? linesToPath(filterLines) : [];
1526
1520
  }
1527
1521
  /** 线偏移
1528
1522
  * @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
@@ -3132,13 +3126,11 @@ async function getFileAll(dxfSystem = gloabalDxfSystem) {
3132
3126
  const obj = new File([await whiteModel.toOBJBlob()], "model.obj", { type: "application/octet-stream" });
3133
3127
  const glb = new File([await whiteModel.toGltfBlob(true)], "model.glb", { type: "application/octet-stream" });
3134
3128
  const gltf = new File([await whiteModel.toGltfBlob(false)], "model.gltf", { type: "application/json" });
3135
- const json = new File([JSON.stringify(dxfSystem.Dxf.originalData)], "json.json", { type: "application/json" });
3136
3129
  return {
3137
3130
  dxf,
3138
3131
  obj,
3139
3132
  glb,
3140
- gltf,
3141
- json
3133
+ gltf
3142
3134
  };
3143
3135
  }
3144
3136
  function getGlobalDxfSystem() {
package/src/index.css CHANGED
@@ -104,14 +104,14 @@
104
104
  z-index: 11;
105
105
  }
106
106
 
107
- .z-\[20\] {
108
- z-index: 20;
109
- }
110
-
111
107
  .z-\[1000\] {
112
108
  z-index: 1000;
113
109
  }
114
110
 
111
+ .z-\[10000\] {
112
+ z-index: 10000;
113
+ }
114
+
115
115
  .container {
116
116
  width: 100%;
117
117
  }
@@ -214,6 +214,10 @@
214
214
  height: 20px;
215
215
  }
216
216
 
217
+ .h-\[20px\] {
218
+ height: 20px;
219
+ }
220
+
217
221
  .h-\[100vh\] {
218
222
  height: 100vh;
219
223
  }
@@ -234,36 +238,32 @@
234
238
  width: 200px;
235
239
  }
236
240
 
237
- .w-fit {
238
- width: fit-content;
239
- }
240
-
241
241
  .w-full {
242
242
  width: 100%;
243
243
  }
244
244
 
245
- .max-w-\[150px\] {
246
- max-width: 150px;
247
- }
248
-
249
- .max-w-\[180px\] {
250
- max-width: 180px;
245
+ .max-w-\[100px\] {
246
+ max-width: 100px;
251
247
  }
252
248
 
253
249
  .max-w-\[260px\] {
254
250
  max-width: 260px;
255
251
  }
256
252
 
253
+ .min-w-\[140px\] {
254
+ min-width: 140px;
255
+ }
256
+
257
257
  .min-w-\[150px\] {
258
258
  min-width: 150px;
259
259
  }
260
260
 
261
- .rotate-90 {
262
- rotate: 90deg;
261
+ .flex-1 {
262
+ flex: 1;
263
263
  }
264
264
 
265
- .\!cursor-no-drop {
266
- cursor: no-drop !important;
265
+ .rotate-90 {
266
+ rotate: 90deg;
267
267
  }
268
268
 
269
269
  .cursor-pointer {
@@ -338,7 +338,7 @@
338
338
  border-radius: var(--radius-lg);
339
339
  }
340
340
 
341
- .border, .border-1 {
341
+ .border {
342
342
  border-style: var(--tw-border-style);
343
343
  border-width: 1px;
344
344
  }
@@ -353,10 +353,6 @@
353
353
  border-bottom-width: 1px;
354
354
  }
355
355
 
356
- .border-\[\#ccc\] {
357
- border-color: #ccc;
358
- }
359
-
360
356
  .border-t-\[\#eee\] {
361
357
  border-top-color: #eee;
362
358
  }
@@ -369,12 +365,12 @@
369
365
  border-bottom-color: #ffffff1a;
370
366
  }
371
367
 
372
- .\!bg-\[var\(--primary-color\)\] {
373
- background-color: var(--primary-color) !important;
368
+ .\!bg-\[\#409eff\] {
369
+ background-color: #409eff !important;
374
370
  }
375
371
 
376
- .bg-\[\#ccc\] {
377
- background-color: #ccc;
372
+ .\!bg-\[var\(--primary-color\)\] {
373
+ background-color: var(--primary-color) !important;
378
374
  }
379
375
 
380
376
  .bg-\[\#f0f0f0\] {
@@ -415,8 +411,8 @@
415
411
  padding: 0 10px;
416
412
  }
417
413
 
418
- .p-\[2px\] {
419
- padding: 2px;
414
+ .p-\[2px_0px\] {
415
+ padding: 2px 0;
420
416
  }
421
417
 
422
418
  .p-\[2px_5px\] {
@@ -431,6 +427,10 @@
431
427
  padding: 5px;
432
428
  }
433
429
 
430
+ .p-\[5px_0px\] {
431
+ padding: 5px 0;
432
+ }
433
+
434
434
  .p-\[5px_20px\] {
435
435
  padding: 5px 20px;
436
436
  }
@@ -477,14 +477,14 @@
477
477
  font-weight: var(--font-weight-bold);
478
478
  }
479
479
 
480
- .text-nowrap {
481
- text-wrap: nowrap;
482
- }
483
-
484
480
  .text-\[\#333\] {
485
481
  color: #333;
486
482
  }
487
483
 
484
+ .text-\[\#888\] {
485
+ color: #888;
486
+ }
487
+
488
488
  .text-\[\#999\] {
489
489
  color: #999;
490
490
  }
@@ -505,10 +505,6 @@
505
505
  color: var(--color-primary);
506
506
  }
507
507
 
508
- .opacity-30 {
509
- opacity: .3;
510
- }
511
-
512
508
  .blur {
513
509
  --tw-blur: blur(8px);
514
510
  filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
@@ -542,10 +538,6 @@
542
538
  }
543
539
  }
544
540
 
545
- .active\:\!scale-\[1\]:active {
546
- scale: 1 !important;
547
- }
548
-
549
541
  .active\:scale-\[0\.7\]:active {
550
542
  scale: .7;
551
543
  }
@@ -636,7 +628,7 @@
636
628
  inherits: false
637
629
  }
638
630
 
639
- [data-v-6aea548c] {
631
+ [data-v-a5aa9d5a] {
640
632
  font-family: 宋体;
641
633
  }
642
634
 
package/src/index2.js CHANGED
@@ -289,6 +289,7 @@ class OriginalLineRender extends Component {
289
289
  const dxf = this.Dxf;
290
290
  const center = dxf.originalBox.center;
291
291
  this.Renderer?.orbitControls?.target.set(center.x, center.y, 0);
292
+ this.Renderer?.camera?.position.set(center.x, center.y, 0).add(new THREE.Vector3(1, 1, 1).multiplyScalar(10));
292
293
  const lineAnalysis = parent.findComponentByName("LineAnalysis");
293
294
  const array = lineAnalysis.appendLineSegmentList.flatMap((line) => line.points.flatMap((p) => [p.x, p.y, dxf.originalZAverage]));
294
295
  this.appendLineMode.geometry = new THREE.BufferGeometry().setAttribute("position", new THREE.BufferAttribute(new Float32Array(array), 3, true));
@@ -464,7 +465,7 @@ class EventInput extends Component {
464
465
  * @returns
465
466
  */
466
467
  isKeyDown(key) {
467
- return this.keyList.has(key.toLocaleLowerCase()) || this.mouseList.has(key.toLocaleLowerCase());
468
+ return this.keyList.has(key) || this.mouseList.has(key);
468
469
  }
469
470
  /**
470
471
  * 是否按下按键组
@@ -643,6 +644,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
643
644
  ])),
644
645
  _: 1,
645
646
  __: [9]
647
+ }),
648
+ createVNode(unref(ElButton), {
649
+ size: "small",
650
+ type: "success",
651
+ onClick: selectDetailsPointFile
652
+ }, {
653
+ default: withCtx(() => _cache[10] || (_cache[10] = [
654
+ createTextVNode(" 编辑模式 ", -1)
655
+ ])),
656
+ _: 1,
657
+ __: [10]
646
658
  })
647
659
  ]),
648
660
  isLook.value ? (openBlock(), createElementBlock("div", {
@@ -668,7 +680,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
668
680
  label: "墙体(E)"
669
681
  }, null, 8, ["modelValue"])
670
682
  ]),
671
- _cache[10] || (_cache[10] = createStaticVNode('<div class="mt-[5px] text-[#c9c9c9] text-[10px]"><p class="text-right">详情点射线辅助线快捷键:R</p><p class="text-right">墙壁合并追加线快捷键:A</p><p class="text-right">线段序号快捷键:T</p><p class="text-right">线段端点标示快捷键:P</p><p class="text-right">线段长度(单位米)快捷键:L</p></div>', 1))
683
+ _cache[11] || (_cache[11] = createStaticVNode('<div class="mt-[5px] text-[#c9c9c9] text-[10px]"><p class="text-right">详情点射线辅助线快捷键:R</p><p class="text-right">墙壁合并追加线快捷键:A</p><p class="text-right">线段序号快捷键:T</p><p class="text-right">线段端点标示快捷键:P</p><p class="text-right">线段长度(单位米)快捷键:L</p></div>', 1))
672
684
  ])
673
685
  ])
674
686
  ], 512);