build-dxf 0.0.19-8 → 0.0.19-9
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/index.css +110 -0
- package/src/index2.js +2 -402
- package/src/index3.js +153 -55
- package/src/selectLocalFile.js +443 -21
- package/src/utils/DxfSystem/plugin/Editor/pages/EditorTool.vue.d.ts +4 -1
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/DomEventRegister.d.ts +5 -2
package/src/index3.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import { i as isString, n as noop, r as resolveUnref, t as tryOnScopeDispose,
|
|
3
|
-
import { C as Component, L as LineSegment, P as Point, B as Box2, E as EventDispatcher,
|
|
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,
|
|
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, 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
|
+
import { C as Component, L as LineSegment, P as Point, B as Box2, E as EventDispatcher, b as PointVirtualGrid, Q as Quadtree } 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, watchEffect, onUnmounted, renderList, createApp } from "vue";
|
|
5
5
|
import "clipper-lib";
|
|
6
6
|
import "dxf-writer";
|
|
7
7
|
import "three/addons/controls/OrbitControls.js";
|
|
@@ -804,10 +804,10 @@ class DrawLine extends CommandFlowComponent {
|
|
|
804
804
|
if (find) {
|
|
805
805
|
circle.position.set(point.x, point.y, 0);
|
|
806
806
|
this.container.add(circle);
|
|
807
|
-
dom.
|
|
807
|
+
dom.style.cursor = "none";
|
|
808
808
|
} else {
|
|
809
809
|
circle.removeFromParent();
|
|
810
|
-
dom.
|
|
810
|
+
dom.style.cursor = "crosshair";
|
|
811
811
|
}
|
|
812
812
|
currentPoint.copy(point);
|
|
813
813
|
if (!(start && end)) return;
|
|
@@ -1248,10 +1248,13 @@ class CommandManager extends EventDispatcher {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
1251
|
-
const
|
|
1252
|
-
const
|
|
1253
|
-
const
|
|
1254
|
-
const
|
|
1251
|
+
const _imports_0 = "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";
|
|
1252
|
+
const _hoisted_1 = { class: "mt-[5px] text-[#888] text-[10px] absolute left-[10px] bottom-[10px] rounded-[8px] min-w-[150px] bg-black/15 p-[10px]" };
|
|
1253
|
+
const _hoisted_2 = { class: "inline-block ml-[10px]" };
|
|
1254
|
+
const _hoisted_3 = { class: "flex p-[5px_0px] flex-row header text-[14px] font-bold p-[10px 0px] border-b-1 border-b-[#eee]" };
|
|
1255
|
+
const _hoisted_4 = { class: "p-[5px]" };
|
|
1256
|
+
const _hoisted_5 = { class: "mt-[10px] text-[14px] flex flex-col" };
|
|
1257
|
+
const _hoisted_6 = { class: "flex flex-row items-center gap-[10px] mt-[10px]" };
|
|
1255
1258
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1256
1259
|
__name: "EditorTool",
|
|
1257
1260
|
props: {
|
|
@@ -1259,7 +1262,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1259
1262
|
},
|
|
1260
1263
|
setup(__props) {
|
|
1261
1264
|
const props = __props;
|
|
1262
|
-
const originalLineVisible = ref(true), dxfVisible = ref(true), whiteModelVisible = ref(true), isLook = ref(false), dxfSystem = toRaw(props.dxfSystem),
|
|
1265
|
+
const originalLineVisible = ref(true), dxfVisible = ref(true), whiteModelVisible = ref(true), isLook = ref(false), elRef = ref(), toolBarRef = ref(), dxfSystem = toRaw(props.dxfSystem), domEventRegister = dxfSystem.findComponentByType(DomEventRegister), toolBarPosition = ref({ left: 10, top: 10 }), shortcutKeys = [
|
|
1266
|
+
{ "name": "绘制连续线段", "shortcut": "Ctrl + L" },
|
|
1267
|
+
{ "name": "绘制线段确认", "shortcut": "Enter" },
|
|
1268
|
+
{ "name": "绘制门线", "shortcut": "Ctrl + M" },
|
|
1269
|
+
{ "name": "绘制窗户线", "shortcut": "Ctrl + Q" },
|
|
1270
|
+
{ "name": "移动线段点", "shortcut": "Ctrl + P" },
|
|
1271
|
+
{ "name": "删除线段", "shortcut": "选中 + Delete" },
|
|
1272
|
+
{ "name": "删除窗户线", "shortcut": "选中 + Q + Delete" },
|
|
1273
|
+
{ "name": "选中", "shortcut": "鼠标左键" },
|
|
1274
|
+
{ "name": "多选", "shortcut": "鼠标左键 + Ctrl" },
|
|
1275
|
+
{ "name": "取消选中", "shortcut": "鼠标左键 + Alt" },
|
|
1276
|
+
{ "name": "框选", "shortcut": "鼠标左键 + 移动" },
|
|
1277
|
+
{ "name": "线段同方向合并", "shortcut": "Ctrl + G" },
|
|
1278
|
+
{ "name": "线段连接", "shortcut": "选中 + Shift + L" },
|
|
1279
|
+
{ "name": "线段交点连接", "shortcut": "选中 + Ctrl + Shift + L" },
|
|
1280
|
+
{ "name": "取消命令", "shortcut": "Esc" }
|
|
1281
|
+
];
|
|
1282
|
+
watchEffect(() => localStorage.setItem("EditorToolPosition", JSON.stringify(toolBarPosition.value)));
|
|
1283
|
+
function setEditorToolPosition(left, top) {
|
|
1284
|
+
const dom = elRef.value, toolBarDom = elRef.value, rect = dom.getBoundingClientRect(), toolBarRect = toolBarDom.getBoundingClientRect(), minX = 0, maxX = toolBarRect.width - rect.width, minY = 0, maxY = toolBarRect.height - rect.height;
|
|
1285
|
+
left = Math.max(minX, Math.min(left, maxX));
|
|
1286
|
+
top = Math.max(minY, Math.min(top, maxY));
|
|
1287
|
+
toolBarPosition.value = { left, top };
|
|
1288
|
+
console.log(left, top);
|
|
1289
|
+
}
|
|
1263
1290
|
function setLines(lines) {
|
|
1264
1291
|
if (lines) {
|
|
1265
1292
|
localStorage.setItem("lines", JSON.stringify(lines));
|
|
@@ -1278,6 +1305,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1278
1305
|
setLines(data);
|
|
1279
1306
|
}
|
|
1280
1307
|
}
|
|
1308
|
+
function dragMoveHelper(e) {
|
|
1309
|
+
domEventRegister.mouseMoveEventProxylock = true;
|
|
1310
|
+
const cusor = document.body.style.cursor;
|
|
1311
|
+
document.body.style.cursor = "move";
|
|
1312
|
+
const move = (e2) => {
|
|
1313
|
+
setEditorToolPosition(
|
|
1314
|
+
toolBarPosition.value.left + e2.movementX,
|
|
1315
|
+
toolBarPosition.value.top + e2.movementY
|
|
1316
|
+
);
|
|
1317
|
+
e2.stopPropagation();
|
|
1318
|
+
document.body.style.cursor = "move";
|
|
1319
|
+
};
|
|
1320
|
+
const end = () => {
|
|
1321
|
+
document.body.removeEventListener("mousemove", move);
|
|
1322
|
+
document.body.removeEventListener("mouseup", end);
|
|
1323
|
+
document.body.style.cursor = cusor;
|
|
1324
|
+
domEventRegister.mouseMoveEventProxylock = false;
|
|
1325
|
+
};
|
|
1326
|
+
document.body.addEventListener("mousemove", move);
|
|
1327
|
+
document.body.addEventListener("mouseup", end);
|
|
1328
|
+
}
|
|
1281
1329
|
watch(originalLineVisible, () => dxfSystem.Variable.set("originalLineVisible", originalLineVisible.value));
|
|
1282
1330
|
watch(dxfVisible, () => dxfSystem.Variable.set("dxfVisible", dxfVisible.value));
|
|
1283
1331
|
watch(whiteModelVisible, () => dxfSystem.Variable.set("whiteModelVisible", whiteModelVisible.value));
|
|
@@ -1285,54 +1333,104 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1285
1333
|
dxfSystem.Variable.addEventListener("originalLineVisible", (e) => originalLineVisible.value = e.value);
|
|
1286
1334
|
dxfSystem.Variable.addEventListener("dxfVisible", (e) => dxfVisible.value = e.value);
|
|
1287
1335
|
dxfSystem.Variable.addEventListener("whiteModelVisible", (e) => whiteModelVisible.value = e.value);
|
|
1336
|
+
onMounted(() => {
|
|
1337
|
+
if (localStorage.getItem("EditorToolPosition")) {
|
|
1338
|
+
const { left, top } = JSON.parse(localStorage.getItem("EditorToolPosition") ?? "{}");
|
|
1339
|
+
setEditorToolPosition(left, top);
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
onUnmounted(() => {
|
|
1343
|
+
domEventRegister.mouseMoveEventProxylock = false;
|
|
1344
|
+
});
|
|
1288
1345
|
return (_ctx, _cache) => {
|
|
1289
|
-
return openBlock(), createElementBlock("div",
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
type: "primary",
|
|
1305
|
-
onClick: _cache[0] || (_cache[0] = ($event) => unref(dxfSystem).Dxf.download("test.dxf"))
|
|
1306
|
-
}, {
|
|
1307
|
-
default: withCtx(() => _cache[4] || (_cache[4] = [
|
|
1308
|
-
createTextVNode(" 下载 DXF ", -1)
|
|
1309
|
-
])),
|
|
1310
|
-
_: 1,
|
|
1311
|
-
__: [4]
|
|
1312
|
-
}),
|
|
1313
|
-
createVNode(unref(ElButton), {
|
|
1314
|
-
size: "small",
|
|
1315
|
-
type: "primary",
|
|
1316
|
-
onClick: _cache[1] || (_cache[1] = ($event) => unref(log)(unref(getFileAll)()))
|
|
1317
|
-
}, {
|
|
1318
|
-
default: withCtx(() => _cache[5] || (_cache[5] = [
|
|
1319
|
-
createTextVNode(" 打印 ", -1)
|
|
1320
|
-
])),
|
|
1321
|
-
_: 1,
|
|
1322
|
-
__: [5]
|
|
1323
|
-
})
|
|
1346
|
+
return openBlock(), createElementBlock("div", {
|
|
1347
|
+
ref_key: "elRef",
|
|
1348
|
+
ref: elRef,
|
|
1349
|
+
class: "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]"
|
|
1350
|
+
}, [
|
|
1351
|
+
createElementVNode("div", _hoisted_1, [
|
|
1352
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(shortcutKeys, (item) => {
|
|
1353
|
+
return createElementVNode("p", {
|
|
1354
|
+
class: "p-[2px_0px] flex justify-between text-right border-b-1 border-b-[rgba(255,255,255,0.1)] last-of-type:border-b-0",
|
|
1355
|
+
key: item.name
|
|
1356
|
+
}, [
|
|
1357
|
+
createTextVNode(toDisplayString(item.name) + ": ", 1),
|
|
1358
|
+
createElementVNode("span", _hoisted_2, toDisplayString(item.shortcut), 1)
|
|
1359
|
+
]);
|
|
1360
|
+
}), 64))
|
|
1324
1361
|
]),
|
|
1325
|
-
createElementVNode("div",
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1362
|
+
createElementVNode("div", {
|
|
1363
|
+
ref_key: "toolBarRef",
|
|
1364
|
+
ref: toolBarRef,
|
|
1365
|
+
style: normalizeStyle({ left: toolBarPosition.value.left + "px", top: toolBarPosition.value.top + "px" }),
|
|
1366
|
+
class: "pointer-events-auto text-[#333] absolute rounded-[8px] min-w-[140px] z-[1000] bg-white select-none"
|
|
1367
|
+
}, [
|
|
1368
|
+
createElementVNode("div", _hoisted_3, [
|
|
1369
|
+
(openBlock(), createElementBlock("svg", {
|
|
1370
|
+
onMousedown: dragMoveHelper,
|
|
1371
|
+
class: "m-[0px_5px]",
|
|
1372
|
+
fill: "#aaa",
|
|
1373
|
+
width: "20",
|
|
1374
|
+
height: "20",
|
|
1375
|
+
viewBox: "0 0 1024 1024",
|
|
1376
|
+
version: "1.1",
|
|
1377
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1378
|
+
}, _cache[2] || (_cache[2] = [
|
|
1379
|
+
createElementVNode("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" }, null, -1)
|
|
1380
|
+
]), 32)),
|
|
1381
|
+
_cache[3] || (_cache[3] = createElementVNode("span", null, "小工具", -1))
|
|
1332
1382
|
]),
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1383
|
+
createElementVNode("div", _hoisted_4, [
|
|
1384
|
+
createElementVNode("ul", _hoisted_5, [
|
|
1385
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(4, (i) => {
|
|
1386
|
+
return createElementVNode("li", {
|
|
1387
|
+
key: i,
|
|
1388
|
+
class: "hover:bg-[#ddd] transition-all rounded-[6px] p-[5px] flex flex-row items-center cursor-pointer"
|
|
1389
|
+
}, _cache[4] || (_cache[4] = [
|
|
1390
|
+
createElementVNode("div", { class: "p-[5px] bg-[#f0f0f0] rounded-[6px] mr-[10px]" }, [
|
|
1391
|
+
createElementVNode("img", {
|
|
1392
|
+
class: "w-[20px] h-[20px]",
|
|
1393
|
+
src: _imports_0,
|
|
1394
|
+
alt: "",
|
|
1395
|
+
srcset: ""
|
|
1396
|
+
})
|
|
1397
|
+
], -1),
|
|
1398
|
+
createElementVNode("span", null, "直线", -1)
|
|
1399
|
+
]));
|
|
1400
|
+
}), 64))
|
|
1401
|
+
]),
|
|
1402
|
+
createElementVNode("div", _hoisted_6, [
|
|
1403
|
+
createVNode(unref(ElCheckbox), {
|
|
1404
|
+
modelValue: dxfVisible.value,
|
|
1405
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dxfVisible.value = $event),
|
|
1406
|
+
label: "dxf"
|
|
1407
|
+
}, null, 8, ["modelValue"]),
|
|
1408
|
+
createVNode(unref(ElButton), {
|
|
1409
|
+
size: "small",
|
|
1410
|
+
type: "success",
|
|
1411
|
+
onClick: selectLocalFile
|
|
1412
|
+
}, {
|
|
1413
|
+
default: withCtx(() => _cache[5] || (_cache[5] = [
|
|
1414
|
+
createTextVNode(" 选择文件 ", -1)
|
|
1415
|
+
])),
|
|
1416
|
+
_: 1,
|
|
1417
|
+
__: [5]
|
|
1418
|
+
}),
|
|
1419
|
+
createVNode(unref(ElButton), {
|
|
1420
|
+
size: "small",
|
|
1421
|
+
type: "primary",
|
|
1422
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(dxfSystem).Dxf.download("test.dxf"))
|
|
1423
|
+
}, {
|
|
1424
|
+
default: withCtx(() => _cache[6] || (_cache[6] = [
|
|
1425
|
+
createTextVNode(" 下载 DXF ", -1)
|
|
1426
|
+
])),
|
|
1427
|
+
_: 1,
|
|
1428
|
+
__: [6]
|
|
1429
|
+
})
|
|
1430
|
+
])
|
|
1431
|
+
])
|
|
1432
|
+
], 4)
|
|
1433
|
+
], 512);
|
|
1336
1434
|
};
|
|
1337
1435
|
}
|
|
1338
1436
|
});
|