build-dxf 0.0.20-8 → 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/src/index3.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as THREE from "three";
2
2
  import { i as isString, n as noop, r as resolveUnref, t as tryOnScopeDispose, c as isClient, d as tryOnMounted, e as identity, f as buildProps, g as definePropType, _ as _export_sfc$1, u as useNamespace, h as isNumber, j as addUnit, w as withInstall, k as useEmptyValuesProps, l as useSizeProp, p as provideGlobalConfig, m as iconPropType, o as useGlobalComponentSettings, T as TypeComponentsMap, q as ElIcon, s as TypeComponents, v as useTimeoutFn, x as isString$1, y as isFunction, z as isBoolean, A as isElement, B as withInstallFunction, L as Lines, D as DomEventRegister, b as ElCheckbox, E as ElButton, S as SelectLocalFile } from "./selectLocalFile.js";
3
3
  import { C as Component, L as LineSegment, P as Point, B as Box2, E as EventDispatcher, b as PointVirtualGrid, Q as Quadtree, W as WhiteModel } from "./build.js";
4
+ import { watch, ref, defineComponent, computed, createElementBlock, openBlock, normalizeClass, unref, renderSlot, createVNode, Transition, withCtx, withDirectives, createElementVNode, normalizeStyle, createTextVNode, toDisplayString, vShow, shallowReactive, onMounted, createBlock, createCommentVNode, resolveDynamicComponent, Fragment, withModifiers, nextTick, isVNode, render, toRaw, onUnmounted, renderList, createStaticVNode, createApp } from "vue";
4
5
  import "clipper-lib";
5
6
  import "dxf-writer";
6
7
  import "three/addons/controls/OrbitControls.js";
