build-dxf 0.0.21 → 0.0.22

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.21",
3
+ "version": "0.0.22",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -679,7 +679,7 @@ class O {
679
679
  class L {
680
680
  points = [new p(), new p()];
681
681
  userData = {};
682
- line;
682
+ // line: any
683
683
  get center() {
684
684
  return new p(
685
685
  this.points[0].x + (this.points[1].x - this.points[0].x) * 0.5,
@@ -1252,7 +1252,7 @@ class X extends q {
1252
1252
  s.AddPaths(r, e, t);
1253
1253
  }), s.Execute(i, this.width / 2 * n), this.wallsGroup = i.map((o) => {
1254
1254
  let r = o.map((a) => p.from(a).divisionScalar(n));
1255
- return r = this.lineSegmentStraightening(r), t == X.EndType.etOpenSquare && (r = this.squareRemoveBurr(r)), r = this.removeShortLine(r), r;
1255
+ return r = this.lineSegmentStraightening(r), t == X.EndType.etOpenSquare && (r = this.squareRemoveBurr(r)), r;
1256
1256
  }), this.dispatchEvent({
1257
1257
  type: "lineOffset",
1258
1258
  wallsGroup: this.wallsGroup
@@ -1482,6 +1482,7 @@ function V(g) {
1482
1482
  const I = new L();
1483
1483
  class ot extends X {
1484
1484
  static name = "AngleCorrectionDxf";
1485
+ angle = 0;
1485
1486
  onAddFromParent(t) {
1486
1487
  t.findComponentByName("LineAnalysis").addEventListener("analysisCompleted", async () => this.update());
1487
1488
  }
@@ -1521,8 +1522,34 @@ class ot extends X {
1521
1522
  }), await this.set(a, e.width, e.scale), this.lineOffset(), this.doorLineSegment = e.doorLineSegment.map((c) => {
1522
1523
  const h = c.clone();
1523
1524
  return h.start.division(o).rotate(p.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(p.zero(), i * (Math.PI / 180)), h.start.y = -h.start.y, h.end.y = -h.end.y, h;
1525
+ }), this.angle = i, this.dispatchEvent({
1526
+ type: "updateData"
1524
1527
  });
1525
1528
  }
1529
+ // async set(data: OriginalDataItem[], width?: number, scale?: number): Promise<any> {
1530
+ // await super.set(data, width, scale)
1531
+ // const quadtree = new Quadtree(this.box)
1532
+ // this.lineSegments.forEach(line => {
1533
+ // if(line.userData.isDoor) return
1534
+ // quadtree.insert({
1535
+ // line,
1536
+ // userData: undefined
1537
+ // })
1538
+ // })
1539
+ // this.lineSegments.forEach(line => {
1540
+ // if(line.userData.isDoor) return
1541
+ // const lines = quadtree.queryLineSegment(line)
1542
+ // .filter(l => l.line !== line)
1543
+ // .map(l => l.line)
1544
+ // const offset = new ClipperLib.ClipperOffset(20, 0.25)
1545
+ // offset.AddPaths(lines.map( line => line.points.map(p => p.clone().multiplyScalar(1000)) ), ClipperLib.JoinType.jtMiter, ClipperLib.EndType.etOpenSquare)
1546
+ // const result = new ClipperLib.Paths()
1547
+ // offset.Execute(result, this.width / 2 * 1000)
1548
+ // console.log( result )
1549
+ // // const cpr = new ClipperLib.Clipper()
1550
+ // // offset.AddPath(linePaths, joinType, endType)
1551
+ // })
1552
+ // }
1526
1553
  }
1527
1554
  class _ extends q {
1528
1555
  static name = "Variable";
package/src/index2.js CHANGED
@@ -3,7 +3,7 @@ import * as d from "three";
3
3
  import { Group as q } from "three";
4
4
  import "clipper-lib";
5
5
  import "dxf-writer";
6
- import { E as w, R as E, L as Q, D as S, a as A, b as G, S as O } from "./selectLocalFile.js";
6
+ import { E as w, R as E, L as Q, D as O, a as S, b as G, S as A } from "./selectLocalFile.js";
7
7
  import { defineComponent as K, createElementBlock as R, openBlock as k, createElementVNode as y, toDisplayString as X, createVNode as x, unref as m, withCtx as D, createTextVNode as M, createApp as Y, ref as L, watch as C, onMounted as ee, onUnmounted as te, createCommentVNode as ie, createStaticVNode as ne } from "vue";
8
8
  function oe(p, e, i, t = "#fff", n = 2) {
9
9
  const o = document.createElement("canvas"), a = o.getContext("2d");
@@ -276,13 +276,13 @@ class F extends P {
276
276
  this.keyList.delete(t.value), this.dispatchEvent({ type: "codeChange", code: t.value, mode: "up" });
277
277
  }), i.addEventListener("focus", () => {
278
278
  this.keyList.clear(), this.mouseList.clear();
279
- }), this.addEventListener("codeChange", this._computedkeyCombination.bind(this)), this.addKeyCombination("save", ["control", "s"]), this.addCancelDefaultBehavior((t) => t.isOnlyKeyDowns(["control", "s"]));
279
+ }), this.addEventListener("codeChange", this._computedkeyCombination.bind(this)), this.addKeyCombination("save", ["control", "s"]), this.addCancelDefaultBehavior((t) => t.isOnlyKeyDowns(["control", "s"]) || t.isOnlyKeyDown("alt"));
280
280
  }
281
281
  /** 添加取消浏览器默认行为规则
282
282
  * @param callBack
283
283
  */
284
284
  addCancelDefaultBehavior(e) {
285
- (this.parent?.findComponentByType(S)).addCancelDefaultBehavior(() => e(this));
285
+ (this.parent?.findComponentByType(O)).addCancelDefaultBehavior(() => e(this));
286
286
  }
287
287
  /**
288
288
  * 计算组合按键
@@ -363,8 +363,8 @@ class F extends P {
363
363
  const Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
364
364
  __proto__: null,
365
365
  DetailsPointRender: I,
366
- DomContainer: A,
367
- DomEventRegister: S,
366
+ DomContainer: S,
367
+ DomEventRegister: O,
368
368
  EventInput: F,
369
369
  ModelDataRender: z,
370
370
  OriginalLineRender: j,
@@ -377,7 +377,7 @@ const Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
377
377
  },
378
378
  setup(p) {
379
379
  d.Object3D.DEFAULT_UP = new d.Vector3(0, 0, 1);
380
- const e = p, i = L(), t = L(!0), n = L(!0), o = L(!0), a = L(!1), s = new W().usePlugin(Z).usePlugin(fe), c = s.findComponentByType(J), u = s.findComponentByType(A), b = s.findComponentByType(H);
380
+ const e = p, i = L(), t = L(!0), n = L(!0), o = L(!0), a = L(!1), s = new W().usePlugin(Z).usePlugin(fe), c = s.findComponentByType(J), u = s.findComponentByType(S), b = s.findComponentByType(H);
381
381
  C(() => e.lines, () => e.lines && h(e.lines)), C(() => e.detailsPoint, () => e.detailsPoint && c?.set(e.detailsPoint));
382
382
  function h(r) {
383
383
  if (r) {
@@ -390,11 +390,11 @@ const Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
390
390
  }
391
391
  }
392
392
  async function f() {
393
- const r = await O.json();
393
+ const r = await A.json();
394
394
  Array.isArray(r) && (localStorage.removeItem("orbitControls"), h(r));
395
395
  }
396
396
  async function B() {
397
- const r = await O.json();
397
+ const r = await A.json();
398
398
  Array.isArray(r) && c?.set(r);
399
399
  }
400
400
  C(t, () => s.Variable.set("originalLineVisible", t.value)), C(n, () => s.Variable.set("dxfVisible", n.value)), C(o, () => s.Variable.set("whiteModelVisible", o.value)), s.Variable.addEventListener("isLook", (r) => a.value = r.value), s.Variable.addEventListener("originalLineVisible", (r) => t.value = r.value), s.Variable.addEventListener("dxfVisible", (r) => n.value = r.value), s.Variable.addEventListener("whiteModelVisible", (r) => o.value = r.value), localStorage.getItem("lines") ? h(JSON.parse(localStorage.getItem("lines") ?? "{}")) : h(e.lines), e.detailsPoint && c?.set(e.detailsPoint), ee(() => u && i.value?.appendChild(u.domElement)), te(() => s.destroy());
@@ -500,7 +500,7 @@ function T(p, e = {}) {
500
500
  detailsPoint: n = !0,
501
501
  orbitControls: o = !0,
502
502
  camera: a = new d.PerspectiveCamera(45, 1, 0.01, 1e3)
503
- } = e, s = new A();
503
+ } = e, s = new S();
504
504
  p.addComponent(s), p.addComponent(new E({
505
505
  canvas: s.canvas,
506
506
  camera: a,
@@ -514,7 +514,7 @@ function T(p, e = {}) {
514
514
  enableDamping: !0,
515
515
  dampingFactor: 0.15
516
516
  } : void 0
517
- })), i && p.addComponent(new j()), t && p.addComponent(new z()), n && p.addComponent(new I()), p.addComponent(new S()), p.addComponent(new F());
517
+ })), i && p.addComponent(new j()), t && p.addComponent(new z()), n && p.addComponent(new I()), p.addComponent(new O()), p.addComponent(new F());
518
518
  }
519
519
  const fe = Object.assign(T, {
520
520
  create(p = {}) {