build-dxf 0.0.19-11 → 0.0.19-12
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 +293 -297
- package/src/index2.js +13 -2520
- package/src/index3.js +118 -5
- package/src/selectLocalFile.js +2575 -92
- package/src/utils/DxfSystem/plugin/Editor/pages/EditorTool.vue.d.ts +1 -0
package/src/index3.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
|
-
import {
|
|
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
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
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";
|
|
@@ -1248,8 +1248,13 @@ class CommandManager extends EventDispatcher {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
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";
|
|
1251
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]" };
|
|
1252
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]" };
|
|
1253
1258
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1254
1259
|
__name: "EditorTool",
|
|
1255
1260
|
props: {
|
|
@@ -1257,9 +1262,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1257
1262
|
},
|
|
1258
1263
|
setup(__props) {
|
|
1259
1264
|
const props = __props;
|
|
1260
|
-
const originalLineVisible = ref(true), dxfVisible = ref(true), whiteModelVisible = ref(true), isLook = ref(false), elRef = ref()
|
|
1261
|
-
ref();
|
|
1262
|
-
const dxfSystem = toRaw(props.dxfSystem), domEventRegister = dxfSystem.findComponentByType(DomEventRegister), toolBarPosition = ref({ left: 10, top: 10 }), shortcutKeys = [
|
|
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 = [
|
|
1263
1266
|
{ "name": "绘制连续线段", "shortcut": "Ctrl + L" },
|
|
1264
1267
|
{ "name": "绘制线段确认", "shortcut": "Enter" },
|
|
1265
1268
|
{ "name": "绘制门线", "shortcut": "Ctrl + M" },
|
|
@@ -1284,6 +1287,45 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1284
1287
|
toolBarPosition.value = { left, top };
|
|
1285
1288
|
console.log(left, top);
|
|
1286
1289
|
}
|
|
1290
|
+
function setLines(lines) {
|
|
1291
|
+
if (lines) {
|
|
1292
|
+
localStorage.setItem("lines", JSON.stringify(lines));
|
|
1293
|
+
try {
|
|
1294
|
+
dxfSystem.Dxf.set(lines);
|
|
1295
|
+
dxfSystem.Dxf.lineOffset();
|
|
1296
|
+
} catch (error) {
|
|
1297
|
+
console.log(error);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
async function selectLocalFile() {
|
|
1302
|
+
const data = await SelectLocalFile.json();
|
|
1303
|
+
if (Array.isArray(data)) {
|
|
1304
|
+
localStorage.removeItem("orbitControls");
|
|
1305
|
+
setLines(data);
|
|
1306
|
+
}
|
|
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
|
+
}
|
|
1287
1329
|
watch(originalLineVisible, () => dxfSystem.Variable.set("originalLineVisible", originalLineVisible.value));
|
|
1288
1330
|
watch(dxfVisible, () => dxfSystem.Variable.set("dxfVisible", dxfVisible.value));
|
|
1289
1331
|
watch(whiteModelVisible, () => dxfSystem.Variable.set("whiteModelVisible", whiteModelVisible.value));
|
|
@@ -1316,7 +1358,78 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1316
1358
|
createElementVNode("span", _hoisted_2, toDisplayString(item.shortcut), 1)
|
|
1317
1359
|
]);
|
|
1318
1360
|
}), 64))
|
|
1319
|
-
])
|
|
1361
|
+
]),
|
|
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))
|
|
1382
|
+
]),
|
|
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)
|
|
1320
1433
|
], 512);
|
|
1321
1434
|
};
|
|
1322
1435
|
}
|