7
- import { watch, ref, defineComponent, computed, createElementBlock, openBlock, normalizeClass, unref, renderSlot, createVNode, Transition, withCtx, withDirectives, createElementVNode, normalizeStyle, createTextVNode, toDisplayString, vShow, shallowReactive, onMounted, createBlock, createCommentVNode, resolveDynamicComponent, Fragment, withModifiers, nextTick, isVNode, render, toRaw, onUnmounted, renderList, createStaticVNode, TransitionGroup, createApp } from "vue";
8
8
  function unrefElement(elRef) {
9
9
  var _a;
10
10
  const plain = resolveUnref(elRef);
@@ -713,11 +713,6 @@ class CommandFlowComponent extends Component {
713
713
  if (!this._commandManager) this._commandManager = this.editor?.commandManager;
714
714
  return this._commandManager;
715
715
  }
716
- _default;
717
- get default() {
718
- if (!this._default) this._default = this.parent?.findComponentByName("Default");
719
- return this._default;
720
- }
721
716
  interruptKeys = ["escape"];
722
717
  commandName = "";
723
718
  constructor() {
@@ -732,20 +727,19 @@ class CommandFlowComponent extends Component {
732
727
  * 取消
733
728
  */
734
729
  cancel() {
735
- const commandName = this.commandName || this.constructor.commandName;
736
- if (this.commandManager.currentName !== commandName) return;
737
- this.commandManager.cancel();
730
+ if (this.editor.commandManager.currentName !== this.commandName) return;
731
+ this.editor.commandManager.cancel();
738
732
  }
739
733
  /**
740
- * 创建中断处理命令节点
734
+ * 创建中断
741
735
  * @returns
742
736
  */
743
737
  createInterrupt() {
744
738
  return (next, data) => {
745
739
  this.addEventRecord(
746
740
  "clear",
747
- this.eventInput.addEventListener("codeChange", async () => {
748
- if (this.eventInput.isKeyDowns(this.interruptKeys)) this.cancel();
741
+ this.editor?.eventInput.addEventListener("codeChange", async () => {
742
+ if (this.editor.eventInput.isKeyDowns(this.interruptKeys)) this.cancel();
749
743
  })
750
744
  );
751
745
  next(data);
@@ -937,6 +931,111 @@ class Default extends Component {
937
931
  type: "selectLineChange"
938
932
  });
939
933
  }
934
+ /**
935
+ * 删除选择的线段
936
+ */
937
+ deleteSelectLine() {
938
+ const editor = this.editor;
939
+ this.selectLines.forEach((line2) => editor.renderManager.removeLine(line2));
940
+ this.removeSelectLineAll();
941
+ this.updateSelectLinesGeometry();
942
+ ElMessage({ message: "删除成功", type: "success" });
943
+ }
944
+ /**
945
+ * 删除选择线段上的窗户
946
+ */
947
+ deleteSelectWindow() {
948
+ let is = false;
949
+ this.selectLines.forEach((line2) => {
950
+ if (!line2.userData.isWindow) return;
951
+ line2.userData = {};
952
+ is = true;
953
+ });
954
+ this.editor.renderManager.draw();
955
+ is && ElMessage({ message: "删除窗户成功", type: "success" });
956
+ }
957
+ /**
958
+ * 如果只选择两个线段,可为两个未链接的点创建连接
959
+ */
960
+ connection() {
961
+ if (this.selectLines.length !== 2) {
962
+ ElMessage({ message: "连接失败,请选择两个线段", type: "warning" });
963
+ return;
964
+ }
965
+ const editor = this.editor;
966
+ let start, end, diatance = Infinity;
967
+ for (let i = 0; i < 2; i++)
968
+ for (let j = 0; j < 2; j++) {
969
+ const point1 = this.selectLines[0].points[i];
970
+ const point2 = this.selectLines[1].points[j];
971
+ const d = point1.distance(point2);
972
+ if (d < diatance) {
973
+ start = point1;
974
+ end = point2;
975
+ diatance = d;
976
+ }
977
+ }
978
+ if (start && end) {
979
+ const line2 = new LineSegment(start.clone(), end.clone());
980
+ editor.renderManager.addLine(line2);
981
+ editor.renderManager.draw();
982
+ ElMessage({ message: "连接成功", type: "success" });
983
+ }
984
+ }
985
+ /**
986
+ * 如果只选择两个线段,可为两个未链接的点创建连接, 通过计算交点,线段延长到交点
987
+ */
988
+ intersectionConnection() {
989
+ if (this.selectLines.length !== 2) {
990
+ ElMessage({ message: "连接失败,请选择两个线段", type: "warning" });
991
+ return;
992
+ }
993
+ const editor = this.editor, line1 = this.selectLines[0], line2 = this.selectLines[1], point = this.selectLines[0].getIntersection(this.selectLines[1]);
994
+ if (!point) return;
995
+ editor.renderManager.removeLine(line1);
996
+ editor.renderManager.removeLine(line2);
997
+ if (line1.start.distance(point) < line1.end.distance(point)) {
998
+ line1.start.copy(point);
999
+ } else {
1000
+ line1.end.copy(point);
1001
+ }
1002
+ if (line2.start.distance(point) < line2.end.distance(point)) {
1003
+ line2.start.copy(point);
1004
+ } else {
1005
+ line2.end.copy(point);
1006
+ }
1007
+ editor.renderManager.addLines([line1, line2]);
1008
+ editor.renderManager.draw();
1009
+ ElMessage({ message: "连接成功", type: "success" });
1010
+ }
1011
+ /**
1012
+ * 如果只选择两个线段, 且两个线段在一条路径上,合并线段
1013
+ */
1014
+ mergeLine() {
1015
+ if (this.selectLines.length !== 2) {
1016
+ ElMessage({ message: "未执行线段合并,请选择两条线段", type: "warning" });
1017
+ return;
1018
+ }
1019
+ const editor = this.editor, line1 = this.selectLines[0], line2 = this.selectLines[1];
1020
+ for (let i = 0; i < line1.points.length; i++) {
1021
+ const p1 = line1.points[i];
1022
+ for (let j = 0; j < line2.points.length; j++) {
1023
+ const p2 = line2.points[j];
1024
+ if (p1.equal(p2)) {
1025
+ const p1Next = line1.points[(i + 1) % 2];
1026
+ const p2Next = line2.points[(j + 1) % 2];
1027
+ editor.renderManager.removeLine(line1);
1028
+ editor.renderManager.removeLine(line2);
1029
+ const line3 = new LineSegment(p1Next, p2Next);
1030
+ editor.renderManager.addLine(line3);
1031
+ editor.renderManager.draw();
1032
+ ElMessage({ message: "已合并", type: "success" });
1033
+ return;
1034
+ }
1035
+ }
1036
+ }
1037
+ ElMessage({ message: "合并失败,两条线未找到共用点", type: "warning" });
1038
+ }
940
1039
  _timer = null;
941
1040
  /**
942
1041
  * 更新选择的线段
@@ -962,6 +1061,14 @@ class Default extends Component {
962
1061
  object3D.position.z = 0.01;
963
1062
  this.selectLineObject3D.position.z = object3D.position.z + 0.01;
964
1063
  object3D.material = new THREE.MeshBasicMaterial({ color: 55561 });
1064
+ eventInput.addKeyCombination("intersectionConnection", ["control", "shift", "l"]);
1065
+ eventInput.addKeyCombination("connection", ["shift", "l"]);
1066
+ eventInput.addKeyCombination("mergeLine", ["control", "g"]);
1067
+ this.addEventRecord("clear", () => {
1068
+ eventInput.removeKeyCombination("intersectionConnection");
1069
+ eventInput.removeKeyCombination("connection");
1070
+ eventInput.removeKeyCombination("mergeLine");
1071
+ });
965
1072
  const showSelectBox = () => {
966
1073
  const startPoint = editor.pointerPosition.clone(), endPoint = editor.pointerPosition.clone(), mesh = new THREE.Mesh();
967
1074
  this.container.add(mesh);
@@ -1038,6 +1145,16 @@ class Default extends Component {
1038
1145
  }
1039
1146
  if (!eventInput.isKeyDown("control")) this.removeSelectLineAll();
1040
1147
  this.addSelectLine(currentSelectLine);
1148
+ } else if (eventInput.isOnlyKeyDown("delete")) {
1149
+ this.deleteSelectLine();
1150
+ } else if (eventInput.isKeyDowns(["q", "delete"])) {
1151
+ this.deleteSelectWindow();
1152
+ } else if (eventInput.isKeyCombination("connection")) {
1153
+ this.connection();
1154
+ } else if (eventInput.isKeyCombination("intersectionConnection")) {
1155
+ this.intersectionConnection();
1156
+ } else if (eventInput.isKeyCombination("mergeLine")) {
1157
+ this.mergeLine();
1041
1158
  }
1042
1159
  }),
1043
1160
  function() {
@@ -1056,16 +1173,10 @@ class Default extends Component {
1056
1173
  }
1057
1174
  class CommandFlow extends EventDispatcher {
1058
1175
  list = [];
1059
- rollbacklist = [];
1060
- revokeList = [];
1061
1176
  add(operation) {
1062
1177
  this.list.push(operation);
1063
1178
  return this;
1064
1179
  }
1065
- addRollback(callBack) {
1066
- }
1067
- addRevoke(callBack) {
1068
- }
1069
1180
  }
1070
1181
  class CommandManager extends EventDispatcher {
1071
1182
  commandFlowMap = /* @__PURE__ */ new Map();
@@ -1081,11 +1192,6 @@ class CommandManager extends EventDispatcher {
1081
1192
  get disabled() {
1082
1193
  return this._disabled;
1083
1194
  }
1084
- /**
1085
- * 操作记录
1086
- */
1087
- operationList = [];
1088
- rollbackList = [];
1089
1195
  constructor() {
1090
1196
  super();
1091
1197
  }
@@ -1115,7 +1221,7 @@ class CommandManager extends EventDispatcher {
1115
1221
  this.executionPromise && await this.executionPromise;
1116
1222
  this.executionPromise = null;
1117
1223
  if (this.lock) {
1118
- throw new Error("命令管理器已被 " + this.currentName + " 命令锁定,无法启动新的命令流,请退出或等待命令执行结束");
1224
+ throw new Error("命令管理器已被锁定,无法启动新的命令流");
1119
1225
  }
1120
1226
  const commandFlow = this.commandFlowMap.get(name);
1121
1227
  if (!commandFlow) {
@@ -1151,8 +1257,6 @@ class CommandManager extends EventDispatcher {
1151
1257
  if (this.abortController && !this.abortController.signal.aborted) {
1152
1258
  commandFlow.dispatchEvent({ type: "completed", data });
1153
1259
  this.dispatchEvent({ type: "completed", name, data });
1154
- this.operationList.push({ name, data });
1155
- this.rollbackList.length = 0;
1156
1260
  }
1157
1261
  this.lock = false;
1158
1262
  this.abortController = null;
@@ -1175,66 +1279,24 @@ class CommandManager extends EventDispatcher {
1175
1279
  this.executionPromise = new Promise((resolve) => this.executionResolve = resolve);
1176
1280
  }
1177
1281
  }
1178
- /**
1179
- * 回滚
1180
- */
1181
- rollback() {
1182
- }
1183
- revoke() {
1184
- }
1185
1282
  }
1186
- const connection = "data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M639.999191%20893.597594c-0.999994-54.699654-36.39977-101.099361-85.39946-118.399252-6.39996-2.199986-10.599933-8.299948-10.599933-14.999905V263.801573c0-6.699958%204.199973-12.799919%2010.599933-14.999905%2049.09969-17.299891%2084.399467-63.599598%2085.39946-118.399252C641.299183%2059.902862%20583.399549%200.503237%20512.899994%200.00324%20441.800444-0.496757%20384.000809%2057.00288%20384.000809%20128.002431c0%2055.699648%2035.599775%20103.099349%2085.299461%20120.699238%206.39996%202.299985%2010.699932%208.299948%2010.699932%2015.099904v496.396864c0%206.799957-4.299973%2012.799919-10.699932%2015.099904-49.699686%2017.599889-85.299461%2064.999589-85.299461%20120.699238%200%2070.999551%2057.799635%20128.499188%20128.899185%20127.999191%2070.499555-0.499997%20128.399189-59.899622%20127.099197-130.399176zM448.000404%20128.002431c0-35.299777%2028.699819-63.999596%2063.999596-63.999595s63.999596%2028.699819%2063.999596%2063.999595-28.699819%2063.999596-63.999596%2063.999596-63.999596-28.699819-63.999596-63.999596z%20m0%20767.995148c0-35.299777%2028.699819-63.999596%2063.999596-63.999596s63.999596%2028.699819%2063.999596%2063.999596-28.699819%2063.999596-63.999596%2063.999595-63.999596-28.699819-63.999596-63.999595z'%3e%3c/path%3e%3c/svg%3e";
1187
- const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1188
- __proto__: null,
1189
- default: connection
1190
- }, Symbol.toStringTag, { value: "Module" }));
1191
- const deleteSelectLine = "data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M909.050991%20169.476903l-217.554898%200%200-31.346939c0-39.5866-32.205493-71.792093-71.793116-71.792093L408.15591%2066.337871c-39.5866%200-71.792093%2032.205493-71.792093%2071.792093l0%2031.346939L113.349581%20169.476903c-11.013845%200-19.942191%208.940626-19.942191%2019.954471s8.928347%2019.954471%2019.942191%2019.954471l84.264149%200%200%20640.687918c0%2060.479443%2049.203632%20109.683075%20109.683075%20109.683075l416.474366%200c60.479443%200%20109.683075-49.203632%20109.683075-109.683075L833.454246%20209.385844l75.595722%200c11.012821%200%2019.942191-8.940626%2019.942191-19.954471S920.063813%20169.476903%20909.050991%20169.476903zM376.2482%20138.130987c0-17.593703%2014.314007-31.907711%2031.907711-31.907711l211.547067%200c17.593703%200%2031.907711%2014.314007%2031.907711%2031.907711l0%2031.346939L376.2482%20169.477926%20376.2482%20138.130987zM793.569864%20850.074785c0%2038.486546-31.312146%2069.798692-69.798692%2069.798692L307.297828%20919.873478c-38.486546%200-69.798692-31.312146-69.798692-69.798692L237.499136%20211.042577l556.070728%200L793.569864%20850.074785zM510.662539%20861.276918c11.012821%200%2019.954471-8.92937%2019.954471-19.942191L530.61701%20294.912753c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471%208.928347-19.954471%2019.942191L490.708068%20841.334727C490.708068%20852.347548%20499.649717%20861.276918%20510.662539%20861.276918zM374.562814%20801.449321c11.012821%200%2019.954471-8.92937%2019.954471-19.942191L394.517285%20354.74035c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471%208.928347-19.954471%2019.942191l0%20426.76678C354.608344%20792.519951%20363.549993%20801.449321%20374.562814%20801.449321zM649.832182%20801.449321c11.012821%200%2019.954471-8.92937%2019.954471-19.942191L669.786653%20354.74035c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471%208.928347-19.954471%2019.942191l0%20426.76678C629.877711%20792.519951%20638.81936%20801.449321%20649.832182%20801.449321z'%20%3e%3c/path%3e%3c/svg%3e";
1192
- const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1193
- __proto__: null,
1194
- default: deleteSelectLine
1195
- }, Symbol.toStringTag, { value: "Module" }));
1196
- const deleteSelectWindow = "data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M220.451548%20913.518482V318.145854c0-27.62038%2022.505495-50.125874%2050.125875-50.125874H865.95005c27.62038%200%2050.125874%2022.505495%2050.125874%2050.125874v218.917083h59.332667V318.145854c0-60.355644-49.102897-109.458541-109.458541-109.458541h-39.896104v-99.228772C826.053946%2049.102897%20776.951049%200%20716.595405%200H121.222777C60.867133%200%2011.764236%2049.102897%2011.764236%20109.458541V705.854146c0%2060.355644%2049.102897%20109.458541%20109.458541%20109.458541h39.896104v99.228772c0%2060.355644%2049.102897%20109.458541%20109.458542%20109.458541h257.790209v-59.332667H269.554446c-26.597403-1.022977-49.102897-23.528472-49.102898-51.148851z%20m-59.332667-595.372628v436.811189h-39.896104c-27.62038%200-50.125874-22.505495-50.125874-50.125874V109.458541c0-27.62038%2022.505495-50.125874%2050.125874-50.125874H716.595405c27.62038%200%2050.125874%2022.505495%2050.125874%2050.125874v99.228772H269.554446c-59.332667%200-108.435564%2049.102897-108.435565%20109.458541z'%20%3e%3c/path%3e%3cpath%20d='M902.777223%20854.185814l98.205794-98.205794c15.344655-15.344655%2015.344655-40.919081%200-56.263736s-40.919081-15.344655-56.263736%200L846.513487%20797.922078%20747.284715%20699.716284c-15.344655-15.344655-40.919081-15.344655-56.263736%200s-15.344655%2040.919081%200%2056.263736l98.205794%2098.205794-98.205794%2098.205794c-15.344655%2015.344655-15.344655%2040.919081%200%2056.263737s40.919081%2015.344655%2056.263736%200l98.205794-98.205795%2098.205795%2098.205795c15.344655%2015.344655%2040.919081%2015.344655%2056.263736%200s15.344655-40.919081%200-56.263737l-97.182817-98.205794z'%20%3e%3c/path%3e%3c/svg%3e";
1197
- const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1198
- __proto__: null,
1199
- default: deleteSelectWindow
1200
- }, Symbol.toStringTag, { value: "Module" }));
1201
1283
  const door = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1757902601497'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='9801'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M761.344%20119.296H226.816c-18.944%200-39.424%2011.776-39.424%2030.72V921.6h614.4V148.48c0.512-18.944-22.016-29.184-40.448-29.184z%20m-537.6%20768c-2.048%200-2.048%200%200%200L221.696%20163.84c0-5.12%205.12-10.24%2010.24-10.24h522.24c8.704%200%2013.824%205.12%2013.824%2013.824v720.384s0%201.536-1.536%201.536h-15.36V194.56c0-16.896-8.704-24.064-29.184-24.064H266.24c-18.944%200-27.136%208.704-27.136%2024.064v692.736h-15.36z%20m49.152%200V204.8H716.8v682.496H272.896z'%20p-id='9802'%3e%3c/path%3e%3cpath%20d='M648.704%20508.416c-16.896%200-32.256%2013.824-32.256%2032.256%200%2016.896%2013.824%2032.256%2032.256%2032.256s32.256-13.824%2032.256-32.256c0-16.896-13.824-32.256-32.256-32.256z'%20p-id='9803'%3e%3c/path%3e%3c/svg%3e";
1202
- const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1284
+ const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1203
1285
  __proto__: null,
1204
1286
  default: door
1205
1287
  }, Symbol.toStringTag, { value: "Module" }));
