build-dxf 0.1.25 → 0.1.26
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 +1 -1
- package/src/build.js +4 -4
- package/src/index.css +3 -3
- package/src/index3.js +478 -53
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/CommandFlowComponent.d.ts +40 -2
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/ManualDistance.d.ts +23 -0
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/PointDrag.d.ts +4 -8
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/RayDistance.d.ts +23 -0
- package/src/utils/LineSegment.d.ts +1 -1
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -46,7 +46,7 @@ class EventDispatcher extends EventDispatcher$1 {
|
|
|
46
46
|
canceEventRecord(name) {
|
|
47
47
|
const list = this.eventRecordStack.get(name);
|
|
48
48
|
if (list) {
|
|
49
|
-
list.forEach((cancel) => cancel());
|
|
49
|
+
list.reverse().forEach((cancel) => cancel());
|
|
50
50
|
this.eventRecordStack.delete(name);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -1652,11 +1652,12 @@ class LineSegment {
|
|
|
1652
1652
|
/** 克隆
|
|
1653
1653
|
* @returns
|
|
1654
1654
|
*/
|
|
1655
|
-
clone(userData = true) {
|
|
1655
|
+
clone(userData = true, cloneUUid = false) {
|
|
1656
1656
|
const line = new LineSegment(
|
|
1657
1657
|
this.points[0].clone(),
|
|
1658
1658
|
this.points[1].clone()
|
|
1659
1659
|
);
|
|
1660
|
+
if (cloneUUid) line.uuid = this.uuid;
|
|
1660
1661
|
if (userData) line.userData = cloneUserData(this.userData);
|
|
1661
1662
|
return line;
|
|
1662
1663
|
}
|
|
@@ -14616,7 +14617,6 @@ class DoorFind {
|
|
|
14616
14617
|
dock = { dockLine: endList[0].userData, dockPoint: endList[0].point, point: line.end, pointType: "end" };
|
|
14617
14618
|
}
|
|
14618
14619
|
const point2 = this.adsorpt(dock, line);
|
|
14619
|
-
console.log(111);
|
|
14620
14620
|
line.userData.doorDirectConnection = true;
|
|
14621
14621
|
if (point2) {
|
|
14622
14622
|
line.userData.doorAutomaticFind = true;
|
|
@@ -14992,7 +14992,7 @@ class Dxf extends Component {
|
|
|
14992
14992
|
let lines = this.lineSegments.filter((line) => !line.userData.isDoor);
|
|
14993
14993
|
let doorLineList = [...this.doorLineSegment];
|
|
14994
14994
|
if (clone2) {
|
|
14995
|
-
lines = lines.map((line) => line.clone());
|
|
14995
|
+
lines = lines.map((line) => line.clone(true, true));
|
|
14996
14996
|
doorLineList = doorLineList.map((line) => line.clone());
|
|
14997
14997
|
}
|
|
14998
14998
|
doorLineList.forEach((line) => Object.assign(line.userData, {
|
package/src/index.css
CHANGED
|
@@ -284,8 +284,8 @@
|
|
|
284
284
|
width: 100%;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
.max-w-\[
|
|
288
|
-
max-width:
|
|
287
|
+
.max-w-\[150px\] {
|
|
288
|
+
max-width: 150px;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
.min-w-\[150px\] {
|
|
@@ -747,7 +747,7 @@
|
|
|
747
747
|
/* font-weight: 600; */
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
-
[data-v-
|
|
750
|
+
[data-v-a41b5baa] {
|
|
751
751
|
font-family: 宋体;
|
|
752
752
|
}
|
|
753
753
|
|
package/src/index3.js
CHANGED
|
@@ -100,8 +100,13 @@ const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
100
100
|
__proto__: null,
|
|
101
101
|
default: window$1
|
|
102
102
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
103
|
-
const ____ = "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='1769079533165'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='4803'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M352%20128a134.4%20134.4%200%200%201%20128.832%2096H921.6a38.4%2038.4%200%200%201%200%2076.8H480.832a134.4%20134.4%200%200%201-257.664%200H102.4a38.4%2038.4%200%201%201%200-76.8h120.768A134.4%20134.4%200%200%201%20352%20128z%20m0%2076.8a57.6%2057.6%200%201%200%200%20115.2%2057.6%2057.6%200%200%200%200-115.2z'%20fill='%23666666'%20p-id='4804'%3e%3c/path%3e%3cpath%20d='M64%20467.2m38.4%200l819.2%200q38.4%200%2038.4%2038.4l0%200q0%2038.4-38.4%2038.4l-819.2%200q-38.4%200-38.4-38.4l0%200q0-38.4%2038.4-38.4Z'%20fill='%23666666'%20p-id='4805'%3e%3c/path%3e%3cpath%20d='M672%20614.4a134.4%20134.4%200%200%201%20128.832%2096H921.6a38.4%2038.4%200%200%201%200%2076.8h-120.768a134.4%20134.4%200%200%201-257.664%200H102.4a38.4%2038.4%200%200%201%200-76.8h440.768A134.4%20134.4%200%200%201%20672%20614.4z%20m0%2076.8a57.6%2057.6%200%201%200%200%20115.2%2057.6%2057.6%200%200%200%200-115.2z'%20fill='%23666666'%20p-id='4806'%3e%3c/path%3e%3c/svg%3e";
|
|
103
|
+
const ____$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='1769079533165'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='4803'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M352%20128a134.4%20134.4%200%200%201%20128.832%2096H921.6a38.4%2038.4%200%200%201%200%2076.8H480.832a134.4%20134.4%200%200%201-257.664%200H102.4a38.4%2038.4%200%201%201%200-76.8h120.768A134.4%20134.4%200%200%201%20352%20128z%20m0%2076.8a57.6%2057.6%200%201%200%200%20115.2%2057.6%2057.6%200%200%200%200-115.2z'%20fill='%23666666'%20p-id='4804'%3e%3c/path%3e%3cpath%20d='M64%20467.2m38.4%200l819.2%200q38.4%200%2038.4%2038.4l0%200q0%2038.4-38.4%2038.4l-819.2%200q-38.4%200-38.4-38.4l0%200q0-38.4%2038.4-38.4Z'%20fill='%23666666'%20p-id='4805'%3e%3c/path%3e%3cpath%20d='M672%20614.4a134.4%20134.4%200%200%201%20128.832%2096H921.6a38.4%2038.4%200%200%201%200%2076.8h-120.768a134.4%20134.4%200%200%201-257.664%200H102.4a38.4%2038.4%200%200%201%200-76.8h440.768A134.4%20134.4%200%200%201%20672%20614.4z%20m0%2076.8a57.6%2057.6%200%201%200%200%20115.2%2057.6%2057.6%200%200%200%200-115.2z'%20fill='%23666666'%20p-id='4806'%3e%3c/path%3e%3c/svg%3e";
|
|
104
104
|
const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
105
|
+
__proto__: null,
|
|
106
|
+
default: ____$1
|
|
107
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
108
|
+
const ____ = "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='1769568667919'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='11114'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M512%20617.386667c17.749333%200%2032.213333%2014.250667%2032.213333%2031.829333v182.954667a32%2032%200%200%201-32.213333%2031.829333%2032%2032%200%200%201-32.170667-31.829333v-182.954667A32%2032%200%200%201%20512%20617.386667zM96.170667%20297.216c17.749333%200%2032.213333%2014.250667%2032.213333%2031.829333v365.909334a32%2032%200%200%201-32.213333%2031.829333%2032%2032%200%200%201-32.170667-31.829333V329.045333a32%2032%200%200%201%2032.170667-31.829333zM927.829333%20297.216c17.792%200%2032.213333%2014.250667%2032.213334%2031.829333v365.909334a32%2032%200%200%201-32.213334%2031.829333%2032%2032%200%200%201-32.170666-31.829333V329.045333a32%2032%200%200%201%2032.170666-31.829333zM396.8%20580.992a32.426667%2032.426667%200%200%201%2045.525333%200%2031.658667%2031.658667%200%200%201%200%2045.056l-46.208%2045.696a32.426667%2032.426667%200%200%201-45.482666%200%2031.616%2031.616%200%200%201%200-45.056l46.208-45.653333zM581.674667%20580.949333a32.426667%2032.426667%200%200%201%2045.482666%200l46.208%2045.738667a31.658667%2031.658667%200%200%201%200%2045.056%2032.426667%2032.426667%200%200%201-45.482666%200l-46.208-45.738667a31.616%2031.616%200%200%201%200-45.056zM214.485333%20441.6a32.426667%2032.426667%200%200%201%2043.093334%202.133333c9.941333%209.898667%2011.904%2024.576%206.058666%2036.437334h109.781334a32%2032%200%200%201%2032.170666%2031.829333%2032%2032%200%200%201-32.170666%2031.872H263.637333a31.573333%2031.573333%200%200%201-6.101333%2036.437333%2032.426667%2032.426667%200%200%201-43.050667%202.133334l-2.432-2.133334-46.208-45.781333a31.616%2031.616%200%200%201%200-45.013333L212.053333%20443.733333l2.432-2.133333zM766.464%20443.733333a32.426667%2032.426667%200%200%201%2045.482667%200l46.208%2045.781334%202.218666%202.389333a31.616%2031.616%200%200%201-2.218666%2042.666667L811.946667%20580.266667l-2.432%202.133333a32.426667%2032.426667%200%200%201-43.093334-2.133333%2031.573333%2031.573333%200%200%201-6.101333-36.437334H650.666667a32%2032%200%200%201-32.170667-31.872%2032%2032%200%200%201%2032.170667-31.829333h109.781333a31.488%2031.488%200%200%201%206.058667-36.437333zM512%20466.304c25.514667%200%2046.208%2020.48%2046.208%2045.738667%200%2025.258667-20.693333%2045.696-46.208%2045.696s-46.208-20.48-46.208-45.696c0-25.258667%2020.693333-45.738667%2046.208-45.738667zM350.848%20352.256a32.426667%2032.426667%200%200%201%2045.482667%200.085333l46.08%2045.696a31.658667%2031.658667%200%200%201-0.128%2045.098667%2032.426667%2032.426667%200%200%201-45.482667-0.085333L350.72%20397.312a31.616%2031.616%200%200%201%200.128-45.056zM627.882667%20352.298667a32.426667%2032.426667%200%200%201%2045.482666%200%2031.616%2031.616%200%200%201%200%2045.056l-46.208%2045.653333a32.426667%2032.426667%200%200%201-45.482666%200%2031.616%2031.616%200%200%201%200-45.013333l46.208-45.696zM512%20160c17.749333%200%2032.213333%2014.250667%2032.213333%2031.829333v182.954667A32%2032%200%200%201%20512%20406.613333a32%2032%200%200%201-32.170667-31.829333V191.829333A32%2032%200%200%201%20512%20160z'%20p-id='11115'%3e%3c/path%3e%3c/svg%3e";
|
|
109
|
+
const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
105
110
|
__proto__: null,
|
|
106
111
|
default: ____
|
|
107
112
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -10647,12 +10652,14 @@ class CommandFlowComponent extends Component {
|
|
|
10647
10652
|
get confirmKeys() {
|
|
10648
10653
|
return this.constructor.confirmKeys;
|
|
10649
10654
|
}
|
|
10655
|
+
container = new THREE.Group();
|
|
10650
10656
|
constructor() {
|
|
10651
10657
|
super();
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10658
|
+
this.addEventListener("addFromParent", () => {
|
|
10659
|
+
this.editor.container.add(this.container);
|
|
10660
|
+
this.editor.addEventListener("cancelCommand", () => {
|
|
10661
|
+
this.cancel();
|
|
10662
|
+
});
|
|
10656
10663
|
});
|
|
10657
10664
|
}
|
|
10658
10665
|
/**
|
|
@@ -10755,6 +10762,274 @@ class CommandFlowComponent extends Component {
|
|
|
10755
10762
|
formatText(text, color = "var(--primary-color)", style = "") {
|
|
10756
10763
|
return `<span style="color: ${color};${style}">${text}</span>`;
|
|
10757
10764
|
}
|
|
10765
|
+
/** 创建追随提示消息
|
|
10766
|
+
* @param text
|
|
10767
|
+
* @param clearNames
|
|
10768
|
+
* @param style
|
|
10769
|
+
* @returns
|
|
10770
|
+
*/
|
|
10771
|
+
createFollowPrompts(text, clearNames, style = {}) {
|
|
10772
|
+
const pointer = this.editor.domEventRegister.pointer;
|
|
10773
|
+
const textObj = document.createElement("div");
|
|
10774
|
+
textObj.innerText = text;
|
|
10775
|
+
textObj.style.position = "absolute";
|
|
10776
|
+
textObj.style.color = "#fff";
|
|
10777
|
+
textObj.style.fontSize = "10px";
|
|
10778
|
+
textObj.style.padding = "4px 6px";
|
|
10779
|
+
textObj.style.background = "rgba(0,0,0,0.3)";
|
|
10780
|
+
textObj.style.whiteSpace = "nowrap";
|
|
10781
|
+
textObj.style.borderRadius = "6px";
|
|
10782
|
+
textObj.style.pointerEvents = "none";
|
|
10783
|
+
Object.assign(textObj.style, style);
|
|
10784
|
+
this.domElement.appendChild(textObj);
|
|
10785
|
+
let height = 0;
|
|
10786
|
+
const { destroy } = this.createPointerMove(() => {
|
|
10787
|
+
textObj.style.left = pointer.x + "px";
|
|
10788
|
+
textObj.style.top = pointer.y - height + "px";
|
|
10789
|
+
}), resizeObserver = new ResizeObserver(() => {
|
|
10790
|
+
const rect = textObj.getBoundingClientRect();
|
|
10791
|
+
height = rect.height;
|
|
10792
|
+
}), cancel = () => {
|
|
10793
|
+
destroy();
|
|
10794
|
+
resizeObserver.disconnect();
|
|
10795
|
+
textObj.remove();
|
|
10796
|
+
};
|
|
10797
|
+
resizeObserver.observe(textObj);
|
|
10798
|
+
clearNames.forEach((name) => this.addEventRecord(name, cancel));
|
|
10799
|
+
return textObj;
|
|
10800
|
+
}
|
|
10801
|
+
/** 创建线段选择器
|
|
10802
|
+
* @returns
|
|
10803
|
+
*/
|
|
10804
|
+
createLineSelector() {
|
|
10805
|
+
const editor = this.editor, eventInput = editor.eventInput, object3D = new THREE.Mesh(), wiLine = new LineSegment();
|
|
10806
|
+
let currentSelectLine = null;
|
|
10807
|
+
let cursor = this.domElement.style.cursor;
|
|
10808
|
+
wiLine.userData.isWinLine = true;
|
|
10809
|
+
object3D.position.z = 2e-3;
|
|
10810
|
+
object3D.material = new THREE.MeshBasicMaterial({ color: 55561 });
|
|
10811
|
+
let mode = "none";
|
|
10812
|
+
const update = (line2) => {
|
|
10813
|
+
const rectangle = line2.expandToRectangle(0.025, "bothSides");
|
|
10814
|
+
object3D.geometry = editor.renderManager.createGeometry({ position: rectangle.createGeometry() }, 6);
|
|
10815
|
+
this.container.add(object3D);
|
|
10816
|
+
};
|
|
10817
|
+
function getWindow(line2, point) {
|
|
10818
|
+
if (line2.userData.isWindow) {
|
|
10819
|
+
const direction = line2.direction();
|
|
10820
|
+
if (mode === "all" || mode === "window") {
|
|
10821
|
+
const index2 = line2.userData.drawWindow?.findIndex((d) => {
|
|
10822
|
+
Point.from(d.p).expandAsLine(direction, d.width, {}, wiLine).directionMove(direction, -d.width * 0.5);
|
|
10823
|
+
return wiLine.isPointOnSegment(Point.from(point));
|
|
10824
|
+
});
|
|
10825
|
+
if (index2 > -1) {
|
|
10826
|
+
wiLine.currentData.line = line2;
|
|
10827
|
+
wiLine.currentData.index = index2;
|
|
10828
|
+
wiLine.userData.isWinLine = true;
|
|
10829
|
+
return wiLine;
|
|
10830
|
+
}
|
|
10831
|
+
}
|
|
10832
|
+
}
|
|
10833
|
+
return null;
|
|
10834
|
+
}
|
|
10835
|
+
function getDoor(line2) {
|
|
10836
|
+
if (line2.userData.isDoor) return line2;
|
|
10837
|
+
return null;
|
|
10838
|
+
}
|
|
10839
|
+
const ppcEventCancel = editor.addEventListener("pointerPositionChange", () => {
|
|
10840
|
+
const { line: line2, point } = editor.renderManager.adsorption();
|
|
10841
|
+
currentSelectLine = null;
|
|
10842
|
+
if (line2) {
|
|
10843
|
+
this.container.add(object3D);
|
|
10844
|
+
if (mode === "window" || mode === "all") {
|
|
10845
|
+
const winLine = getWindow(line2, point);
|
|
10846
|
+
if (winLine) currentSelectLine = winLine;
|
|
10847
|
+
}
|
|
10848
|
+
if (!currentSelectLine && (mode === "door" || mode === "all")) {
|
|
10849
|
+
const doorLine = getDoor(line2);
|
|
10850
|
+
if (doorLine) currentSelectLine = doorLine;
|
|
10851
|
+
}
|
|
10852
|
+
if (!currentSelectLine && (mode === "wall" || mode === "all")) {
|
|
10853
|
+
if (!line2.userData.isDoor) currentSelectLine = line2;
|
|
10854
|
+
}
|
|
10855
|
+
}
|
|
10856
|
+
if (currentSelectLine) {
|
|
10857
|
+
update(currentSelectLine);
|
|
10858
|
+
this.domElement.style.cursor = "pointer";
|
|
10859
|
+
} else {
|
|
10860
|
+
object3D.removeFromParent();
|
|
10861
|
+
currentSelectLine = null;
|
|
10862
|
+
this.domElement.style.cursor = cursor;
|
|
10863
|
+
}
|
|
10864
|
+
});
|
|
10865
|
+
return {
|
|
10866
|
+
get: async (mode_ = "all") => {
|
|
10867
|
+
mode = mode_;
|
|
10868
|
+
currentSelectLine = null;
|
|
10869
|
+
return new Promise((resolve) => {
|
|
10870
|
+
const eventCancel = eventInput.addEventListener("codeChange", () => {
|
|
10871
|
+
if (eventInput.isKeyDown("mouse_0") && currentSelectLine) {
|
|
10872
|
+
resolve(currentSelectLine);
|
|
10873
|
+
eventCancel();
|
|
10874
|
+
object3D.removeFromParent();
|
|
10875
|
+
this.domElement.style.cursor = cursor;
|
|
10876
|
+
}
|
|
10877
|
+
});
|
|
10878
|
+
});
|
|
10879
|
+
},
|
|
10880
|
+
destroy() {
|
|
10881
|
+
ppcEventCancel();
|
|
10882
|
+
object3D.removeFromParent();
|
|
10883
|
+
}
|
|
10884
|
+
};
|
|
10885
|
+
}
|
|
10886
|
+
/** 创建点选择器
|
|
10887
|
+
* @returns
|
|
10888
|
+
*/
|
|
10889
|
+
createPointSelector() {
|
|
10890
|
+
const editor = this.editor, eventInput = editor.eventInput, pointMesh = this.renderer.createCircle(new Point(0, 0), { size: 12, color: 65280 }, this.container);
|
|
10891
|
+
let cursor = this.domElement.style.cursor;
|
|
10892
|
+
let mode = "null";
|
|
10893
|
+
let point = null;
|
|
10894
|
+
let line2 = void 0;
|
|
10895
|
+
pointMesh.position.z = 5e-3;
|
|
10896
|
+
pointMesh.visible = false;
|
|
10897
|
+
const ppcEventCancel = editor.addEventListener("pointerPositionChange", () => {
|
|
10898
|
+
point = null;
|
|
10899
|
+
if (mode !== "null") {
|
|
10900
|
+
let { point: p, mode: m, line: l } = editor.renderManager.adsorption(0.08);
|
|
10901
|
+
line2 = l;
|
|
10902
|
+
if (!m) m = "empty";
|
|
10903
|
+
if (mode === "all") point = p;
|
|
10904
|
+
if (!point && mode.indexOf(m) > -1) point = p;
|
|
10905
|
+
}
|
|
10906
|
+
if (point) {
|
|
10907
|
+
pointMesh.position.copy(point);
|
|
10908
|
+
if (this.domElement.style.cursor !== "none") cursor = this.domElement.style.cursor;
|
|
10909
|
+
this.domElement.style.cursor = "none";
|
|
10910
|
+
pointMesh.visible = true;
|
|
10911
|
+
} else {
|
|
10912
|
+
this.domElement.style.cursor = cursor;
|
|
10913
|
+
pointMesh.visible = false;
|
|
10914
|
+
}
|
|
10915
|
+
});
|
|
10916
|
+
return {
|
|
10917
|
+
get: async (mode_) => {
|
|
10918
|
+
mode = mode_;
|
|
10919
|
+
return new Promise((resolve) => {
|
|
10920
|
+
const eventCancel = eventInput.addEventListener("codeChange", () => {
|
|
10921
|
+
if (eventInput.isKeyDown("mouse_0") && point) {
|
|
10922
|
+
mode = "null";
|
|
10923
|
+
this.domElement.style.cursor = cursor;
|
|
10924
|
+
resolve({ point: Point.from(point), line: line2 });
|
|
10925
|
+
eventCancel();
|
|
10926
|
+
}
|
|
10927
|
+
});
|
|
10928
|
+
});
|
|
10929
|
+
},
|
|
10930
|
+
destroy() {
|
|
10931
|
+
ppcEventCancel();
|
|
10932
|
+
pointMesh.removeFromParent();
|
|
10933
|
+
}
|
|
10934
|
+
};
|
|
10935
|
+
}
|
|
10936
|
+
/**
|
|
10937
|
+
* 创建拖拽点
|
|
10938
|
+
*/
|
|
10939
|
+
createDragPoint(point, onChange) {
|
|
10940
|
+
point = point.clone();
|
|
10941
|
+
const div = document.createElement("div");
|
|
10942
|
+
const defaultWidth = "10px";
|
|
10943
|
+
const object3D = this.renderer.createText("", point, {
|
|
10944
|
+
position: "absolute",
|
|
10945
|
+
background: "rgb(255,255,255)",
|
|
10946
|
+
borderRadius: "100px",
|
|
10947
|
+
width: defaultWidth,
|
|
10948
|
+
height: defaultWidth,
|
|
10949
|
+
pointerEvents: "all",
|
|
10950
|
+
cursor: "pointer",
|
|
10951
|
+
transition: "0.25s background"
|
|
10952
|
+
}, this.container);
|
|
10953
|
+
const move = () => {
|
|
10954
|
+
const { point: pos, line: line2 } = this.renderManager.adsorption();
|
|
10955
|
+
if (line2) {
|
|
10956
|
+
object3D.element.style.width = defaultWidth;
|
|
10957
|
+
object3D.element.style.height = defaultWidth;
|
|
10958
|
+
} else {
|
|
10959
|
+
object3D.element.style.width = "2px";
|
|
10960
|
+
object3D.element.style.height = "2px";
|
|
10961
|
+
}
|
|
10962
|
+
object3D.position.x = pos.x;
|
|
10963
|
+
object3D.position.y = pos.y;
|
|
10964
|
+
point.copy(pos);
|
|
10965
|
+
onChange(point);
|
|
10966
|
+
};
|
|
10967
|
+
const mouseup = () => {
|
|
10968
|
+
object3D.element.style.pointerEvents = "all";
|
|
10969
|
+
object3D.element.style.background = "#fff";
|
|
10970
|
+
object3D.element.style.width = defaultWidth;
|
|
10971
|
+
object3D.element.style.height = defaultWidth;
|
|
10972
|
+
document.removeEventListener("mousemove", move);
|
|
10973
|
+
document.removeEventListener("mouseup", mouseup);
|
|
10974
|
+
};
|
|
10975
|
+
object3D.element.addEventListener("mousedown", (e) => {
|
|
10976
|
+
object3D.element.style.pointerEvents = "none";
|
|
10977
|
+
object3D.element.style.background = "#00ff00";
|
|
10978
|
+
object3D.element.style.width = "2px";
|
|
10979
|
+
object3D.element.style.height = "2px";
|
|
10980
|
+
document.addEventListener("mousemove", move);
|
|
10981
|
+
document.addEventListener("mouseup", mouseup);
|
|
10982
|
+
e.stopPropagation();
|
|
10983
|
+
e.preventDefault();
|
|
10984
|
+
});
|
|
10985
|
+
const cancel = () => {
|
|
10986
|
+
div.remove();
|
|
10987
|
+
object3D.removeFromParent();
|
|
10988
|
+
};
|
|
10989
|
+
return cancel;
|
|
10990
|
+
}
|
|
10991
|
+
/**
|
|
10992
|
+
* 创建选择点
|
|
10993
|
+
*/
|
|
10994
|
+
createClickPoint(point, onClick) {
|
|
10995
|
+
const div = document.createElement("div");
|
|
10996
|
+
const defaultWidth = "10px";
|
|
10997
|
+
const object3D = this.renderer.createText("", point, {
|
|
10998
|
+
position: "absolute",
|
|
10999
|
+
background: "rgb(255,255,255)",
|
|
11000
|
+
borderRadius: "100px",
|
|
11001
|
+
width: defaultWidth,
|
|
11002
|
+
height: defaultWidth,
|
|
11003
|
+
pointerEvents: "all",
|
|
11004
|
+
cursor: "pointer",
|
|
11005
|
+
transition: "0.25s background"
|
|
11006
|
+
}, this.container);
|
|
11007
|
+
object3D.element.addEventListener("mousedown", (e) => {
|
|
11008
|
+
onClick();
|
|
11009
|
+
e.stopPropagation();
|
|
11010
|
+
e.preventDefault();
|
|
11011
|
+
});
|
|
11012
|
+
const cancel = () => {
|
|
11013
|
+
div.remove();
|
|
11014
|
+
object3D.removeFromParent();
|
|
11015
|
+
};
|
|
11016
|
+
return cancel;
|
|
11017
|
+
}
|
|
11018
|
+
/** 等待一组按键按下
|
|
11019
|
+
* @param keys
|
|
11020
|
+
* @returns
|
|
11021
|
+
*/
|
|
11022
|
+
awaitOnlyKey(keys2) {
|
|
11023
|
+
return new Promise((resolve) => {
|
|
11024
|
+
const cancel = this.eventInput.addEventListener("codeChange", () => {
|
|
11025
|
+
if (this.eventInput.isOnlyKeyDowns(keys2)) {
|
|
11026
|
+
resolve(true);
|
|
11027
|
+
cancel();
|
|
11028
|
+
}
|
|
11029
|
+
});
|
|
11030
|
+
this.addEventRecord("clear", cancel);
|
|
11031
|
+
});
|
|
11032
|
+
}
|
|
10758
11033
|
}
|
|
10759
11034
|
class Default extends CommandFlowComponent {
|
|
10760
11035
|
static name = "Default";
|
|
@@ -12759,59 +13034,41 @@ class PointDrag extends CommandFlowComponent {
|
|
|
12759
13034
|
super.onAddFromParent(parent);
|
|
12760
13035
|
this.editor.container.add(this.container);
|
|
12761
13036
|
this.container.position.z = 1e-3;
|
|
12762
|
-
const commandFlow = this.commandManager.addCommandFlow(this.commandName).add(this.createInterrupt()).add(this.
|
|
13037
|
+
const commandFlow = this.commandManager.addCommandFlow(this.commandName).add(this.createInterrupt()).add(this.selectLine.bind(this), { prompt: `请选择需要修改的线段, ${this.formatText("ESC")} 取消命令` }).add(this.selectPoint.bind(this), { prompt: `请选择需要修改线段的 ${this.formatText("端点")}, ${this.formatText("ESC")} 取消命令` }).add(this.drag.bind(this), { prompt: `${this.formatText("Shift")} 键锁定线段移动方向,${this.formatText("L")} 键输入线段长度` }).addRollback(this.rollback.bind(this)).addRevokeRollback(this.revokeRollback.bind(this));
|
|
12763
13038
|
commandFlow.addEventListener("finally", this.createFinally());
|
|
12764
13039
|
commandFlow.addEventListener("completed", (e) => this.completed(e.data));
|
|
12765
13040
|
this.eventInput.addKeyCombination(this.commandName, this.shortcutKeys);
|
|
12766
13041
|
this.eventInput.addEventListener("codeChange", async () => this.eventInput.isKeyCombination(this.commandName) && await this.commandManager.start(this.commandName));
|
|
12767
13042
|
this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
|
|
12768
13043
|
}
|
|
13044
|
+
async selectLine(next) {
|
|
13045
|
+
this.createFollowPrompts("请选择需要修改的线段", ["clear", "selectLine"]);
|
|
13046
|
+
const lineSelector = this.createLineSelector();
|
|
13047
|
+
this.addEventRecord("clear", lineSelector.destroy);
|
|
13048
|
+
const line2 = await lineSelector.get("wall");
|
|
13049
|
+
lineSelector.destroy();
|
|
13050
|
+
this.canceEventRecord("selectLine");
|
|
13051
|
+
next(line2);
|
|
13052
|
+
}
|
|
12769
13053
|
/** 选择开始点
|
|
12770
13054
|
* @param next
|
|
12771
13055
|
*/
|
|
12772
|
-
selectPoint(next) {
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
this.
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
lineObj.visible = true;
|
|
12787
|
-
const points = line2.expandToRectangle(0.02, "bothSides").points.map((p) => new THREE.Vector3(p.x, p.y, 0));
|
|
12788
|
-
lineObj.setPoint(...points);
|
|
12789
|
-
} else {
|
|
12790
|
-
this.domElement.style.cursor = "no-drop";
|
|
12791
|
-
currentPoint = null;
|
|
12792
|
-
lineObj.visible = false;
|
|
12793
|
-
circle.removeFromParent();
|
|
12794
|
-
}
|
|
12795
|
-
});
|
|
12796
|
-
this.addEventRecord("selectPointStart").add(eventChange).add(() => lineObj.removeFromParent()).add(this.eventInput.addEventListener("codeChange", () => {
|
|
12797
|
-
if (this.eventInput.isKeyDown("mouse_0") && currentPoint) {
|
|
12798
|
-
this.canceEventRecord("selectPointStart");
|
|
12799
|
-
circle.material.color.set(65280);
|
|
12800
|
-
next({ point: currentPoint, line: currentLine });
|
|
12801
|
-
}
|
|
12802
|
-
}));
|
|
12803
|
-
this.addEventRecord("clear").add(() => {
|
|
12804
|
-
circle.removeFromParent();
|
|
12805
|
-
eventChange();
|
|
12806
|
-
lineObj.removeFromParent();
|
|
12807
|
-
});
|
|
13056
|
+
selectPoint(next, line2) {
|
|
13057
|
+
this.createFollowPrompts("请选择一个端点", ["selectPoint", "clear"]);
|
|
13058
|
+
const list = [
|
|
13059
|
+
this.createClickPoint(line2.start, () => {
|
|
13060
|
+
this.canceEventRecord("selectPoint");
|
|
13061
|
+
next({ line: line2, point: new THREE.Vector3(line2.start.x, line2.start.y, 0) });
|
|
13062
|
+
}),
|
|
13063
|
+
this.createClickPoint(line2.end, () => {
|
|
13064
|
+
this.canceEventRecord("selectPoint");
|
|
13065
|
+
next({ line: line2, point: new THREE.Vector3(line2.end.x, line2.end.y, 0) });
|
|
13066
|
+
})
|
|
13067
|
+
];
|
|
13068
|
+
this.addEventRecord("selectPoint", ...list);
|
|
13069
|
+
this.addEventRecord("clear", ...list);
|
|
12808
13070
|
}
|
|
12809
|
-
|
|
12810
|
-
* @description 拖拽点到指定位置
|
|
12811
|
-
* @param next
|
|
12812
|
-
* @param param1
|
|
12813
|
-
*/
|
|
12814
|
-
drag(next, { point, line: line2 }) {
|
|
13071
|
+
drag(next, { line: line2, point }) {
|
|
12815
13072
|
this.domElement.style.cursor = "crosshair";
|
|
12816
13073
|
const mode = line2.start.equal(Point.from(point)) ? "start" : "end", start = mode == "start" ? new THREE.Vector3(line2.end.x, line2.end.y, 0) : new THREE.Vector3(line2.start.x, line2.start.y, 0), end = point.clone(), lines = new Lines([start, end], 16711935), circle = this.renderer.createCircle(Point.zero(), { color: 16711935, size: 10 }), textObj3D = this.renderer.createText("", new THREE.Vector3(0, 0, 0), {
|
|
12817
13074
|
// background: 'rgba(0,0,0,0.5)',
|
|
@@ -12992,9 +13249,161 @@ class StorageHelper {
|
|
|
12992
13249
|
localStorage.setItem(key, String(vaalue));
|
|
12993
13250
|
}
|
|
12994
13251
|
}
|
|
13252
|
+
function buildDashedHelperLine$1(start, end, offset = 0.5) {
|
|
13253
|
+
const offsetDistance = end.normal(start).multiplyScalar(offset);
|
|
13254
|
+
const startOffPoint = start.clone().add(offsetDistance);
|
|
13255
|
+
const endOffPoint = end.clone().add(offsetDistance);
|
|
13256
|
+
return [
|
|
13257
|
+
start,
|
|
13258
|
+
startOffPoint,
|
|
13259
|
+
endOffPoint,
|
|
13260
|
+
end
|
|
13261
|
+
];
|
|
13262
|
+
}
|
|
13263
|
+
class RayDistance extends CommandFlowComponent {
|
|
13264
|
+
static name = "RayDistance";
|
|
13265
|
+
container = new THREE.Group();
|
|
13266
|
+
static shortcutKeys = ["R"];
|
|
13267
|
+
static commandName = "RayDistance";
|
|
13268
|
+
onAddFromParent(parent) {
|
|
13269
|
+
super.onAddFromParent(parent);
|
|
13270
|
+
this.editor.container.add(this.container);
|
|
13271
|
+
const commandFlow = this.commandManager.addCommandFlow(this.commandName).add(this.createInterrupt()).add(this.createCursor("no-drop")).add(this.selectPoint.bind(this), { prompt: `请选择线段上的一个点作为发射点, ${this.formatText("ESC")} 取消命令` }).add(this.ray.bind(this), { prompt: `按 ${this.formatText("Enter")} 重新选择发射点, ${this.formatText("ESC")} 取消命令` }).setLoop(true);
|
|
13272
|
+
commandFlow.addEventListener("finally", this.createFinally());
|
|
13273
|
+
this.eventInput.addKeyCombination(this.commandName, this.shortcutKeys);
|
|
13274
|
+
this.eventInput.addEventListener("codeChange", async () => this.eventInput.isKeyCombination(this.commandName) && await this.commandManager.start(this.commandName));
|
|
13275
|
+
this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
|
|
13276
|
+
}
|
|
13277
|
+
/** 选择点
|
|
13278
|
+
* @param next
|
|
13279
|
+
*/
|
|
13280
|
+
async selectPoint(next) {
|
|
13281
|
+
const pointSelector = this.createPointSelector();
|
|
13282
|
+
this.addEventRecord("clear", () => {
|
|
13283
|
+
pointSelector.destroy();
|
|
13284
|
+
this.container.clear();
|
|
13285
|
+
});
|
|
13286
|
+
const result = await pointSelector.get("line_point");
|
|
13287
|
+
next(result);
|
|
13288
|
+
}
|
|
13289
|
+
/** 射线
|
|
13290
|
+
* @param points
|
|
13291
|
+
*/
|
|
13292
|
+
async ray(next, { line: line2, point }) {
|
|
13293
|
+
const normal = line2.normal(), nNormal = normal.clone().multiplyScalar(-1), rayLine1 = new LineSegment(point, point.clone().add(normal.multiplyScalar(100))), rayLine2 = new LineSegment(point, point.clone().add(nNormal.multiplyScalar(100)));
|
|
13294
|
+
const lineObj = this.renderer.createLineSegments([rayLine1, rayLine2], 0, { color: 196352 }, this.container);
|
|
13295
|
+
[rayLine1, rayLine2].forEach((rayLine) => {
|
|
13296
|
+
const points = this.renderManager.quadtree.queryLineSegment(rayLine).filter((item) => item.line !== rayLine).map((item) => rayLine.getIntersection(item.line)).filter((p) => !!p);
|
|
13297
|
+
points.sort((a, b) => point.distance(a) - point.distance(b)).forEach((p, i) => {
|
|
13298
|
+
const distance = point.distance(p) * 1e3;
|
|
13299
|
+
if (distance < 1e-3) return;
|
|
13300
|
+
const points2 = buildDashedHelperLine$1(point, p, i * 0.3);
|
|
13301
|
+
const auxiliaryLine = new Lines();
|
|
13302
|
+
auxiliaryLine.position.z = 6e-3;
|
|
13303
|
+
auxiliaryLine.material = new THREE.LineDashedMaterial({
|
|
13304
|
+
color: 16777215,
|
|
13305
|
+
dashSize: 0.02,
|
|
13306
|
+
gapSize: 0.02
|
|
13307
|
+
});
|
|
13308
|
+
auxiliaryLine.setPoint(...points2.map((p2) => new THREE.Vector3(p2.x, p2.y, 0)));
|
|
13309
|
+
this.container.add(auxiliaryLine);
|
|
13310
|
+
setTimeout(() => auxiliaryLine.computeLineDistances());
|
|
13311
|
+
const text = this.renderer.createText(Number(distance.toFixed(0)) + "mm", points2[1].clone().add(points2[2]).multiplyScalar(0.5), {
|
|
13312
|
+
background: "#333333",
|
|
13313
|
+
padding: "2px 4px",
|
|
13314
|
+
borderRadius: "6px",
|
|
13315
|
+
color: "#fff"
|
|
13316
|
+
}, this.container);
|
|
13317
|
+
const circle = this.renderer.createCircle(p, {}, this.container);
|
|
13318
|
+
this.addEventRecord("clear", () => {
|
|
13319
|
+
auxiliaryLine.removeFromParent();
|
|
13320
|
+
text.removeFromParent();
|
|
13321
|
+
circle.removeFromParent();
|
|
13322
|
+
});
|
|
13323
|
+
});
|
|
13324
|
+
});
|
|
13325
|
+
this.addEventRecord("clear", () => {
|
|
13326
|
+
lineObj.removeFromParent();
|
|
13327
|
+
});
|
|
13328
|
+
await this.awaitOnlyKey(["enter"]);
|
|
13329
|
+
next();
|
|
13330
|
+
}
|
|
13331
|
+
}
|
|
13332
|
+
function buildDashedHelperLine(start, end, offset = 0.5) {
|
|
13333
|
+
const offsetDistance = end.normal(start).multiplyScalar(offset);
|
|
13334
|
+
const startOffPoint = start.clone().add(offsetDistance);
|
|
13335
|
+
const endOffPoint = end.clone().add(offsetDistance);
|
|
13336
|
+
return [
|
|
13337
|
+
start,
|
|
13338
|
+
startOffPoint,
|
|
13339
|
+
endOffPoint,
|
|
13340
|
+
end
|
|
13341
|
+
];
|
|
13342
|
+
}
|
|
13343
|
+
class ManualDistance extends CommandFlowComponent {
|
|
13344
|
+
static name = "ManualDistance";
|
|
13345
|
+
container = new THREE.Group();
|
|
13346
|
+
static shortcutKeys = ["M"];
|
|
13347
|
+
static commandName = "ManualDistance";
|
|
13348
|
+
onAddFromParent(parent) {
|
|
13349
|
+
super.onAddFromParent(parent);
|
|
13350
|
+
this.editor.container.add(this.container);
|
|
13351
|
+
const commandFlow = this.commandManager.addCommandFlow(this.commandName).add(this.createInterrupt()).add(this.createCursor("no-drop")).add(this.selectPoint.bind(this), { prompt: `请选择两个点, ${this.formatText("ESC")} 取消命令` }).add(this.ray.bind(this), { prompt: `按 ${this.formatText("Enter")} 重新选择, ${this.formatText("ESC")} 取消命令` }).setLoop(true);
|
|
13352
|
+
commandFlow.addEventListener("finally", this.createFinally());
|
|
13353
|
+
this.eventInput.addKeyCombination(this.commandName, this.shortcutKeys);
|
|
13354
|
+
this.eventInput.addEventListener("codeChange", async () => this.eventInput.isKeyCombination(this.commandName) && await this.commandManager.start(this.commandName));
|
|
13355
|
+
this.eventInput.addCancelDefaultBehavior(() => this.eventInput.isOnlyKeyDowns(this.shortcutKeys));
|
|
13356
|
+
}
|
|
13357
|
+
/** 选择点
|
|
13358
|
+
* @param next
|
|
13359
|
+
*/
|
|
13360
|
+
async selectPoint(next) {
|
|
13361
|
+
const pointSelector = this.createPointSelector();
|
|
13362
|
+
this.addEventRecord("clear", () => {
|
|
13363
|
+
this.container.clear();
|
|
13364
|
+
pointSelector.destroy();
|
|
13365
|
+
});
|
|
13366
|
+
const point1 = (await pointSelector.get("all")).point;
|
|
13367
|
+
this.renderer.createCircle(point1, {}, this.container);
|
|
13368
|
+
const point2 = (await pointSelector.get("all")).point;
|
|
13369
|
+
this.renderer.createCircle(point2, {}, this.container);
|
|
13370
|
+
pointSelector.destroy();
|
|
13371
|
+
next({ point1, point2 });
|
|
13372
|
+
}
|
|
13373
|
+
/** 射线
|
|
13374
|
+
* @param points
|
|
13375
|
+
*/
|
|
13376
|
+
async ray(next, { point1, point2 }) {
|
|
13377
|
+
this.renderer.createLineSegments([new LineSegment(point1, point2)], 0, { color: 65280 }, this.container);
|
|
13378
|
+
const distance = point1.distance(point2) * 1e3;
|
|
13379
|
+
const points = buildDashedHelperLine(point1, point2, 0.3);
|
|
13380
|
+
const auxiliaryLine = new Lines();
|
|
13381
|
+
auxiliaryLine.position.z = 6e-3;
|
|
13382
|
+
auxiliaryLine.material = new THREE.LineDashedMaterial({
|
|
13383
|
+
color: 16777215,
|
|
13384
|
+
dashSize: 0.02,
|
|
13385
|
+
gapSize: 0.02
|
|
13386
|
+
});
|
|
13387
|
+
auxiliaryLine.setPoint(...points.map((p) => new THREE.Vector3(p.x, p.y, 0)));
|
|
13388
|
+
this.container.add(auxiliaryLine);
|
|
13389
|
+
setTimeout(() => auxiliaryLine.computeLineDistances());
|
|
13390
|
+
const text = this.renderer.createText(Number(distance.toFixed(0)) + "mm", points[1].clone().add(points[2]).multiplyScalar(0.5), {
|
|
13391
|
+
background: "#333333",
|
|
13392
|
+
padding: "2px 4px",
|
|
13393
|
+
borderRadius: "6px",
|
|
13394
|
+
color: "#fff"
|
|
13395
|
+
}, this.container);
|
|
13396
|
+
this.addEventRecord("clear", () => {
|
|
13397
|
+
auxiliaryLine.removeFromParent();
|
|
13398
|
+
text.removeFromParent();
|
|
13399
|
+
});
|
|
13400
|
+
await this.awaitOnlyKey(["enter"]);
|
|
13401
|
+
next();
|
|
13402
|
+
}
|
|
13403
|
+
}
|
|
12995
13404
|
const _hoisted_1 = {
|
|
12996
13405
|
key: 0,
|
|
12997
|
-
class: "p-[5px] max-w-[
|
|
13406
|
+
class: "p-[5px] max-w-[150px] min-w-[150px]"
|
|
12998
13407
|
};
|
|
12999
13408
|
const _hoisted_2 = { class: "text-[14px] flex flex-col" };
|
|
13000
13409
|
const _hoisted_3 = ["onClick"];
|
|
@@ -13056,7 +13465,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13056
13465
|
queueMicrotask(() => variable.set("currentKeyUp", "enter"));
|
|
13057
13466
|
}
|
|
13058
13467
|
const props = __props;
|
|
13059
|
-
const dxfVisible = ref(true), isLook = ref(false), toolBarExpand = ref(StorageHelper.getBoolean("toolBarExpand", true)), currentCommand = ref(""), dxfSystem = toRaw(props.dxfSystem), domEventRegister = dxfSystem.findComponentByType(DomEventRegister), editor = dxfSystem.findComponentByType(Editor), defaultComponent = dxfSystem.findComponentByType(Default), whiteModel = dxfSystem.findComponentByType(WhiteModel), threeVJia = dxfSystem.findComponentByType(ThreeVJia), variable = dxfSystem.findComponentByType(Variable), drawLine = dxfSystem.findComponentByType(DrawLine), rollbackCount = ref(0), revokeRollbackCount = ref(0), drawLineCount = ref(0), images = /* @__PURE__ */ Object.assign({ "./assets/images/VerticalCorr.svg": __vite_glob_0_0, "./assets/images/VerticalCorrContinue.svg": __vite_glob_0_1, "./assets/images/angle.svg": __vite_glob_0_2, "./assets/images/close.svg": __vite_glob_0_3, "./assets/images/connection.svg": __vite_glob_0_4, "./assets/images/cutLine.svg": __vite_glob_0_5, "./assets/images/deleteSelectLine.svg": __vite_glob_0_6, "./assets/images/deleteSelectWindow.svg": __vite_glob_0_7, "./assets/images/door.svg": __vite_glob_0_8, "./assets/images/dxf.svg": __vite_glob_0_9, "./assets/images/intersectionConnection.svg": __vite_glob_0_10, "./assets/images/line.svg": __vite_glob_0_11, "./assets/images/mergeLine.svg": __vite_glob_0_12, "./assets/images/revokeRollback.svg": __vite_glob_0_13, "./assets/images/rollback.svg": __vite_glob_0_14, "./assets/images/selectAll.svg": __vite_glob_0_15, "./assets/images/selectPoint.svg": __vite_glob_0_16, "./assets/images/verticalLine.svg": __vite_glob_0_17, "./assets/images/window.svg": __vite_glob_0_18, "./assets/images/属性面板.svg": __vite_glob_0_19 }), selectLineCount = ref(0), selectWinLineCount = ref(0), hasWindowLine = ref(false), commandList = [
|
|
13468
|
+
const dxfVisible = ref(true), isLook = ref(false), toolBarExpand = ref(StorageHelper.getBoolean("toolBarExpand", true)), currentCommand = ref(""), dxfSystem = toRaw(props.dxfSystem), domEventRegister = dxfSystem.findComponentByType(DomEventRegister), editor = dxfSystem.findComponentByType(Editor), defaultComponent = dxfSystem.findComponentByType(Default), whiteModel = dxfSystem.findComponentByType(WhiteModel), threeVJia = dxfSystem.findComponentByType(ThreeVJia), variable = dxfSystem.findComponentByType(Variable), drawLine = dxfSystem.findComponentByType(DrawLine), rollbackCount = ref(0), revokeRollbackCount = ref(0), drawLineCount = ref(0), images = /* @__PURE__ */ Object.assign({ "./assets/images/VerticalCorr.svg": __vite_glob_0_0, "./assets/images/VerticalCorrContinue.svg": __vite_glob_0_1, "./assets/images/angle.svg": __vite_glob_0_2, "./assets/images/close.svg": __vite_glob_0_3, "./assets/images/connection.svg": __vite_glob_0_4, "./assets/images/cutLine.svg": __vite_glob_0_5, "./assets/images/deleteSelectLine.svg": __vite_glob_0_6, "./assets/images/deleteSelectWindow.svg": __vite_glob_0_7, "./assets/images/door.svg": __vite_glob_0_8, "./assets/images/dxf.svg": __vite_glob_0_9, "./assets/images/intersectionConnection.svg": __vite_glob_0_10, "./assets/images/line.svg": __vite_glob_0_11, "./assets/images/mergeLine.svg": __vite_glob_0_12, "./assets/images/revokeRollback.svg": __vite_glob_0_13, "./assets/images/rollback.svg": __vite_glob_0_14, "./assets/images/selectAll.svg": __vite_glob_0_15, "./assets/images/selectPoint.svg": __vite_glob_0_16, "./assets/images/verticalLine.svg": __vite_glob_0_17, "./assets/images/window.svg": __vite_glob_0_18, "./assets/images/属性面板.svg": __vite_glob_0_19, "./assets/images/激光测距.svg": __vite_glob_0_20 }), selectLineCount = ref(0), selectWinLineCount = ref(0), hasWindowLine = ref(false), commandList = [
|
|
13060
13469
|
{
|
|
13061
13470
|
command: "default",
|
|
13062
13471
|
name: "默认",
|
|
@@ -13098,6 +13507,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13098
13507
|
show: true,
|
|
13099
13508
|
src: images["./assets/images/cutLine.svg"].default,
|
|
13100
13509
|
shortcut: ClippingLine.shortcutKeys.join(" + ")
|
|
13510
|
+
},
|
|
13511
|
+
{
|
|
13512
|
+
command: RayDistance.commandName,
|
|
13513
|
+
name: "射线测距",
|
|
13514
|
+
show: true,
|
|
13515
|
+
src: images["./assets/images/激光测距.svg"].default,
|
|
13516
|
+
shortcut: RayDistance.shortcutKeys.join(" + ")
|
|
13517
|
+
},
|
|
13518
|
+
{
|
|
13519
|
+
command: ManualDistance.commandName,
|
|
13520
|
+
name: "手动测距",
|
|
13521
|
+
show: true,
|
|
13522
|
+
src: images["./assets/images/激光测距.svg"].default,
|
|
13523
|
+
shortcut: ManualDistance.shortcutKeys.join(" + ")
|
|
13101
13524
|
}
|
|
13102
13525
|
], otherCommandList = [
|
|
13103
13526
|
{
|
|
@@ -13190,11 +13613,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13190
13613
|
}
|
|
13191
13614
|
},
|
|
13192
13615
|
{
|
|
13193
|
-
command:
|
|
13616
|
+
command: PropertiesPanel.commandName,
|
|
13194
13617
|
name: "属性面板",
|
|
13195
13618
|
show: computed(() => true),
|
|
13196
13619
|
src: images["./assets/images/属性面板.svg"].default,
|
|
13197
|
-
shortcut:
|
|
13620
|
+
shortcut: PropertiesPanel.shortcutKeys.join(" + "),
|
|
13198
13621
|
action() {
|
|
13199
13622
|
variable.set("currentKeyDown", "i");
|
|
13200
13623
|
queueMicrotask(() => variable.set("currentKeyUp", "i"));
|
|
@@ -13495,7 +13918,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13495
13918
|
};
|
|
13496
13919
|
}
|
|
13497
13920
|
});
|
|
13498
|
-
const EditorTool = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
13921
|
+
const EditorTool = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a41b5baa"]]);
|
|
13499
13922
|
class Editor extends Component {
|
|
13500
13923
|
static name = "Editor";
|
|
13501
13924
|
container = new THREE.Group();
|
|
@@ -13682,6 +14105,8 @@ function Editor_(dxfSystem, option = {}) {
|
|
|
13682
14105
|
dxfSystem.addComponent(new VerticalReferenceLine());
|
|
13683
14106
|
dxfSystem.addComponent(new ClippingLine());
|
|
13684
14107
|
dxfSystem.addComponent(new PropertiesPanel());
|
|
14108
|
+
dxfSystem.addComponent(new RayDistance());
|
|
14109
|
+
dxfSystem.addComponent(new ManualDistance());
|
|
13685
14110
|
}
|
|
13686
14111
|
const EditorPlugin = Object.assign(Editor_, {
|
|
13687
14112
|
create(option = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component
|
|
1
|
+
import { Component } from '../../../../../ComponentManager';
|
|
2
2
|
import { Editor } from '../Editor';
|
|
3
3
|
import { EventInput, Renderer } from '../../../RenderPlugin/components';
|
|
4
4
|
import { CommandManager } from '../../../../../CommandManager';
|
|
@@ -6,6 +6,7 @@ import { RenderManager } from '../RenderManager';
|
|
|
6
6
|
import { Default } from './Default';
|
|
7
7
|
import { LineSegment } from '../../../../../LineSegment';
|
|
8
8
|
import { Point } from '../../../../../Point';
|
|
9
|
+
import * as THREE from "three";
|
|
9
10
|
export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Component<TEventMap & {}> {
|
|
10
11
|
static interruptKeys: string[];
|
|
11
12
|
static confirmKeys: string[];
|
|
@@ -28,8 +29,8 @@ export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Com
|
|
|
28
29
|
get interruptKeys(): string[];
|
|
29
30
|
get shortcutKeys(): string[];
|
|
30
31
|
get confirmKeys(): string[];
|
|
32
|
+
container: THREE.Group<THREE.Object3DEventMap>;
|
|
31
33
|
constructor();
|
|
32
|
-
onAddFromParent(parent: ComponentManager): void;
|
|
33
34
|
/**
|
|
34
35
|
* 取消
|
|
35
36
|
*/
|
|
@@ -60,4 +61,41 @@ export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Com
|
|
|
60
61
|
setBaseLine(line: LineSegment | null, point: Point | null): void;
|
|
61
62
|
};
|
|
62
63
|
formatText(text: string, color?: string, style?: string): string;
|
|
64
|
+
/** 创建追随提示消息
|
|
65
|
+
* @param text
|
|
66
|
+
* @param clearNames
|
|
67
|
+
* @param style
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
createFollowPrompts(text: string, clearNames: string[], style?: Record<string, any>): HTMLDivElement;
|
|
71
|
+
/** 创建线段选择器
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
createLineSelector(): {
|
|
75
|
+
get: (mode_?: "all" | "wall" | "door" | "window" | "none") => Promise<unknown>;
|
|
76
|
+
destroy(): void;
|
|
77
|
+
};
|
|
78
|
+
/** 创建点选择器
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
createPointSelector(): {
|
|
82
|
+
get: (mode_: "all" | "point" | "line" | "empty" | "line_point" | "line_empty" | "point_empty" | "null") => Promise<{
|
|
83
|
+
point: Point;
|
|
84
|
+
line?: LineSegment;
|
|
85
|
+
}>;
|
|
86
|
+
destroy(): void;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* 创建拖拽点
|
|
90
|
+
*/
|
|
91
|
+
createDragPoint(point: Point, onChange: (p: Point) => void): () => void;
|
|
92
|
+
/**
|
|
93
|
+
* 创建选择点
|
|
94
|
+
*/
|
|
95
|
+
createClickPoint(point: Point, onClick: () => void): () => void;
|
|
96
|
+
/** 等待一组按键按下
|
|
97
|
+
* @param keys
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
awaitOnlyKey(keys: string[]): Promise<unknown>;
|
|
63
101
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CommandFlowComponent } from './CommandFlowComponent';
|
|
2
|
+
import { ComponentManager } from '../../../../../ComponentManager';
|
|
3
|
+
import { Point } from '../../../../../Point';
|
|
4
|
+
import * as THREE from "three";
|
|
5
|
+
/**
|
|
6
|
+
* 生成长度标记辅助虚线
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildDashedHelperLine(start: Point, end: Point, offset?: number): Point[];
|
|
9
|
+
export declare class ManualDistance extends CommandFlowComponent<{}> {
|
|
10
|
+
static name: string;
|
|
11
|
+
container: THREE.Group<THREE.Object3DEventMap>;
|
|
12
|
+
static shortcutKeys: string[];
|
|
13
|
+
static commandName: string;
|
|
14
|
+
onAddFromParent(parent: ComponentManager): void;
|
|
15
|
+
/** 选择点
|
|
16
|
+
* @param next
|
|
17
|
+
*/
|
|
18
|
+
private selectPoint;
|
|
19
|
+
/** 射线
|
|
20
|
+
* @param points
|
|
21
|
+
*/
|
|
22
|
+
private ray;
|
|
23
|
+
}
|
|
@@ -12,18 +12,14 @@ export declare class PointDrag extends CommandFlowComponent<{
|
|
|
12
12
|
static shortcutKeys: string[];
|
|
13
13
|
static commandName: string;
|
|
14
14
|
onAddFromParent(parent: ComponentManager): void;
|
|
15
|
+
selectLine(next: any): Promise<void>;
|
|
15
16
|
/** 选择开始点
|
|
16
17
|
* @param next
|
|
17
18
|
*/
|
|
18
|
-
selectPoint(next: any): void;
|
|
19
|
-
|
|
20
|
-
* @description 拖拽点到指定位置
|
|
21
|
-
* @param next
|
|
22
|
-
* @param param1
|
|
23
|
-
*/
|
|
24
|
-
drag(next: any, { point, line }: {
|
|
25
|
-
point: THREE.Vector3;
|
|
19
|
+
selectPoint(next: any, line: LineSegment): void;
|
|
20
|
+
drag(next: any, { line, point }: {
|
|
26
21
|
line: LineSegment;
|
|
22
|
+
point: THREE.Vector3;
|
|
27
23
|
}): void;
|
|
28
24
|
/** 执行完成
|
|
29
25
|
*/
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CommandFlowComponent } from './CommandFlowComponent';
|
|
2
|
+
import { ComponentManager } from '../../../../../ComponentManager';
|
|
3
|
+
import { Point } from '../../../../../Point';
|
|
4
|
+
import * as THREE from "three";
|
|
5
|
+
/**
|
|
6
|
+
* 生成长度标记辅助虚线
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildDashedHelperLine(start: Point, end: Point, offset?: number): Point[];
|
|
9
|
+
export declare class RayDistance extends CommandFlowComponent<{}> {
|
|
10
|
+
static name: string;
|
|
11
|
+
container: THREE.Group<THREE.Object3DEventMap>;
|
|
12
|
+
static shortcutKeys: string[];
|
|
13
|
+
static commandName: string;
|
|
14
|
+
onAddFromParent(parent: ComponentManager): void;
|
|
15
|
+
/** 选择点
|
|
16
|
+
* @param next
|
|
17
|
+
*/
|
|
18
|
+
private selectPoint;
|
|
19
|
+
/** 射线
|
|
20
|
+
* @param points
|
|
21
|
+
*/
|
|
22
|
+
private ray;
|
|
23
|
+
}
|