1206
- const intersectionConnection = "data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M491.80027198%20557.44938977c-10.0998647-15.14979706-20.19972802-25.24966037-35.34952507-35.34952507-15.14979706-10.0998647-30.29959271-15.14979706-50.49932211-15.14979704-55.54925309%200-100.99864286%2045.44938977-100.99864287%20100.99864285%200%2015.14979706%205.04993234%2035.34952507%2015.14979568%2050.49932212%2010.0998647%2015.14979706%2020.19972802%2030.29959271%2035.34952506%2035.34952508%2015.14979706%2010.0998647%2035.34952507%2015.14979706%2050.49932213%2015.14979567%2055.54925309%200%20100.99864286-45.44938977%20100.99864286-100.99864287%200-15.14979706-5.04993234-35.34952507-15.14979568-50.49932074z%20m-85.84884718%20100.99864286h-15.14979706c-20.19972802-5.04993234-30.29959271-20.19972802-35.34952507-35.34952507V612.99864286c0-30.29959271%2025.24966037-50.49932212%2050.49932213-50.49932074h10.09986469c15.14979706%205.04993234%2030.29959271%2015.14979706%2035.34952507%2035.34952507v15.14979567c5.04993234%2025.24966037-20.19972802%2045.44938977-45.44938976%2045.44938977z'%3e%3c/path%3e%3cpath%20d='M390.80162774%20658.44803263l-40.39945604%2040.39945743-227.24694747%20222.19701373-35.34952506-35.34952508%20227.24694745-227.24694608%2040.39945605-40.39945743c5.04993234%2020.19972802%2020.19972802%2035.34952507%2035.34952507%2040.39945743zM648.34816793%20405.9514248l-40.39945742%2040.3994574-116.14843853%20116.14843992-40.39945742%2035.34952507c-5.04993234-20.19972802-20.19972802-30.29959271-35.34952507-35.34952507l40.39945742-40.39945742%20116.14843853-111.09850756%2035.34952507-35.34952507c10.0998647%2015.14979706%2020.19972802%2025.24966037%2040.39945742%2030.29959273zM926.09443614%20133.25508894L749.34681078%20310.00271428l-40.3994574%2040.39945742c-5.04993234-20.19972802-15.14979706-35.34952507-30.29959272-40.39945742l35.34952506-40.39945742%20176.74762534-176.74762535%2035.34952508%2040.39945743z'%20%3e%3c/path%3e%3cpath%20d='M749.34681078%20310.00271428c-10.0998647-15.14979706-20.19972802-30.29959271-35.34952506-35.34952506-15.14979706-10.0998647-35.34952507-15.14979706-55.54925309-15.14979706-55.54925309%200-100.99864286%2045.44938977-100.99864286%20100.99864286%200%2020.19972802%205.04993234%2040.39945743%2015.14979567%2055.54925447%2010.0998647%2015.14979706%2020.19972802%2025.24966037%2035.34952507%2035.34952507%2015.14979706%2010.0998647%2030.29959271%2015.14979706%2050.49932212%2015.14979567%2055.54925309%200%20100.99864286-45.44938977%20100.99864286-100.99864286%200-25.24966037-5.04993234-40.39945743-10.09986471-55.54925309z%20m-90.89877815%2095.94871052h-10.0998647c-20.19972802-5.04993234-35.34952507-15.14979706-40.39945742-35.34952509%200-5.04993234-5.04993234-10.0998647-5.04993234-15.14979704%200-30.29959271%2025.24966037-50.49932212%2050.49932212-50.49932074%205.04993234%200%2010.0998647%200%2015.14979704%205.04993235%2015.14979706%205.04993234%2030.29959271%2020.19972802%2030.29959273%2040.39945742v10.09986332c10.0998647%2025.24966037-15.14979706%2045.44938977-40.39945743%2045.44938978z'%20%3e%3c/path%3e%3c/svg%3e";
1207
- const __vite_glob_0_4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1208
- __proto__: null,
1209
- default: intersectionConnection
1210
- }, Symbol.toStringTag, { value: "Module" }));
1211
1288
  const line = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1757902422799'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='1735'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M843.2%20726.4c-20.2%200-39.2%205.2-55.8%2014.3L283.8%20237.2c9-16.5%2014.1-35.4%2014.1-55.5%200-64.2-52.3-116.5-116.5-116.5S65%20117.4%2065%20181.6s52.3%20116.5%20116.5%20116.5c20.2%200%2039.2-5.2%2055.8-14.2l503.5%20503.5c-9%2016.5-14.1%2035.4-14.1%2055.5%200%2064.2%2052.3%20116.5%20116.5%20116.5s116.5-52.3%20116.5-116.5-52.3-116.5-116.5-116.5zM181.4%20232.1c-27.8%200-50.5-22.6-50.5-50.5s22.6-50.5%2050.5-50.5%2050.5%2022.6%2050.5%2050.5-22.6%2050.5-50.5%2050.5z%20m661.8%20661.3c-27.8%200-50.5-22.6-50.5-50.5%200-27.8%2022.6-50.5%2050.5-50.5s50.5%2022.6%2050.5%2050.5c0%2027.8-22.7%2050.5-50.5%2050.5z'%20fill='%23231815'%20p-id='1736'%3e%3c/path%3e%3c/svg%3e";
1212
- const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1289
+ const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1213
1290
  __proto__: null,
1214
1291
  default: line
1215
1292
  }, Symbol.toStringTag, { value: "Module" }));
1216
- const mergeLine = "data:image/svg+xml,%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M114.176%2046.528h618.496c37.312%200.064%2067.584%2030.336%2067.648%2067.648v618.56c0%2037.248-30.336%2067.584-67.648%2067.584H114.176A67.776%2067.776%200%200%201%2046.528%20732.8V114.176c0-37.312%2030.336-67.648%2067.648-67.648z%20m2.176%20686.208l616.32-2.24-2.176-616.32-614.144%202.176v616.32zM907.648%20291.2l2.176%20616.32H291.264a34.88%2034.88%200%201%200%200%2069.888h618.56c37.312%200%2067.648-30.336%2067.648-67.648V291.264a34.88%2034.88%200%201%200-69.824%200z'%20%3e%3c/path%3e%3c/svg%3e";
1217
- const __vite_glob_0_6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1218
- __proto__: null,
1219
- default: mergeLine
1220
- }, Symbol.toStringTag, { value: "Module" }));
1221
- const selectAll = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='11576'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M102.4%20302.08c5.12%205.12%2015.36%2010.24%2025.6%2010.24s15.36-5.12%2025.6-10.24l174.08-174.08c5.12-5.12%2010.24-15.36%2010.24-25.6s-5.12-15.36-10.24-25.6c-20.48-5.12-40.96-5.12-51.2%2010.24l-148.48%20153.6-71.68-76.8C51.2%20158.72%2040.96%20158.72%2035.84%20158.72c-10.24%200-15.36%205.12-25.6%2010.24-5.12%205.12-10.24%2010.24-10.24%2020.48s5.12%2015.36%2010.24%2025.6L102.4%20302.08zM276.48%20409.6l-148.48%20153.6-71.68-71.68C51.2%20486.4%2040.96%20481.28%2035.84%20481.28c-10.24%200-15.36%205.12-25.6%2010.24-5.12%2010.24-10.24%2015.36-10.24%2025.6s5.12%2015.36%2010.24%2025.6L102.4%20629.76c5.12%205.12%2015.36%2010.24%2025.6%2010.24s15.36-5.12%2025.6-10.24L322.56%20460.8c5.12-5.12%2010.24-15.36%2010.24-25.6s-5.12-15.36-10.24-25.6c-10.24-10.24-30.72-10.24-46.08%200z%20m0%20327.68l-148.48%20153.6L56.32%20819.2c-5.12-5.12-15.36-10.24-25.6-10.24s-15.36%205.12-25.6%2010.24c0%205.12-5.12%2015.36-5.12%2025.6s5.12%2015.36%2010.24%2025.6L102.4%20957.44c5.12%205.12%2015.36%2010.24%2025.6%2010.24h5.12c10.24%200%2015.36-5.12%2025.6-10.24l174.08-174.08c5.12-5.12%2010.24-15.36%2010.24-25.6s-5.12-15.36-10.24-25.6c-25.6-5.12-40.96-5.12-56.32%205.12zM1024%20153.6c0%2030.72-25.6%2056.32-56.32%2056.32h-460.8c-30.72%200-61.44-25.6-61.44-56.32%200-30.72%2025.6-56.32%2056.32-56.32h455.68c35.84-5.12%2066.56%2020.48%2066.56%2056.32z%20m0%20358.4c0%2030.72-25.6%2056.32-56.32%2056.32h-460.8c-30.72%200-56.32-25.6-56.32-56.32s25.6-56.32%2056.32-56.32h455.68c35.84%200%2061.44%2025.6%2061.44%2056.32z%20m-5.12%20358.4c0%2030.72-25.6%2056.32-56.32%2056.32h-460.8c-30.72%200-56.32-25.6-56.32-56.32%200-30.72%2025.6-56.32%2056.32-56.32h455.68c35.84%200%2061.44%2025.6%2061.44%2056.32z%20m0%200'%20%3e%3c/path%3e%3c/svg%3e";
1222
- const __vite_glob_0_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1223
- __proto__: null,
1224
- default: selectAll
1225
- }, Symbol.toStringTag, { value: "Module" }));
1226
1293
  const selectPoint = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1757902488735'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='3957'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M520.416%20179.392c-12.384%200-22.4%204.672-22.4%2010.432l-0.032%20139.136c0%205.76%2010.016%2010.432%2022.368%2010.432%2012.352%200%2022.368-4.672%2022.368-10.432l0.064-139.136c0-5.76-10.016-10.432-22.4-10.432M520.32%20623.04c-12.352%200-22.368%204.64-22.368%2010.4l-0.032%20139.168c0%205.76%2010.016%2010.432%2022.368%2010.432%2012.352%200%2022.368-4.672%2022.368-10.432l0.064-139.168c0-5.76-10.016-10.4-22.4-10.4M800.256%20458.72l-139.168-0.064c-5.76%200-10.432%2010.016-10.432%2022.4%200%2012.352%204.672%2022.368%2010.432%2022.368l139.168%200.032c5.76%200%2010.4-10.016%2010.4-22.368%200-12.352-4.64-22.368-10.4-22.4zM352.256%20458.72l-139.168-0.064c-5.76%200-10.432%2010.016-10.432%2022.4%200%2012.352%204.672%2022.368%2010.432%2022.368l139.168%200.032c5.76%200%2010.4-10.016%2010.4-22.368%200-12.352-4.64-22.368-10.4-22.4M801.568%20748.672l-72.544-72.544%2073.792-23.2a4.416%204.416%200%200%200%200.096-8.384l-183.136-62.4a4.416%204.416%200%200%200-5.6%205.568l62.464%20183.168a4.416%204.416%200%200%200%208.352-0.064l23.36-73.6%2072.32%2072.32a14.752%2014.752%200%200%200%2020.896-20.864M510.688%20382.112c49.952%200%2092.8%2040.832%2092.8%2092.8%200%2051.968-42.848%2092.8-92.8%2092.8-49.984%200-92.8-40.832-92.8-92.8%200-51.968%2042.816-92.8%2092.8-92.8z'%20p-id='3958'%3e%3c/path%3e%3c/svg%3e";
1227
- const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1294
+ const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1228
1295
  __proto__: null,
1229
1296
  default: selectPoint
1230
1297
  }, Symbol.toStringTag, { value: "Module" }));
1231
- const verticalCorrection = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='10587'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='%23555'%20width='16'%20height='16'%3e%3cpath%20d='M64.21%20703.88h888.34M64.21%20667.88h888.34v72H64.21z'%3e%3c/path%3e%3cpath%20d='M509.58%20102.72v566.13M473.58%20102.72h72v566.14h-72z'%3e%3c/path%3e%3c/svg%3e";
1232
- const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1233
- __proto__: null,
1234
- default: verticalCorrection
1235
- }, Symbol.toStringTag, { value: "Module" }));
1236
1298
  const window$1 = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1757902547951'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='5129'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M59.355%2091.776v867.881h867.881V91.776H59.356zM897.31%20929.73H89.282V121.703h808.027V929.73z'%20fill=''%20p-id='5130'%3e%3c/path%3e%3cpath%20d='M833.964%20185.048H152.627v681.337h681.337V185.048z%20m-355.632%20651.41H182.554V532.2h295.778v304.257z%20m0-334.184H182.554V214.975h295.778v287.299z%20m325.705%20334.184H508.259V532.2h295.778v304.257z%20m0-334.184H508.259V214.975h295.778v287.299z'%20fill=''%20p-id='5131'%3e%3c/path%3e%3c/svg%3e";
1237
- const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1299
+ const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1238
1300
  __proto__: null,
1239
1301
  default: window$1
1240
1302
  }, Symbol.toStringTag, { value: "Module" }));
@@ -1436,12 +1498,11 @@ class RenderManager extends Component {
1436
1498
  const drawDoorData = userData.drawDoorData;
1437
1499
  const insetionArr = this.quadtree.queryLineSegment(line2).filter((r) => r.line !== line2 && !r.userData?.isDoor).map((r) => ({ index: this.lines.indexOf(r.line) }));
1438
1500
  return {
1439
- start: line2.start.toJson(this.dxf.originalZAverage),
1440
- end: line2.end.toJson(this.dxf.originalZAverage),
1501
+ start: line2.start.toJson(),
1502
+ end: line2.end.toJson(),
1441
1503
  insetionArr,
1442
1504
  isDoor: userData.isDoor,
1443
1505
  doorDirectConnection: userData.isDoor,
1444
- length: line2.length(),
1445
1506
  isWindow: userData.isWindow,
1446
1507
  drawDoorData: drawDoorData && drawDoorData.map((w) => ({
1447
1508
  p: { x: w.p.x, y: w.p.y, z: w.p.z },
@@ -1649,365 +1710,15 @@ class DrawWindow extends CommandFlowComponent {
1649
1710
  this.renderManager.draw();
1650
1711
  }
1651
1712
  }
1652
- class VerticalCorrection extends CommandFlowComponent {
1653
- static name = "VerticalCorrection";
1654
- container = new THREE.Group();
1655
- shortcutKeys = ["control", "c"];
1656
- static commandName = "verticalCorrection";
1657
- onAddFromParent(parent) {
1658
- super.onAddFromParent(parent);
1659
- this.editor.container.add(this.container);
1660
- this.container.position.z = 1e-3;
1661
- const commandFlow = this.commandManager.addCommandFlow(VerticalCorrection.commandName).add(this.createInterrupt()).add(this.constraint.bind(this)).add(this.verticalCorrection.bind(this));
1662
- commandFlow.addEventListener("finally", this.createFinally());
1663
- this.eventInput.addKeyCombination(VerticalCorrection.commandName, this.shortcutKeys);
1664
- this.eventInput.addEventListener("codeChange", async () => {
1665
- this.eventInput.isKeyCombination(VerticalCorrection.commandName) && await this.commandManager.start(VerticalCorrection.commandName, [...this.default.selectLines]);
1666
- });
1667
- this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
1668
- }
1669
- /**
1670
- * 进入命令约束
1671
- */
1672
- constraint(next, selectLines) {
1673
- if (!Array.isArray(selectLines)) {
1674
- ElMessage({ message: "进入命令失败", type: "warning" });
1675
- this.cancel();
1676
- } else if (selectLines.length !== 1) {
1677
- ElMessage({ message: "请选择一条线段", type: "warning" });
1678
- this.cancel();
1679
- } else next(selectLines);
1680
- }
1681
- /**
1682
- * 线段是否为结尾线段
1683
- * @param line
1684
- */
1685
- lineIsPathEnd(line2) {
1686
- for (let i = 0; i < line2.points.length; i++) {
1687
- const point = line2.points[i];
1688
- const length = this.renderManager.pointVirtualGrid.queryPoint(point).filter((p) => !p.point.equal(point)).length;
1689
- if (length === 0) return true;
1690
- }
1691
- return false;
1692
- }
1693
- /**
1694
- * 设置所有相同点的位置
1695
- * @param point
1696
- * @param point2
1697
- */
1698
- setPointAll(point, point2) {
1699
- const resultList = this.renderManager.pointVirtualGrid.queryPoint(point);
1700
- resultList.forEach((result) => result.point.copy(point2));
1701
- }
1702
- /** 修正
1703
- * @param selectLine
1704
- * @param vistedList
1705
- */
1706
- correction(selectLine, vistedList = /* @__PURE__ */ new Set()) {
1707
- if (vistedList.has(selectLine)) return;
1708
- vistedList.add(selectLine);
1709
- const lines = this.renderManager.quadtree.queryLineSegment(selectLine).filter(({ line: line2 }) => {
1710
- if (line2 === selectLine || line2.userData.isDoor) return false;
1711
- return true;
1712
- }).map((result) => result.line), selectLineDirection = selectLine.direction();
1713
- lines.forEach((line2) => {
1714
- if (vistedList.has(line2)) return false;
1715
- const direction = line2.direction(), angle = selectLineDirection.angleBetween(direction, "angle"), gap = Math.abs(90 - angle);
1716
- if (gap > 20 || gap < 2) return;
1717
- const mode0 = selectLine.start.equal(line2.start) || selectLine.start.equal(line2.end) ? "start" : "end", mode1 = line2.start.equal(selectLine.start) || line2.start.equal(selectLine.end) ? "start" : "end";
1718
- const point = selectLine.projectPoint(mode1 === "start" ? line2.end : line2.start, false);
1719
- if (!point) return;
1720
- const point0 = mode0 === "start" ? selectLine.start : selectLine.end, point1 = mode1 === "start" ? line2.start : line2.end;
1721
- this.setPointAll(point0, point);
1722
- this.setPointAll(point1, point);
1723
- this.renderManager.removeLine(line2);
1724
- this.renderManager.addLine(line2);
1725
- });
1726
- lines.forEach((line2) => this.correction(line2, vistedList));
1727
- return vistedList;
1728
- }
1729
- /** 开始
1730
- * @param next
1731
- */
1732
- verticalCorrection(next, selectLines) {
1733
- this.correction(selectLines[0]);
1734
- this.renderManager.draw();
1735
- next();
1736
- }
1737
- }
1738
- class MergeLine extends CommandFlowComponent {
1739
- static name = "MergeLine";
1740
- shortcutKeys = ["control", "g"];
1741
- static commandName = "merge-line";
1742
- onAddFromParent(parent) {
1743
- super.onAddFromParent(parent);
1744
- const defaultComponent = parent.findComponentByType(Default);
1745
- const commandFlow = this.commandManager.addCommandFlow(MergeLine.commandName).add(this.createInterrupt()).add(this.constraint.bind(this)).add(this.mergeLine.bind(this));
1746
- commandFlow.addEventListener("finally", this.createFinally());
1747
- this.eventInput.addKeyCombination(MergeLine.commandName, this.shortcutKeys);
1748
- this.eventInput.addEventListener("codeChange", async () => {
1749
- defaultComponent?.selectLines.length === 2 && this.eventInput.isKeyCombination(MergeLine.commandName) && await this.commandManager.start(MergeLine.commandName, [...this.default.selectLines]);
1750
- });
1751
- this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
1752
- }
1753
- /**
1754
- * 进入命令约束
1755
- */
1756
- constraint(next, selectLines) {
1757
- if (!Array.isArray(selectLines)) {
1758
- ElMessage({ message: "进入命令失败", type: "warning" });
1759
- this.cancel();
1760
- } else if (selectLines.length !== 2) {
1761
- ElMessage({ message: "未执行线段合并,请选择两条线段", type: "warning" });
1762
- this.cancel();
1763
- } else {
1764
- next(selectLines);
1765
- }
1766
- }
1767
- /** 开始
1768
- * @param next
1769
- */
1770
- mergeLine(next, selectLines) {
1771
- const editor = this.editor, line1 = selectLines[0], line2 = selectLines[1];
1772
- for (let i = 0; i < line1.points.length; i++) {
1773
- const p1 = line1.points[i];
1774
- for (let j = 0; j < line2.points.length; j++) {
1775
- const p2 = line2.points[j];
1776
- if (p1.equal(p2)) {
1777
- const p1Next = line1.points[(i + 1) % 2];
1778
- const p2Next = line2.points[(j + 1) % 2];
1779
- editor.renderManager.removeLine(line1);
1780
- editor.renderManager.removeLine(line2);
1781
- const line3 = new LineSegment(p1Next, p2Next);
1782
- editor.renderManager.addLine(line3);
1783
- editor.renderManager.draw();
1784
- ElMessage({ message: "已合并", type: "success" });
1785
- return next();
1786
- }
1787
- }
1788
- }
1789
- ElMessage({ message: "合并失败,两条线未找到共用点", type: "warning" });
1790
- next();
1791
- }
1792
- }
1793
- class DeleteSelectLine extends CommandFlowComponent {
1794
- static name = "DeleteSelectLine";
1795
- shortcutKeys = ["Delete"];
1796
- static commandName = "deleteSelectLine";
1797
- onAddFromParent(parent) {
1798
- super.onAddFromParent(parent);
1799
- const commandFlow = this.commandManager.addCommandFlow(DeleteSelectLine.commandName).add(this.createInterrupt()).add(this.constraint.bind(this)).add(this.delete.bind(this));
1800
- commandFlow.addEventListener("finally", this.createFinally());
1801
- this.eventInput.addKeyCombination(DeleteSelectLine.commandName, this.shortcutKeys);
1802
- this.eventInput.addEventListener("codeChange", async () => {
1803
- this.eventInput.isKeyCombination(DeleteSelectLine.commandName) && await this.commandManager.start(DeleteSelectLine.commandName, [...this.default.selectLines]);
1804
- });
1805
- this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
1806
- }
1807
- /**
1808
- * 进入命令约束
1809
- */
1810
- constraint(next, selectLines) {
1811
- if (!Array.isArray(selectLines)) {
1812
- ElMessage({ message: "请选择线段", type: "warning" });
1813
- this.cancel();
1814
- } else {
1815
- next(selectLines);
1816
- }
1817
- }
1818
- /** 开始
1819
- * @param next
1820
- */
1821
- delete(next, selectLines) {
1822
- const editor = this.editor;
1823
- selectLines.forEach((line2) => editor.renderManager.removeLine(line2));
1824
- ElMessage({ message: "删除成功", type: "success" });
1825
- next();
1826
- }
1827
- }
1828
- class ConnectionLine extends CommandFlowComponent {
1829
- static name = "ConnectionLine";
1830
- shortcutKeys = ["Shift", "L"];
1831
- static commandName = "connectionLine";
1832
- onAddFromParent(parent) {
1833
- super.onAddFromParent(parent);
1834
- const commandFlow = this.commandManager.addCommandFlow(ConnectionLine.commandName).add(this.createInterrupt()).add(this.constraint.bind(this)).add(this.connection.bind(this));
1835
- commandFlow.addEventListener("finally", this.createFinally());
1836
- this.eventInput.addKeyCombination(ConnectionLine.commandName, this.shortcutKeys);
1837
- this.eventInput.addEventListener("codeChange", async () => {
1838
- this.eventInput.isKeyCombination(ConnectionLine.commandName) && await this.commandManager.start(ConnectionLine.commandName, [...this.default.selectLines]);
1839
- });
1840
- this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
1841
- }
1842
- /**
1843
- * 进入命令约束
1844
- */
1845
- constraint(next, selectLines) {
1846
- if (!Array.isArray(selectLines)) {
1847
- ElMessage({ message: "进入命令失败", type: "warning" });
1848
- this.cancel();
1849
- } else if (selectLines.length !== 2) {
1850
- ElMessage({ message: "请选择2条线段", type: "warning" });
1851
- this.cancel();
1852
- } else {
1853
- next(selectLines);
1854
- }
1855
- }
1856
- /** 开始
1857
- * @param next
1858
- */
1859
- connection(next, selectLines) {
1860
- const editor = this.editor;
1861
- let start, end, diatance = Infinity;
1862
- for (let i = 0; i < 2; i++)
1863
- for (let j = 0; j < 2; j++) {
1864
- const point1 = selectLines[0].points[i];
1865
- const point2 = selectLines[1].points[j];
1866
- const d = point1.distance(point2);
1867
- if (d < diatance) {
1868
- start = point1;
1869
- end = point2;
1870
- diatance = d;
1871
- }
1872
- }
1873
- if (start && end) {
1874
- const line2 = new LineSegment(start.clone(), end.clone());
1875
- editor.renderManager.addLine(line2);
1876
- editor.renderManager.draw();
1877
- ElMessage({ message: "连接成功", type: "success" });
1878
- }
1879
- next();
1880
- }
1881
- }
1882
- class IntersectionConnectionLine extends CommandFlowComponent {
1883
- static name = "IntersectionConnectionLine";
1884
- shortcutKeys = ["control", "Shift", "L"];
1885
- static commandName = "intersectionConnectionLine";
1886
- onAddFromParent(parent) {
1887
- super.onAddFromParent(parent);
1888
- const commandFlow = this.commandManager.addCommandFlow(IntersectionConnectionLine.commandName).add(this.createInterrupt()).add(this.constraint.bind(this)).add(this.connection.bind(this));
1889
- commandFlow.addEventListener("finally", this.createFinally());
1890
- this.eventInput.addKeyCombination(IntersectionConnectionLine.commandName, this.shortcutKeys);
1891
- this.eventInput.addEventListener("codeChange", async () => {
1892
- this.eventInput.isKeyCombination(IntersectionConnectionLine.commandName) && await this.commandManager.start(IntersectionConnectionLine.commandName, [...this.default.selectLines]);
1893
- });
1894
- this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
1895
- }
1896
- /**
1897
- * 进入命令约束
1898
- */
1899
- constraint(next, selectLines) {
1900
- if (!Array.isArray(selectLines)) {
1901
- ElMessage({ message: "进入命令失败", type: "warning" });
1902
- this.cancel();
1903
- } else if (selectLines.length !== 2) {
1904
- ElMessage({ message: "请选择2条线段", type: "warning" });
1905
- this.cancel();
1906
- } else {
1907
- next(selectLines);
1908
- }
1909
- }
1910
- /** 开始
1911
- * @param next
1912
- */
1913
- connection(next, selectLines) {
1914
- const editor = this.editor, line1 = selectLines[0], line2 = selectLines[1], point = selectLines[0].getIntersection(selectLines[1]);
1915
- if (!point) return;
1916
- editor.renderManager.removeLine(line1);
1917
- editor.renderManager.removeLine(line2);
1918
- if (line1.start.distance(point) < line1.end.distance(point)) {
1919
- line1.start.copy(point);
1920
- } else {
1921
- line1.end.copy(point);
1922
- }
1923
- if (line2.start.distance(point) < line2.end.distance(point)) {
1924
- line2.start.copy(point);
1925
- } else {
1926
- line2.end.copy(point);
1927
- }
1928
- editor.renderManager.addLines([line1, line2]);
1929
- editor.renderManager.draw();
1930
- ElMessage({ message: "连接成功", type: "success" });
1931
- next();
1932
- }
1933
- }
1934
- class DeleteSelectWindow extends CommandFlowComponent {
1935
- static name = "DeleteSelectWindow";
1936
- shortcutKeys = ["Q", "Delete"];
1937
- static commandName = "deleteSelectWindow";
1938
- onAddFromParent(parent) {
1939
- super.onAddFromParent(parent);
1940
- const commandFlow = this.commandManager.addCommandFlow(DeleteSelectWindow.commandName).add(this.createInterrupt()).add(this.constraint.bind(this)).add(this.connection.bind(this));
1941
- commandFlow.addEventListener("finally", this.createFinally());
1942
- this.eventInput.addKeyCombination(DeleteSelectWindow.commandName, this.shortcutKeys);
1943
- this.eventInput.addEventListener("codeChange", async () => {
1944
- this.eventInput.isKeyCombination(DeleteSelectWindow.commandName) && await this.commandManager.start(DeleteSelectWindow.commandName, [...this.default.selectLines]);
1945
- });
1946
- this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
1947
- }
1948
- /**
1949
- * 进入命令约束
1950
- */
1951
- constraint(next, selectLines) {
1952
- if (!Array.isArray(selectLines)) {
1953
- ElMessage({ message: "进入命令失败", type: "warning" });
1954
- this.cancel();
1955
- } else if (!selectLines.some((l) => l.userData.isWindow)) {
1956
- ElMessage({ message: "请选择有窗户线段", type: "warning" });
1957
- this.cancel();
1958
- } else {
1959
- next(selectLines);
1960
- }
1961
- }
1962
- /** 开始
1963
- * @param next
1964
- */
1965
- connection(next, selectLines) {
1966
- let is = false;
1967
- selectLines.forEach((line2) => {
1968
- if (!line2.userData.isWindow) return;
1969
- line2.userData = {};
1970
- is = true;
1971
- });
1972
- this.renderManager.draw();
1973
- is && ElMessage({ message: "删除窗户成功", type: "success" });
1974
- next();
1975
- }
1976
- }
1977
- class SelectAll extends CommandFlowComponent {
1978
- static name = "SelectAll";
1979
- container = new THREE.Group();
1980
- shortcutKeys = ["control", "a"];
1981
- static commandName = "selectAll";
1982
- onAddFromParent(parent) {
1983
- super.onAddFromParent(parent);
1984
- this.editor.container.add(this.container);
1985
- this.container.position.z = 1e-3;
1986
- const commandFlow = this.commandManager.addCommandFlow(SelectAll.commandName).add(this.createInterrupt()).add(this.selectAll.bind(this));
1987
- commandFlow.addEventListener("finally", this.createFinally());
1988
- this.eventInput.addKeyCombination(SelectAll.commandName, this.shortcutKeys);
1989
- this.eventInput.addEventListener("codeChange", async () => {
1990
- this.eventInput.isKeyCombination(SelectAll.commandName) && await this.commandManager.start(SelectAll.commandName);
1991
- });
1992
- this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
1993
- }
1994
- /** 开始
1995
- * @param next
1996
- */
1997
- selectAll(next) {
1998
- this.renderManager.lines.map((line2) => this.default.addSelectLine(line2));
1999
- next();
2000
- }
2001
- }
2002
1713
  const _hoisted_1 = {
2003
1714
  key: 0,
2004
1715
  class: "mt-[5px] text-[#ccc] text-[11px] absolute left-[10px] bottom-[10px] rounded-[8px] min-w-[150px] bg-black/15 p-[10px]"
2005
1716
  };
2006
- const _hoisted_2 = { class: "text-start max-w-[150px]" };
1717
+ const _hoisted_2 = { class: "text-start max-w-[100px]" };
2007
1718
  const _hoisted_3 = { class: "inline-block ml-[10px] text-[var(--color-primary)]" };
2008
1719
  const _hoisted_4 = {
2009
1720
  key: 0,
2010
- class: "p-[5px] max-w-[180px]"
1721
+ class: "p-[5px] min-w-[140px]"
2011
1722
  };
2012
1723
  const _hoisted_5 = { class: "text-[14px] flex flex-col" };
2013
1724
  const _hoisted_6 = ["onClick"];
@@ -2026,9 +1737,11 @@ const _hoisted_12 = {
2026
1737
  key: 0,
2027
1738
  class: "flex flex-row items-center flex-wrap justify-between gap-[10px] mt-[10px] text-[10px]"
2028
1739
  };
2029
- const _hoisted_13 = { class: "flex-wrap border-t-1 border-t-[#eee] mt-[5px] pt-[5px] flex items-center gap-[10px]" };
2030
- const _hoisted_14 = ["onClick", "title"];
2031
- const _hoisted_15 = ["src"];
1740
+ const _hoisted_13 = { class: "border-t-1 border-t-[#eee] mt-[5px] pt-[5px] h-[20px] flex items-center gap-[10px]" };
1741
+ const _hoisted_14 = {
1742
+ key: 1,
1743
+ class: "select-none flex-1 flex justify-center text-[12px] text-[#999]"
1744
+ };
2032
1745
  const _sfc_main = /* @__PURE__ */ defineComponent({
2033
1746
  __name: "EditorTool",
2034
1747
  props: {
@@ -2089,7 +1802,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2089
1802
  document.addEventListener("mouseup", end);
2090
1803
  }
2091
1804
  const props = __props;
2092
- const originalLineVisible = ref(true), dxfVisible = ref(true), whiteModelVisible = ref(true), isLook = ref(false), elRef = ref(), toolBarRef = ref(), toolBarExpand = ref(true), currentCommand = ref(""), dxfSystem = toRaw(props.dxfSystem), domEventRegister = dxfSystem.findComponentByType(DomEventRegister), editor = dxfSystem.findComponentByType(Editor$1), defaultComponent = dxfSystem.findComponentByType(Default), whiteModel = dxfSystem.findComponentByType(WhiteModel), toolBarPosition = ref({ left: 10, top: 10 }), images = /* @__PURE__ */ Object.assign({ "./assets/images/connection.svg": __vite_glob_0_0, "./assets/images/deleteSelectLine.svg": __vite_glob_0_1, "./assets/images/deleteSelectWindow.svg": __vite_glob_0_2, "./assets/images/door.svg": __vite_glob_0_3, "./assets/images/intersectionConnection.svg": __vite_glob_0_4, "./assets/images/line.svg": __vite_glob_0_5, "./assets/images/mergeLine.svg": __vite_glob_0_6, "./assets/images/selectAll.svg": __vite_glob_0_7, "./assets/images/selectPoint.svg": __vite_glob_0_8, "./assets/images/verticalCorrection.svg": __vite_glob_0_9, "./assets/images/window.svg": __vite_glob_0_10 }), showShortcutKey = ref(false), selectLineCount = ref(0), hasWindowLine = ref(false), resizeObserver = new ResizeObserver(() => setEditorToolPosition(toolBarPosition.value.left, toolBarPosition.value.top)), shortcutKeys = [
1805
+ const originalLineVisible = ref(true), dxfVisible = ref(true), whiteModelVisible = ref(true), isLook = ref(false), elRef = ref(), toolBarRef = ref(), toolBarExpand = ref(true), currentCommand = ref(""), dxfSystem = toRaw(props.dxfSystem), domEventRegister = dxfSystem.findComponentByType(DomEventRegister), editor = dxfSystem.findComponentByType(Editor$1), defaultComponent = dxfSystem.findComponentByType(Default), whiteModel = dxfSystem.findComponentByType(WhiteModel), toolBarPosition = ref({ left: 10, top: 10 }), images = /* @__PURE__ */ Object.assign({ "./assets/images/door.svg": __vite_glob_0_0, "./assets/images/line.svg": __vite_glob_0_1, "./assets/images/selectPoint.svg": __vite_glob_0_2, "./assets/images/window.svg": __vite_glob_0_3 }), showShortcutKey = ref(false), selectLineCount = ref(0), hasWindowLine = ref(false), resizeObserver = new ResizeObserver(() => setEditorToolPosition(toolBarPosition.value.left, toolBarPosition.value.top)), shortcutKeys = [
2093
1806
  { "name": "开启绘制线段命令", "shortcut": "Ctrl + L" },
2094
1807
  { "name": "开启绘制门线命令", "shortcut": "Ctrl + M" },
2095
1808
  { "name": "开启绘制窗户线命令", "shortcut": "Ctrl + Q" },
@@ -2141,65 +1854,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2141
1854
  src: images["./assets/images/selectPoint.svg"].default,
2142
1855
  shortcut: "Ctrl + P"
2143
1856
  }
2144
- ], otherCommandList = [
2145
- {
2146
- command: MergeLine.commandName,
2147
- name: "合并",
2148
- src: images["./assets/images/mergeLine.svg"].default,
2149
- show: computed(() => selectLineCount.value === 2),
2150
- shortcut: "Ctrl + G"
2151
- },
2152
- {
2153
- command: ConnectionLine.commandName,
2154
- name: "两点连接",
2155
- show: computed(() => selectLineCount.value === 2),
2156
- src: images["./assets/images/connection.svg"].default,
2157
- shortcut: "Shift + L"
2158
- },
2159
- {
2160
- command: IntersectionConnectionLine.commandName,
2161
- name: "延长线交点连接",
2162
- show: computed(() => selectLineCount.value === 2),
2163
- src: images["./assets/images/intersectionConnection.svg"].default,
2164
- shortcut: "Ctrl + Shift + L"
2165
- },
2166
- {
2167
- command: VerticalCorrection.commandName,
2168
- name: "线段垂直纠正",
2169
- show: computed(() => selectLineCount.value === 1),
2170
- src: images["./assets/images/verticalCorrection.svg"].default,
2171
- shortcut: "Ctrl + C"
2172
- },
2173
- {
2174
- command: SelectAll.commandName,
2175
- name: "全选",
2176
- show: computed(() => selectLineCount.value !== editor.renderManager.lines.length),
2177
- src: images["./assets/images/selectAll.svg"].default,
2178
- shortcut: "Ctrl + A"
2179
- },
2180
- {
2181
- command: DeleteSelectWindow.commandName,
2182
- name: "清除窗户",
2183
- show: computed(() => hasWindowLine.value),
2184
- src: images["./assets/images/deleteSelectWindow.svg"].default,
2185
- shortcut: "Q + Delete"
2186
- },
2187
- {
2188
- command: DeleteSelectLine.commandName,
2189
- name: "删除",
2190
- show: computed(() => selectLineCount.value > 0),
2191
- src: images["./assets/images/deleteSelectLine.svg"].default,
2192
- shortcut: "Delete"
2193
- }
2194
1857
  ];
2195
1858
  watch(toolBarPosition, () => localStorage.setItem("editorToolPosition", JSON.stringify(toolBarPosition.value)));
2196
1859
  watch(showShortcutKey, () => localStorage.setItem("showShortcutKey", showShortcutKey.value + ""));
2197
- watch(toolBarExpand, () => {
2198
- localStorage.setItem("toolBarExpand", toolBarExpand.value + "");
2199
- if (toolBarExpand.value) {
2200
- nextTick(() => setEditorToolPosition(toolBarPosition.value.left, toolBarPosition.value.top));
2201
- }
2202
- });
1860
+ watch(toolBarExpand, () => localStorage.setItem("toolBarExpand", toolBarExpand.value + ""));
2203
1861
  watch(originalLineVisible, () => dxfSystem.Variable.set("originalLineVisible", originalLineVisible.value));
2204
1862
  watch(dxfVisible, () => dxfSystem.Variable.set("dxfVisible", dxfVisible.value));
2205
1863
  watch(whiteModelVisible, () => dxfSystem.Variable.set("whiteModelVisible", whiteModelVisible.value));
@@ -2227,7 +1885,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2227
1885
  } else {
2228
1886
  nextTick(() => resizeObserver.observe(elRef.value));
2229
1887
  }
2230
- }, 100);
1888
+ }, 20);
2231
1889
  defaultComponent.addEventListener("selectLineChange", () => {
2232
1890
  selectLineCount.value = defaultComponent.selectLines.length;
2233
1891
  hasWindowLine.value = defaultComponent.selectLines.some((l) => l.userData.isWindow);
@@ -2242,13 +1900,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2242
1900
  return openBlock(), createElementBlock("div", {
2243
1901
  ref_key: "elRef",
2244
1902
  ref: elRef,
2245
- class: "editorTool pointer-events-none overflow-hidden absolute left-0 top-0 w-full h-full z-[20] flex flex-row justify-between p-[5px] box-border select-none pointer-events-[all]"
1903
+ class: "editorTool pointer-events-none overflow-hidden absolute left-0 top-0 w-full h-full z-[10000] flex flex-row justify-between p-[5px] box-border select-none pointer-events-[all]"
2246
1904
  }, [
2247
1905
  createVNode(Transition, null, {
2248
1906
  default: withCtx(() => [
2249
1907
  showShortcutKey.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
2250
1908
  (openBlock(), createElementBlock(Fragment, null, renderList(shortcutKeys, (item) => {
2251
- return createElementVNode("div", {
1909
+ return createElementVNode("p", {
2252
1910
  class: "p-[4px_0px] flex justify-between text-right border-b-1 border-b-[rgba(255,255,255,0.1)] last-of-type:border-b-0",
2253
1911
  key: item.name
2254
1912
  }, [
@@ -2264,14 +1922,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2264
1922
  ref_key: "toolBarRef",
2265
1923
  ref: toolBarRef,
2266
1924
  style: normalizeStyle({ left: toolBarPosition.value.left + "px", top: toolBarPosition.value.top + "px" }),
2267
- class: normalizeClass(["overflow-hidden pointer-events-auto w-fit max-w-[260px] transition-[border-radius] text-[#333] absolute z-[11] bg-white select-none", { "rounded-[8px] ": toolBarExpand.value }]),
2268
- onMousedown: _cache[8] || (_cache[8] = (e) => e.stopPropagation())
1925
+ class: normalizeClass(["pointer-events-auto max-w-[260px] transition-[border-radius] text-[#333] absolute z-[11] bg-white select-none", { "rounded-[8px] ": toolBarExpand.value }]),
1926
+ onMousedown: _cache[13] || (_cache[13] = (e) => e.stopPropagation())
2269
1927
  }, [
2270
1928
  createElementVNode("div", {
2271
1929
  onMousedown: dragMoveHelper,
2272
- class: normalizeClass([{ "border-b-[#eee] border-b-1": toolBarExpand.value }, "flex flex-row justify-between header text-[14px] font-bold p-[10px 0px]"])
1930
+ class: normalizeClass([{ "border-b-[#eee]": toolBarExpand.value }, "flex flex-row justify-between header text-[14px] font-bold p-[10px 0px] border-b-1"])
2273
1931
  }, [
2274
- _cache[10] || (_cache[10] = createStaticVNode('<div class="flex flex-row" data-v-6aea548c><div class="p-[2px_5px] flex items-center pointer-events-none" data-v-6aea548c><svg fill="#aaa" width="20" height="20" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" data-v-6aea548c><path d="M341.333333 298.666667a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m0 298.666666a85.333333 85.333333 0 1 0 0-170.666666 85.333333 85.333333 0 0 0 0 170.666666z m85.333334 213.333334a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m256-512a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m85.333333 213.333333a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m-85.333333 384a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z" data-v-6aea548c></path></svg></div><h5 class="flex text-nowrap text-[12px] items-center pointer-events-none" data-v-6aea548c>绘制工具</h5></div>', 1)),
1932
+ _cache[15] || (_cache[15] = createStaticVNode('<div class="flex flex-row" data-v-a5aa9d5a><div class="p-[2px_5px] flex items-center pointer-events-none" data-v-a5aa9d5a><svg fill="#aaa" width="20" height="20" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" data-v-a5aa9d5a><path d="M341.333333 298.666667a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m0 298.666666a85.333333 85.333333 0 1 0 0-170.666666 85.333333 85.333333 0 0 0 0 170.666666z m85.333334 213.333334a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m256-512a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m85.333333 213.333333a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m-85.333333 384a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z" data-v-a5aa9d5a></path></svg></div><h5 class="flex text-[12px] items-center pointer-events-none" data-v-a5aa9d5a>绘制工具</h5></div>', 1)),
2275
1933
  createElementVNode("div", {
2276
1934
  onMousedown: _cache[0] || (_cache[0] = (e) => e.stopPropagation()),
2277
1935
  onClick: _cache[1] || (_cache[1] = ($event) => toolBarExpand.value = !toolBarExpand.value),
@@ -2285,7 +1943,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2285
1943
  xmlns: "http://www.w3.org/2000/svg",
2286
1944
  width: "12",
2287
1945
  height: "12"
2288
- }, _cache[9] || (_cache[9] = [
1946
+ }, _cache[14] || (_cache[14] = [
2289
1947
  createElementVNode("path", { d: "M315.050667 938.666667a60.757333 60.757333 0 0 0 41.813333-16.298667L750.933333 551.338667a53.418667 53.418667 0 0 0 0-78.677334L356.864 101.632a61.696 61.696 0 0 0-83.541333 0 53.418667 53.418667 0 0 0-0.256 78.677333L625.408 512 273.066667 843.690667a53.418667 53.418667 0 0 0 0 78.677333 60.757333 60.757333 0 0 0 41.984 16.298667z" }, null, -1)
2290
1948
  ]), 2))
2291
1949
  ], 32)
@@ -2317,7 +1975,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2317
1975
  title: "取消命令(Esc)",
2318
1976
  class: "active:scale-[0.7] transition-all",
2319
1977
  onClick: _cache[2] || (_cache[2] = (e) => (unref(editor).cancelCommand(), e.stopPropagation()))
2320
- }, _cache[11] || (_cache[11] = [
1978
+ }, _cache[16] || (_cache[16] = [
2321
1979
  createElementVNode("svg", {
2322
1980
  fill: "#fff",
2323
1981
  width: "16",
@@ -2355,70 +2013,141 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2355
2013
  type: "success",
2356
2014
  onClick: selectLocalFile
2357
2015
  }, {
2358
- default: withCtx(() => _cache[12] || (_cache[12] = [
2016
+ default: withCtx(() => _cache[17] || (_cache[17] = [
2359
2017
  createTextVNode(" 选择文件 ", -1)
2360
2018
  ])),
2361
2019
  _: 1,
2362
- __: [12]
2020
+ __: [17]
2363
2021
  }),
2364
2022
  createVNode(unref(ElButton), {
2365
2023
  style: { "padding": "5px", "font-size": "10px" },
2366
2024
  size: "small",
2367
2025
  type: "primary",
2368
- onClick: _cache[5] || (_cache[5] = ($event) => console.log(unref(dxfSystem).Dxf.originalData))
2026
+ onClick: _cache[5] || (_cache[5] = ($event) => unref(dxfSystem).Dxf.download("test.dxf"))
2369
2027
  }, {
2370
- default: withCtx(() => _cache[13] || (_cache[13] = [
2371
- createTextVNode(" 打印Json ", -1)
2028
+ default: withCtx(() => _cache[18] || (_cache[18] = [
2029
+ createTextVNode(" 下载 DXF ", -1)
2372
2030
  ])),
2373
2031
  _: 1,
2374
- __: [13]
2032
+ __: [18]
2375
2033
  }),
2376
2034
  createVNode(unref(ElButton), {
2377
2035
  style: { "padding": "5px", "font-size": "10px" },
2378
2036
  size: "small",
2379
2037
  type: "primary",
2380
- onClick: _cache[6] || (_cache[6] = ($event) => unref(dxfSystem).Dxf.download("test.dxf"))
2038
+ onClick: _cache[6] || (_cache[6] = ($event) => unref(whiteModel).downloadGltf("test.glb", true))
2381
2039
  }, {
2382
- default: withCtx(() => _cache[14] || (_cache[14] = [
2383
- createTextVNode(" 下载DXF ", -1)
2040
+ default: withCtx(() => _cache[19] || (_cache[19] = [
2041
+ createTextVNode(" 下载 白膜 ", -1)
2384
2042
  ])),
2385
2043
  _: 1,
2386
- __: [14]
2044
+ __: [19]
2387
2045
  }),
2388
2046
  createVNode(unref(ElButton), {
2389
2047
  style: { "padding": "5px", "font-size": "10px" },
2390
2048
  size: "small",
2391
2049
  type: "primary",
2392
- onClick: _cache[7] || (_cache[7] = ($event) => unref(whiteModel).downloadGltf("test.glb", true))
2050
+ onClick: _cache[7] || (_cache[7] = ($event) => console.log(unref(dxfSystem).Dxf.originalData))
2393
2051
  }, {
2394
- default: withCtx(() => _cache[15] || (_cache[15] = [
2395
- createTextVNode(" 下载白膜 ", -1)
2052
+ default: withCtx(() => _cache[20] || (_cache[20] = [
2053
+ createTextVNode(" 打印Json ", -1)
2396
2054
  ])),
2397
2055
  _: 1,
2398
- __: [15]
2056
+ __: [20]
2399
2057
  })
2400
2058
  ])) : createCommentVNode("", true),
2401
2059
  createVNode(Transition, null, {
2402
2060
  default: withCtx(() => [
2403
2061
  createElementVNode("div", _hoisted_13, [
2404
- createVNode(TransitionGroup, null, {
2405
- default: withCtx(() => [
2406
- (openBlock(), createElementBlock(Fragment, null, renderList(otherCommandList, (item) => {
2407
- return createElementVNode("div", {
2408
- onClick: ($event) => item.show.value && unref(editor).commandManager.start(item.command, [...unref(defaultComponent).selectLines]),
2409
- title: `${item.name}(${item.shortcut})`,
2410
- class: normalizeClass(["relative overflow-hidden active:scale-[0.8] border-1 border-[#ccc] rounded-[2px] p-[2px] transition-all cursor-pointer", { "opacity-30 bg-[#ccc] !cursor-no-drop active:!scale-[1]": !item.show.value }]),
2411
- key: item.command
2412
- }, [
2413
- createElementVNode("img", {
2414
- class: "size-[14px]",
2415
- src: item.src
2416
- }, null, 8, _hoisted_15)
2417
- ], 10, _hoisted_14);
2418
- }), 64))
2419
- ]),
2420
- _: 1
2421
- })
2062
+ selectLineCount.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2063
+ selectLineCount.value == 2 ? (openBlock(), createElementBlock("div", {
2064
+ key: 0,
2065
+ onClick: _cache[8] || (_cache[8] = ($event) => unref(defaultComponent).mergeLine()),
2066
+ title: "合并(Ctrl + G)",
2067
+ class: "active:scale-[0.8] transition-all cursor-pointer"
2068
+ }, _cache[21] || (_cache[21] = [
2069
+ createElementVNode("svg", {
2070
+ viewBox: "0 0 1024 1024",
2071
+ version: "1.1",
2072
+ xmlns: "http://www.w3.org/2000/svg",
2073
+ fill: "#555",
2074
+ width: "16",
2075
+ height: "16"
2076
+ }, [
2077
+ createElementVNode("path", { d: "M114.176 46.528h618.496c37.312 0.064 67.584 30.336 67.648 67.648v618.56c0 37.248-30.336 67.584-67.648 67.584H114.176A67.776 67.776 0 0 1 46.528 732.8V114.176c0-37.312 30.336-67.648 67.648-67.648z m2.176 686.208l616.32-2.24-2.176-616.32-614.144 2.176v616.32zM907.648 291.2l2.176 616.32H291.264a34.88 34.88 0 1 0 0 69.888h618.56c37.312 0 67.648-30.336 67.648-67.648V291.264a34.88 34.88 0 1 0-69.824 0z" })
2078
+ ], -1)
2079
+ ]))) : createCommentVNode("", true),
2080
+ selectLineCount.value == 2 ? (openBlock(), createElementBlock("div", {
2081
+ key: 1,
2082
+ onClick: _cache[9] || (_cache[9] = ($event) => unref(defaultComponent).connection()),
2083
+ title: "两点连接(Shift + L)",
2084
+ class: "active:scale-[0.8] transition-all cursor-pointer"
2085
+ }, _cache[22] || (_cache[22] = [
2086
+ createElementVNode("svg", {
2087
+ viewBox: "0 0 1024 1024",
2088
+ version: "1.1",
2089
+ xmlns: "http://www.w3.org/2000/svg",
2090
+ fill: "#555",
2091
+ width: "16",
2092
+ height: "16"
2093
+ }, [
2094
+ createElementVNode("path", { d: "M639.999191 893.597594c-0.999994-54.699654-36.39977-101.099361-85.39946-118.399252-6.39996-2.199986-10.599933-8.299948-10.599933-14.999905V263.801573c0-6.699958 4.199973-12.799919 10.599933-14.999905 49.09969-17.299891 84.399467-63.599598 85.39946-118.399252C641.299183 59.902862 583.399549 0.503237 512.899994 0.00324 441.800444-0.496757 384.000809 57.00288 384.000809 128.002431c0 55.699648 35.599775 103.099349 85.299461 120.699238 6.39996 2.299985 10.699932 8.299948 10.699932 15.099904v496.396864c0 6.799957-4.299973 12.799919-10.699932 15.099904-49.699686 17.599889-85.299461 64.999589-85.299461 120.699238 0 70.999551 57.799635 128.499188 128.899185 127.999191 70.499555-0.499997 128.399189-59.899622 127.099197-130.399176zM448.000404 128.002431c0-35.299777 28.699819-63.999596 63.999596-63.999595s63.999596 28.699819 63.999596 63.999595-28.699819 63.999596-63.999596 63.999596-63.999596-28.699819-63.999596-63.999596z m0 767.995148c0-35.299777 28.699819-63.999596 63.999596-63.999596s63.999596 28.699819 63.999596 63.999596-28.699819 63.999596-63.999596 63.999595-63.999596-28.699819-63.999596-63.999595z" })
2095
+ ], -1)
2096
+ ]))) : createCommentVNode("", true),
2097
+ selectLineCount.value == 2 ? (openBlock(), createElementBlock("div", {
2098
+ key: 2,
2099
+ onClick: _cache[10] || (_cache[10] = ($event) => unref(defaultComponent).intersectionConnection()),
2100
+ title: "延长线交点连接(Ctrl + Shift + L)",
2101
+ class: "active:scale-[0.8] transition-all cursor-pointer"
2102
+ }, _cache[23] || (_cache[23] = [
2103
+ createElementVNode("svg", {
2104
+ viewBox: "0 0 1024 1024",
2105
+ version: "1.1",
2106
+ xmlns: "http://www.w3.org/2000/svg",
2107
+ fill: "#555",
2108
+ width: "16",
2109
+ height: "16"
2110
+ }, [
2111
+ createElementVNode("path", { d: "M491.80027198 557.44938977c-10.0998647-15.14979706-20.19972802-25.24966037-35.34952507-35.34952507-15.14979706-10.0998647-30.29959271-15.14979706-50.49932211-15.14979704-55.54925309 0-100.99864286 45.44938977-100.99864287 100.99864285 0 15.14979706 5.04993234 35.34952507 15.14979568 50.49932212 10.0998647 15.14979706 20.19972802 30.29959271 35.34952506 35.34952508 15.14979706 10.0998647 35.34952507 15.14979706 50.49932213 15.14979567 55.54925309 0 100.99864286-45.44938977 100.99864286-100.99864287 0-15.14979706-5.04993234-35.34952507-15.14979568-50.49932074z m-85.84884718 100.99864286h-15.14979706c-20.19972802-5.04993234-30.29959271-20.19972802-35.34952507-35.34952507V612.99864286c0-30.29959271 25.24966037-50.49932212 50.49932213-50.49932074h10.09986469c15.14979706 5.04993234 30.29959271 15.14979706 35.34952507 35.34952507v15.14979567c5.04993234 25.24966037-20.19972802 45.44938977-45.44938976 45.44938977z" }),
2112
+ createElementVNode("path", { d: "M390.80162774 658.44803263l-40.39945604 40.39945743-227.24694747 222.19701373-35.34952506-35.34952508 227.24694745-227.24694608 40.39945605-40.39945743c5.04993234 20.19972802 20.19972802 35.34952507 35.34952507 40.39945743zM648.34816793 405.9514248l-40.39945742 40.3994574-116.14843853 116.14843992-40.39945742 35.34952507c-5.04993234-20.19972802-20.19972802-30.29959271-35.34952507-35.34952507l40.39945742-40.39945742 116.14843853-111.09850756 35.34952507-35.34952507c10.0998647 15.14979706 20.19972802 25.24966037 40.39945742 30.29959273zM926.09443614 133.25508894L749.34681078 310.00271428l-40.3994574 40.39945742c-5.04993234-20.19972802-15.14979706-35.34952507-30.29959272-40.39945742l35.34952506-40.39945742 176.74762534-176.74762535 35.34952508 40.39945743z" }),
2113
+ createElementVNode("path", { d: "M749.34681078 310.00271428c-10.0998647-15.14979706-20.19972802-30.29959271-35.34952506-35.34952506-15.14979706-10.0998647-35.34952507-15.14979706-55.54925309-15.14979706-55.54925309 0-100.99864286 45.44938977-100.99864286 100.99864286 0 20.19972802 5.04993234 40.39945743 15.14979567 55.54925447 10.0998647 15.14979706 20.19972802 25.24966037 35.34952507 35.34952507 15.14979706 10.0998647 30.29959271 15.14979706 50.49932212 15.14979567 55.54925309 0 100.99864286-45.44938977 100.99864286-100.99864286 0-25.24966037-5.04993234-40.39945743-10.09986471-55.54925309z m-90.89877815 95.94871052h-10.0998647c-20.19972802-5.04993234-35.34952507-15.14979706-40.39945742-35.34952509 0-5.04993234-5.04993234-10.0998647-5.04993234-15.14979704 0-30.29959271 25.24966037-50.49932212 50.49932212-50.49932074 5.04993234 0 10.0998647 0 15.14979704 5.04993235 15.14979706 5.04993234 30.29959271 20.19972802 30.29959273 40.39945742v10.09986332c10.0998647 25.24966037-15.14979706 45.44938977-40.39945743 45.44938978z" })
2114
+ ], -1)
2115
+ ]))) : createCommentVNode("", true),
2116
+ hasWindowLine.value ? (openBlock(), createElementBlock("div", {
2117
+ key: 3,
2118
+ onClick: _cache[11] || (_cache[11] = ($event) => unref(defaultComponent).deleteSelectWindow()),
2119
+ title: "清除窗户(Q + Delete)",
2120
+ class: "active:scale-[0.8] transition-all cursor-pointer"
2121
+ }, _cache[24] || (_cache[24] = [
2122
+ createElementVNode("svg", {
2123
+ viewBox: "0 0 1024 1024",
2124
+ version: "1.1",
2125
+ xmlns: "http://www.w3.org/2000/svg",
2126
+ fill: "#555",
2127
+ width: "16",
2128
+ height: "16"
2129
+ }, [
2130
+ createElementVNode("path", { d: "M220.451548 913.518482V318.145854c0-27.62038 22.505495-50.125874 50.125875-50.125874H865.95005c27.62038 0 50.125874 22.505495 50.125874 50.125874v218.917083h59.332667V318.145854c0-60.355644-49.102897-109.458541-109.458541-109.458541h-39.896104v-99.228772C826.053946 49.102897 776.951049 0 716.595405 0H121.222777C60.867133 0 11.764236 49.102897 11.764236 109.458541V705.854146c0 60.355644 49.102897 109.458541 109.458541 109.458541h39.896104v99.228772c0 60.355644 49.102897 109.458541 109.458542 109.458541h257.790209v-59.332667H269.554446c-26.597403-1.022977-49.102897-23.528472-49.102898-51.148851z m-59.332667-595.372628v436.811189h-39.896104c-27.62038 0-50.125874-22.505495-50.125874-50.125874V109.458541c0-27.62038 22.505495-50.125874 50.125874-50.125874H716.595405c27.62038 0 50.125874 22.505495 50.125874 50.125874v99.228772H269.554446c-59.332667 0-108.435564 49.102897-108.435565 109.458541z" }),
2131
+ createElementVNode("path", { d: "M902.777223 854.185814l98.205794-98.205794c15.344655-15.344655 15.344655-40.919081 0-56.263736s-40.919081-15.344655-56.263736 0L846.513487 797.922078 747.284715 699.716284c-15.344655-15.344655-40.919081-15.344655-56.263736 0s-15.344655 40.919081 0 56.263736l98.205794 98.205794-98.205794 98.205794c-15.344655 15.344655-15.344655 40.919081 0 56.263737s40.919081 15.344655 56.263736 0l98.205794-98.205795 98.205795 98.205795c15.344655 15.344655 40.919081 15.344655 56.263736 0s15.344655-40.919081 0-56.263737l-97.182817-98.205794z" })
2132
+ ], -1)
2133
+ ]))) : createCommentVNode("", true),
2134
+ createElementVNode("div", {
2135
+ onClick: _cache[12] || (_cache[12] = ($event) => unref(defaultComponent).deleteSelectLine()),
2136
+ title: "删除(Delete)",
2137
+ class: "active:scale-[0.8] transition-all cursor-pointer"
2138
+ }, _cache[25] || (_cache[25] = [
2139
+ createElementVNode("svg", {
2140
+ viewBox: "0 0 1024 1024",
2141
+ version: "1.1",
2142
+ xmlns: "http://www.w3.org/2000/svg",
2143
+ fill: "#555",
2144
+ width: "16",
2145
+ height: "16"
2146
+ }, [
2147
+ createElementVNode("path", { d: "M909.050991 169.476903l-217.554898 0 0-31.346939c0-39.5866-32.205493-71.792093-71.793116-71.792093L408.15591 66.337871c-39.5866 0-71.792093 32.205493-71.792093 71.792093l0 31.346939L113.349581 169.476903c-11.013845 0-19.942191 8.940626-19.942191 19.954471s8.928347 19.954471 19.942191 19.954471l84.264149 0 0 640.687918c0 60.479443 49.203632 109.683075 109.683075 109.683075l416.474366 0c60.479443 0 109.683075-49.203632 109.683075-109.683075L833.454246 209.385844l75.595722 0c11.012821 0 19.942191-8.940626 19.942191-19.954471S920.063813 169.476903 909.050991 169.476903zM376.2482 138.130987c0-17.593703 14.314007-31.907711 31.907711-31.907711l211.547067 0c17.593703 0 31.907711 14.314007 31.907711 31.907711l0 31.346939L376.2482 169.477926 376.2482 138.130987zM793.569864 850.074785c0 38.486546-31.312146 69.798692-69.798692 69.798692L307.297828 919.873478c-38.486546 0-69.798692-31.312146-69.798692-69.798692L237.499136 211.042577l556.070728 0L793.569864 850.074785zM510.662539 861.276918c11.012821 0 19.954471-8.92937 19.954471-19.942191L530.61701 294.912753c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471 8.928347-19.954471 19.942191L490.708068 841.334727C490.708068 852.347548 499.649717 861.276918 510.662539 861.276918zM374.562814 801.449321c11.012821 0 19.954471-8.92937 19.954471-19.942191L394.517285 354.74035c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471 8.928347-19.954471 19.942191l0 426.76678C354.608344 792.519951 363.549993 801.449321 374.562814 801.449321zM649.832182 801.449321c11.012821 0 19.954471-8.92937 19.954471-19.942191L669.786653 354.74035c0-11.013845-8.94165-19.942191-19.954471-19.942191s-19.954471 8.928347-19.954471 19.942191l0 426.76678C629.877711 792.519951 638.81936 801.449321 649.832182 801.449321z" })
2148
+ ], -1)
2149
+ ]))
2150
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_14, " 无可用操作 "))
2422
2151
  ])
2423
2152
  ]),
2424
2153
  _: 1
@@ -2436,7 +2165,7 @@ const _export_sfc = (sfc, props) => {
2436
2165
  }
2437
2166
  return target;
2438
2167
  };
2439
- const EditorTool = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6aea548c"]]);
2168
+ const EditorTool = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a5aa9d5a"]]);
2440
2169
  let Editor$1 = class Editor extends Component {
2441
2170
  static name = "Editor";
2442
2171
  container = new THREE.Group();
@@ -2507,8 +2236,8 @@ let Editor$1 = class Editor extends Component {
2507
2236
  const renderer = this.renderer, domEventRegister = this.domEventRegister, dxf = this.dxf, orbitControls = renderer.orbitControls, camera = renderer.camera, center = dxf.box.center, cameraPosition = renderer.camera.position.clone(), target = orbitControls?.target?.clone(), size = new THREE.Vector2(), raycaster = new THREE.Raycaster(), coords = this.coords, pointerPosition = this.pointerPosition;
2508
2237
  this.container.position.z = dxf.originalZAverage;
2509
2238
  renderer.scene.add(this.container);
2239
+ camera.position.set(center.x, center.y, 5);
2510
2240
  if (orbitControls) {
2511
- camera.position.set(center.x, center.y, 5);
2512
2241
  orbitControls.target.set(center.x, center.y, 0);
2513
2242
  orbitControls.enableRotate = false;
2514
2243
  }
@@ -2532,11 +2261,9 @@ let Editor$1 = class Editor extends Component {
2532
2261
  this.commandManager.start("default");
2533
2262
  this._exitEditCallBack = () => {
2534
2263
  domEventRegister.removeEventListener("mousemove", mousemoveFun);
2535
- if (orbitControls) {
2536
- camera.position.copy(cameraPosition);
2537
- orbitControls.enableRotate = true;
2538
- orbitControls.target.copy(target);
2539
- }
2264
+ camera.position.copy(cameraPosition);
2265
+ orbitControls.enableRotate = true;
2266
+ orbitControls.target.copy(target);
2540
2267
  };
2541
2268
  }
2542
2269
  /**
@@ -2656,13 +2383,6 @@ function Editor_(dxfSystem, option = {}) {
2656
2383
  dxfSystem.addComponent(new DrawDoorLine());
2657
2384
  dxfSystem.addComponent(new DrawWindow());
2658
2385
  dxfSystem.addComponent(new PointDrag());
2659
- dxfSystem.addComponent(new DeleteSelectLine());
2660
- dxfSystem.addComponent(new MergeLine());
2661
- dxfSystem.addComponent(new VerticalCorrection());
2662
- dxfSystem.addComponent(new ConnectionLine());
2663
- dxfSystem.addComponent(new IntersectionConnectionLine());
2664
- dxfSystem.addComponent(new DeleteSelectWindow());
2665
- dxfSystem.addComponent(new SelectAll());
2666
2386
  }
2667
2387
  const Editor2 = Object.assign(Editor_, {
2668
2388
  create(option = {}) {