build-dxf 0.1.113 → 0.1.115
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/api/index.d.ts +4 -1
- package/src/build.js +245 -173
- package/src/dxf-system/plugins/editor/components/CommandFlow/CFComponent.d.ts +11 -4
- package/src/dxf-system/plugins/editor/components/CommandFlow/{Default.d.ts → DefaultCommand.d.ts} +2 -2
- package/src/dxf-system/plugins/editor/components/CommandFlow/DrawHole.d.ts +38 -0
- package/src/dxf-system/plugins/editor/components/CommandFlow/DrawWindow.d.ts +1 -1
- package/src/dxf-system/plugins/editor/components/CommandFlow/PropertiesPanel.d.ts +1 -1
- package/src/dxf-system/plugins/editor/components/Editor.d.ts +1 -1
- package/src/dxf-system/plugins/editor/components/RenderManager.d.ts +9 -9
- package/src/dxf-system/plugins/editor/components/UIService.d.ts +2 -1
- package/src/dxf-system/plugins/editor/components/index.d.ts +1 -1
- package/src/dxf-system/plugins/editor/pages/EditorTool/EditorTool.vue.d.ts +1 -1
- package/src/dxf-system/plugins/editor/pages/PropertiesPanel.vue.d.ts +1 -1
- package/src/dxf-system/plugins/editor/utils/Wall2D.d.ts +10 -0
- package/src/dxf-system/utils/WallInsertObject.d.ts +6 -0
- package/src/dxf-system/utils/line-pipeline/builtin/door-to-hole.d.ts +1 -1
- package/src/dxf-system/utils/line-pipeline/builtin/double-wall-alignment.d.ts +1 -1
- package/src/index.css +13 -13
- package/src/index.js +10 -10
- package/src/index3.js +674 -119
- package/src/utils/algorithms/LineSegment.d.ts +22 -16
- package/src/utils/algorithms/Point.d.ts +6 -5
- package/src/utils/algorithms/Rectangle.d.ts +2 -2
- package/src/utils/three-object-3d/LineAlignmentGuide.d.ts +19 -0
- package/src/utils/three-object-3d/Shape2D.d.ts +61 -0
package/src/index3.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs, C as Component, P as PointSpatialHash, Q as Quadtree, B as Box2, a as Point, L as LineDashed, c as cloneUserData,
|
|
1
|
+
import { g as getDefaultExportFromCjs, C as Component, P as PointSpatialHash, Q as Quadtree, B as Box2, a as Point, L as LineDashed, c as cloneUserData, b as Pipeline, W as WallGroupManager, d as WallInsertObject, e as LineSegmentUtils, V as Variable, f as LineSegment, h as createQuadtree, u as uuid, m as mToMm, i as Lines, H as HeightQuery, j as drawText, k as mergeChains, l as mmTom, n as LinePipeline, R as Rectangle, D as DEFAULT_WALL_WIDTH, o as WhiteModel, T as ThreeVJia, S as SelectLocalFile, M as MiniCircles, p as CommandManager } from "./build.js";
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
import { InstancedBufferGeometry, Float32BufferAttribute, InstancedInterleavedBuffer, InterleavedBufferAttribute, WireframeGeometry, Box3, Sphere, Vector3, ShaderMaterial, ShaderLib, UniformsUtils, Vector2, UniformsLib, Mesh, Vector4, Line3, Matrix4, MathUtils, Group } from "three";
|
|
4
4
|
import "clipper-lib";
|
|
@@ -6,6 +6,7 @@ import "dxf-writer";
|
|
|
6
6
|
import { i as isMobileRef, D as DomEventRegister, a as DomContainer } from "./DomEventRegister.js";
|
|
7
7
|
import "three/addons/controls/OrbitControls.js";
|
|
8
8
|
import { defineComponent, useModel, ref, computed, watch, nextTick, onMounted, onUnmounted, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createStaticVNode, toDisplayString, renderSlot, createCommentVNode, mergeModels, warn, getCurrentInstance, unref, getCurrentScope, onScopeDispose, shallowRef, watchEffect, readonly, isRef, reactive, inject, onBeforeUnmount, onBeforeMount, provide, createBlock, Teleport, mergeProps, withDirectives, cloneVNode, Comment, Fragment, Text, createVNode, withCtx, toRef, Transition, vShow, onDeactivated, markRaw, useAttrs as useAttrs$1, useSlots, resolveDynamicComponent, withModifiers, onActivated, onUpdated, createTextVNode, toRaw, vModelCheckbox, toRefs, renderList, resolveComponent, normalizeProps, guardReactiveProps, createSlots, shallowReactive, isVNode, render, createApp, vModelText, h, TransitionGroup } from "vue";
|
|
9
|
+
import { CSS2DObject } from "three/addons/renderers/CSS2DRenderer.js";
|
|
9
10
|
const _hoisted_1$c = { class: "flex flex-row" };
|
|
10
11
|
const _hoisted_2$6 = { class: "flex text-nowrap text-[12px] items-center pointer-events-none" };
|
|
11
12
|
const _hoisted_3$3 = {
|
|
@@ -125,20 +126,20 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
125
126
|
onClick: _cache[1] || (_cache[1] = (e) => e.stopPropagation()),
|
|
126
127
|
ref_key: "elRef",
|
|
127
128
|
ref: elRef,
|
|
128
|
-
class: normalizeClass([{ "pointer-events-none": isdrag.value }, "editorTool pointer-events-none overflow-hidden absolute left-0 top-0 w-full h-full z-
|
|
129
|
+
class: normalizeClass([{ "pointer-events-none": isdrag.value }, "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]"])
|
|
129
130
|
}, [
|
|
130
131
|
createElementVNode("div", {
|
|
131
132
|
ref_key: "toolBarRef",
|
|
132
133
|
ref: toolBarRef,
|
|
133
134
|
style: normalizeStyle({ left: toolBarPosition.value.left + "px", top: toolBarPosition.value.top + "px" }),
|
|
134
|
-
class: normalizeClass(["overflow-hidden pointer-events-auto w-fit transition-[border-radius] text-[#333] absolute z-
|
|
135
|
+
class: normalizeClass(["overflow-hidden pointer-events-auto w-fit transition-[border-radius] text-[#333] absolute z-11 bg-white select-none max-w-full", { "rounded-[8px]": showContent.value && isPc.value }]),
|
|
135
136
|
onMousedown: _cache[0] || (_cache[0] = (e) => e.stopPropagation())
|
|
136
137
|
}, [
|
|
137
138
|
showTitle.value ? (openBlock(), createElementBlock("div", {
|
|
138
139
|
key: 0,
|
|
139
140
|
onTouchstart: dragMoveHelper,
|
|
140
141
|
onMousedown: dragMoveHelper,
|
|
141
|
-
class: normalizeClass([{ "border-b-[#eee] border-b
|
|
142
|
+
class: normalizeClass([{ "border-b-[#eee] border-b": showContent.value }, "flex flex-row justify-between header text-[14px] font-bold p-[10px 0px]"])
|
|
142
143
|
}, [
|
|
143
144
|
createElementVNode("div", _hoisted_1$c, [
|
|
144
145
|
_cache[2] || (_cache[2] = createStaticVNode('<div class="p-[2px_5px] size-[20px] flex items-center pointer-events-none"><svg fill="#aaa" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M352 128a134.4 134.4 0 0 1 128.832 96H921.6a38.4 38.4 0 0 1 0 76.8H480.832a134.4 134.4 0 0 1-257.664 0H102.4a38.4 38.4 0 1 1 0-76.8h120.768A134.4 134.4 0 0 1 352 128z m0 76.8a57.6 57.6 0 1 0 0 115.2 57.6 57.6 0 0 0 0-115.2z"></path><path d="M64 467.2m38.4 0l819.2 0q38.4 0 38.4 38.4l0 0q0 38.4-38.4 38.4l-819.2 0q-38.4 0-38.4-38.4l0 0q0-38.4 38.4-38.4Z"></path><path d="M672 614.4a134.4 134.4 0 0 1 128.832 96H921.6a38.4 38.4 0 0 1 0 76.8h-120.768a134.4 134.4 0 0 1-257.664 0H102.4a38.4 38.4 0 0 1 0-76.8h440.768A134.4 134.4 0 0 1 672 614.4z m0 76.8a57.6 57.6 0 1 0 0 115.2 57.6 57.6 0 0 0 0-115.2z"></path></svg></div>', 1)),
|
|
@@ -11012,7 +11013,6 @@ message.closeAllByPlacement = closeAllByPlacement;
|
|
|
11012
11013
|
message._context = null;
|
|
11013
11014
|
const ElMessage = withInstallFunction(message, "$message");
|
|
11014
11015
|
const textureUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAKdUlEQVR4AeydbZrUKBRGq2YjOjvpWYntStSVjK5EdzLOSsr7arBLOkkBAcLHmacwlQQInMsZUvdP/3Xhv+oEbrfbk5XYz1P1gfLAC4KwCCCwQwBBduBwCwIIwhqAwA4BBNmBwy0IFBQEuBDonwCC9B9DZlCQAIIUhEvX/RNAkP5jyAwKEkCQgnDp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LWrq2mgIFIfla0kgBUlJN5XVIgXWQvFkEvwNcLIoIkDf11gUtFSgESTGTBUgxKZVRKQUKQMLj3yLmCJAiMiqT0goUgKSISQKkiIzKpIYCByAp9g5JgNTwrPIspsAOSPg2jU9zttuwcIcAWRBFh3wpsAESPv8p+m2aAPHVFmTNKwokSPjW7bXoQOTgO7hXcth3WIDs0013dVDAIAEOIAAUPnTkw06+b7NT16KRI1dPgGQltA6hwPV65YNQEh908mFnsQn5kgACZEkVHZMCSYFSgKTstJICYykgQMbyp2pTWAEBUlhQZTeWAgJkLH+qNoUVECCFBVV2YykQAJCxBFdtYikgQGL5S9Y2VkCANBZcxcVSQIDE8pesbayAuWiilwAAAD9JREFUAGksuIqLpcC5AYnlK1nbQQEB0kF0FRlHAQESx1eytIMCAqSD6CoyjgICJI6vZGkHBQRIJdGV7RgK/AMAAP//4C6KhwAAAAZJREFUAwD4/NzNgTbrjAAAAABJRU5ErkJggg==";
|
|
11016
11016
|
class Debouncing {
|
|
11017
11017
|
timeoutId = null;
|
|
11018
11018
|
delay;
|
|
@@ -11037,7 +11037,6 @@ class Debouncing {
|
|
|
11037
11037
|
}
|
|
11038
11038
|
const loader = new THREE.TextureLoader();
|
|
11039
11039
|
const texture = loader.load(textureUrl);
|
|
11040
|
-
const searchTexture = loader.load(searchTextureUrl);
|
|
11041
11040
|
class RenderManager extends Component {
|
|
11042
11041
|
static name = "RenderManager";
|
|
11043
11042
|
container = new THREE.Group();
|
|
@@ -11134,77 +11133,15 @@ class RenderManager extends Component {
|
|
|
11134
11133
|
for (let i = 0; i < lines.length; i++) this.removeLine(lines[i], false);
|
|
11135
11134
|
this.draw();
|
|
11136
11135
|
}
|
|
11137
|
-
/**
|
|
11138
|
-
*
|
|
11136
|
+
/** 创建几何体
|
|
11137
|
+
* @param rectangle
|
|
11139
11138
|
*/
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
if (line2.userData.isBayWindow) {
|
|
11145
|
-
line2.points.forEach((p) => bayWindowPoint.push(p.x, p.y, 0));
|
|
11146
|
-
return;
|
|
11147
|
-
}
|
|
11148
|
-
line2.points.forEach((p) => {
|
|
11149
|
-
if (line2.userData.isDoor) doorPosition.push(p.x, p.y, 0);
|
|
11150
|
-
else position.push(p.x, p.y, 0);
|
|
11151
|
-
});
|
|
11152
|
-
if (line2.userData.isDoor && line2.userData.doorAutomaticFind) findDoorPoint.push(line2.center);
|
|
11153
|
-
if (line2.userData.isWindow && line2.userData.drawWindow) {
|
|
11154
|
-
line2.userData.drawWindow.forEach(({ width, p }) => {
|
|
11155
|
-
const center = Point.from(p), direction = line2.direction(), start = center.clone().add(direction.clone().multiplyScalar(width * 0.5)), end = center.clone().add(direction.clone().multiplyScalar(-width * 0.5));
|
|
11156
|
-
windowPosition.push(start.x, start.y, 1e-3);
|
|
11157
|
-
windowPosition.push(end.x, end.y, 1e-3);
|
|
11158
|
-
});
|
|
11159
|
-
}
|
|
11160
|
-
if (line2.userData.isVerticalReferenceLine) {
|
|
11161
|
-
const pos = line2.center;
|
|
11162
|
-
this.verticalReferenceLineFlag.position.set(pos.x, pos.y, 0);
|
|
11163
|
-
this.container.add(this.verticalReferenceLineFlag);
|
|
11164
|
-
}
|
|
11165
|
-
if (line2.userData.isPassageEntrance) {
|
|
11166
|
-
line2.userData.passageEntrance?.forEach((item) => {
|
|
11167
|
-
const direction = line2.direction();
|
|
11168
|
-
const peLine = Point.from(item.p).expandAsLine(direction, item.width).translate(-item.width * 0.5, direction);
|
|
11169
|
-
peLine.points.forEach((p) => passageEntrancePosition.push(p.x, p.y, 0));
|
|
11170
|
-
});
|
|
11171
|
-
}
|
|
11139
|
+
createGeometry(map, count) {
|
|
11140
|
+
const geometry = new THREE.BufferGeometry();
|
|
11141
|
+
Object.keys(map).forEach((k) => {
|
|
11142
|
+
geometry.setAttribute(k, new THREE.BufferAttribute(new Float32Array(map[k]), map[k].length / count));
|
|
11172
11143
|
});
|
|
11173
|
-
|
|
11174
|
-
position
|
|
11175
|
-
}, position.length / 3, {
|
|
11176
|
-
color: 5745151
|
|
11177
|
-
}, this.container);
|
|
11178
|
-
doorPosition.length && this.renderer.createLineSegments({
|
|
11179
|
-
position: doorPosition
|
|
11180
|
-
}, doorPosition.length / 3, {
|
|
11181
|
-
color: 16776960
|
|
11182
|
-
}, this.container);
|
|
11183
|
-
passageEntrancePosition.length && this.renderer.createLineSegments({
|
|
11184
|
-
position: passageEntrancePosition
|
|
11185
|
-
}, passageEntrancePosition.length / 3, {
|
|
11186
|
-
color: 16750592
|
|
11187
|
-
}, this.container);
|
|
11188
|
-
windowPosition.length && this.renderer.createLineSegments({
|
|
11189
|
-
position: windowPosition
|
|
11190
|
-
}, windowPosition.length / 3, {
|
|
11191
|
-
color: 16711935
|
|
11192
|
-
}, this.container);
|
|
11193
|
-
if (bayWindowPoint.length) {
|
|
11194
|
-
const obj3D = this.renderer.createLineSegments({
|
|
11195
|
-
position: bayWindowPoint
|
|
11196
|
-
}, bayWindowPoint.length / 3, {}, this.container);
|
|
11197
|
-
obj3D.material = new THREE.LineDashedMaterial({
|
|
11198
|
-
color: 4235007,
|
|
11199
|
-
dashSize: 0.05,
|
|
11200
|
-
gapSize: 0.05,
|
|
11201
|
-
opacity: 0.5,
|
|
11202
|
-
transparent: true
|
|
11203
|
-
});
|
|
11204
|
-
obj3D.computeLineDistances();
|
|
11205
|
-
}
|
|
11206
|
-
this.renderer.createCircle(findDoorPoint, { map: searchTexture, size: 0.4, sizeAttenuation: true, color: 16777215 }, this.container);
|
|
11207
|
-
synchronize && this.synchronizeDxf();
|
|
11144
|
+
return geometry;
|
|
11208
11145
|
}
|
|
11209
11146
|
lineAdsorption = ref(true);
|
|
11210
11147
|
pointAdsorption = ref(true);
|
|
@@ -11306,16 +11243,6 @@ class RenderManager extends Component {
|
|
|
11306
11243
|
}
|
|
11307
11244
|
this.lineDashed1.visible = this.lineDashed2.visible = this.lineDashedText1.visible = this.lineDashedText2.visible = b;
|
|
11308
11245
|
}
|
|
11309
|
-
/** 创建几何体
|
|
11310
|
-
* @param rectangle
|
|
11311
|
-
*/
|
|
11312
|
-
createGeometry(map, count) {
|
|
11313
|
-
const geometry = new THREE.BufferGeometry();
|
|
11314
|
-
Object.keys(map).forEach((k) => {
|
|
11315
|
-
geometry.setAttribute("position", new THREE.BufferAttribute(new Float32Array(map[k]), map[k].length / count));
|
|
11316
|
-
});
|
|
11317
|
-
return geometry;
|
|
11318
|
-
}
|
|
11319
11246
|
/**
|
|
11320
11247
|
* 转为json
|
|
11321
11248
|
*/
|
|
@@ -11332,7 +11259,7 @@ class RenderManager extends Component {
|
|
|
11332
11259
|
insetionArr,
|
|
11333
11260
|
isDoor: userData.isDoor,
|
|
11334
11261
|
doorDirectConnection: userData.isDoor,
|
|
11335
|
-
length: line2.length
|
|
11262
|
+
length: line2.length,
|
|
11336
11263
|
isWindow: userData.isWindow,
|
|
11337
11264
|
isVerticalReferenceLine: userData.isVerticalReferenceLine,
|
|
11338
11265
|
wallWidth: line2.userData.wallWidth,
|
|
@@ -11362,6 +11289,14 @@ class RenderManager extends Component {
|
|
|
11362
11289
|
dxf2.set(json, dxf2.options);
|
|
11363
11290
|
});
|
|
11364
11291
|
}
|
|
11292
|
+
/**
|
|
11293
|
+
* 绘制
|
|
11294
|
+
*/
|
|
11295
|
+
draw(synchronize = true) {
|
|
11296
|
+
this.container.clear();
|
|
11297
|
+
new Drawer(this.lines).draw(this.container);
|
|
11298
|
+
synchronize && this.synchronizeDxf();
|
|
11299
|
+
}
|
|
11365
11300
|
get renderer() {
|
|
11366
11301
|
return this.parent?.findComponentByName("Renderer");
|
|
11367
11302
|
}
|
|
@@ -11381,6 +11316,189 @@ class RenderManager extends Component {
|
|
|
11381
11316
|
return this.parent?.findComponentByName("DxfLineModel");
|
|
11382
11317
|
}
|
|
11383
11318
|
}
|
|
11319
|
+
class Drawer extends Pipeline {
|
|
11320
|
+
wallGroupManager;
|
|
11321
|
+
constructor(lines) {
|
|
11322
|
+
super();
|
|
11323
|
+
this.wallGroupManager = WallGroupManager.fromByLines(lines);
|
|
11324
|
+
this.use({ type: "wall", handle: this.wall.bind(this) });
|
|
11325
|
+
this.use({ type: "doubleWall", handle: this.doubleWall.bind(this) });
|
|
11326
|
+
this.use({ type: "door", handle: this.door.bind(this) });
|
|
11327
|
+
this.use({ type: "balconyRailing", handle: this.balconyRailing.bind(this) });
|
|
11328
|
+
this.use({ type: "window", handle: this.wall.bind(this) });
|
|
11329
|
+
this.use({ type: "hole", handle: this.hole.bind(this) });
|
|
11330
|
+
this.use({ type: "bayWindow", handle: this.bayWindow.bind(this) });
|
|
11331
|
+
}
|
|
11332
|
+
/** 单线墙壁
|
|
11333
|
+
* @param ctx
|
|
11334
|
+
*/
|
|
11335
|
+
wall(ctx) {
|
|
11336
|
+
const color = new THREE.Color(5745151);
|
|
11337
|
+
const holeLines = ctx.data.flatMap((line2) => {
|
|
11338
|
+
const holeLines2 = [];
|
|
11339
|
+
WallInsertObject.forEachInsertObjectData(line2, (data, key) => {
|
|
11340
|
+
data.forEach((item) => {
|
|
11341
|
+
let type = key == "drawWindow" ? "window" : item.type;
|
|
11342
|
+
const holeLine = WallInsertObject.wallInsertObjectToLine(line2, item);
|
|
11343
|
+
holeLine.userData.type = type;
|
|
11344
|
+
holeLines2.push(holeLine);
|
|
11345
|
+
});
|
|
11346
|
+
});
|
|
11347
|
+
let lines = [line2];
|
|
11348
|
+
if (holeLines2.length) {
|
|
11349
|
+
lines = LineSegmentUtils.clippingByLines(line2, holeLines2) ?? [];
|
|
11350
|
+
}
|
|
11351
|
+
lines.forEach((line22) => {
|
|
11352
|
+
line22.points.forEach((p) => {
|
|
11353
|
+
ctx.cache.lines.push(p.x, p.y, 0);
|
|
11354
|
+
ctx.cache.lineColor.push(color.r, color.g, color.b);
|
|
11355
|
+
});
|
|
11356
|
+
});
|
|
11357
|
+
return holeLines2;
|
|
11358
|
+
});
|
|
11359
|
+
this.wallGroupManager.add({
|
|
11360
|
+
type: "hole",
|
|
11361
|
+
lines: holeLines
|
|
11362
|
+
});
|
|
11363
|
+
}
|
|
11364
|
+
/** 双线墙壁
|
|
11365
|
+
* @param ctx
|
|
11366
|
+
*/
|
|
11367
|
+
doubleWall(ctx) {
|
|
11368
|
+
this.wallGroupManager.add({
|
|
11369
|
+
type: "wall",
|
|
11370
|
+
lines: ctx.data
|
|
11371
|
+
});
|
|
11372
|
+
}
|
|
11373
|
+
/** 门
|
|
11374
|
+
* @param ctx
|
|
11375
|
+
*/
|
|
11376
|
+
door(ctx) {
|
|
11377
|
+
this.wallGroupManager.add({
|
|
11378
|
+
type: "hole",
|
|
11379
|
+
lines: ctx.data
|
|
11380
|
+
});
|
|
11381
|
+
}
|
|
11382
|
+
/** 栏杆
|
|
11383
|
+
* @param ctx
|
|
11384
|
+
*/
|
|
11385
|
+
balconyRailing(ctx) {
|
|
11386
|
+
const color = new THREE.Color(65280);
|
|
11387
|
+
ctx.data.forEach((line2) => {
|
|
11388
|
+
line2.points.forEach((p) => {
|
|
11389
|
+
ctx.cache.lines.push(p.x, p.y, 0);
|
|
11390
|
+
ctx.cache.lineColor.push(color.r, color.g, color.b);
|
|
11391
|
+
});
|
|
11392
|
+
});
|
|
11393
|
+
}
|
|
11394
|
+
/** 飘窗
|
|
11395
|
+
* @param ctx
|
|
11396
|
+
*/
|
|
11397
|
+
bayWindow(ctx) {
|
|
11398
|
+
const color = new THREE.Color(5745151);
|
|
11399
|
+
ctx.data.forEach((line2) => {
|
|
11400
|
+
if (!line2.userData.isBayWindow) return;
|
|
11401
|
+
line2.points.forEach((p) => {
|
|
11402
|
+
ctx.cache.lineDasheds.push(p.x, p.y, 0);
|
|
11403
|
+
ctx.cache.lineDashedColor.push(color.r, color.g, color.b);
|
|
11404
|
+
});
|
|
11405
|
+
});
|
|
11406
|
+
this.wallGroupManager.add({
|
|
11407
|
+
type: "wall",
|
|
11408
|
+
lines: ctx.data.filter((line2) => !line2.userData.isBayWindow)
|
|
11409
|
+
});
|
|
11410
|
+
}
|
|
11411
|
+
/** 孔洞
|
|
11412
|
+
* @param ctx
|
|
11413
|
+
*/
|
|
11414
|
+
hole(ctx) {
|
|
11415
|
+
const colors = {
|
|
11416
|
+
default: new THREE.Color(16776960),
|
|
11417
|
+
// 0xff5722
|
|
11418
|
+
window: new THREE.Color(16711935),
|
|
11419
|
+
door: new THREE.Color(16776960)
|
|
11420
|
+
};
|
|
11421
|
+
ctx.data.forEach((line2) => {
|
|
11422
|
+
const type = line2.userData.type ?? "default";
|
|
11423
|
+
const color = colors[type];
|
|
11424
|
+
line2.points.forEach((p) => {
|
|
11425
|
+
if (type === "default") {
|
|
11426
|
+
ctx.cache.lineDasheds.push(p.x, p.y, 0);
|
|
11427
|
+
ctx.cache.lineDashedColor.push(color.r, color.g, color.b);
|
|
11428
|
+
} else {
|
|
11429
|
+
ctx.cache.lines.push(p.x, p.y, 0);
|
|
11430
|
+
ctx.cache.lineColor.push(color.r, color.g, color.b);
|
|
11431
|
+
}
|
|
11432
|
+
});
|
|
11433
|
+
});
|
|
11434
|
+
}
|
|
11435
|
+
/** 创建几何体
|
|
11436
|
+
* @param rectangle
|
|
11437
|
+
*/
|
|
11438
|
+
createLineSegments(map, count, parameters) {
|
|
11439
|
+
if (Array.isArray(map)) {
|
|
11440
|
+
const position = map.flatMap((line2) => line2?.points?.flatMap((p) => [p.x, p.y, 0]));
|
|
11441
|
+
return this.createLineSegments({ position }, map.length * 2, parameters);
|
|
11442
|
+
}
|
|
11443
|
+
const geometry = new THREE.BufferGeometry();
|
|
11444
|
+
Object.keys(map).forEach((key) => {
|
|
11445
|
+
const value = map[key];
|
|
11446
|
+
if (key === "color") {
|
|
11447
|
+
let attr = new THREE.BufferAttribute(new Float32Array(value), value.length / count);
|
|
11448
|
+
geometry.setAttribute(key, attr);
|
|
11449
|
+
} else {
|
|
11450
|
+
let attr = new THREE.BufferAttribute(new Float32Array(value), value.length / count);
|
|
11451
|
+
geometry.setAttribute(key, attr);
|
|
11452
|
+
}
|
|
11453
|
+
});
|
|
11454
|
+
const lineSegmentList = new THREE.LineSegments(geometry, new THREE.LineBasicMaterial({ ...parameters }));
|
|
11455
|
+
return lineSegmentList;
|
|
11456
|
+
}
|
|
11457
|
+
/**
|
|
11458
|
+
* 绘制
|
|
11459
|
+
*/
|
|
11460
|
+
draw(parent2) {
|
|
11461
|
+
const option = {
|
|
11462
|
+
lines: [],
|
|
11463
|
+
lineColor: [],
|
|
11464
|
+
walls: [],
|
|
11465
|
+
wallColor: [],
|
|
11466
|
+
lineDasheds: [],
|
|
11467
|
+
lineDashedColor: []
|
|
11468
|
+
};
|
|
11469
|
+
this.wallGroupManager.forEach((group) => {
|
|
11470
|
+
this.run(group.type, group.lines, option);
|
|
11471
|
+
});
|
|
11472
|
+
if (option.lines.length) {
|
|
11473
|
+
const wall = this.createLineSegments({
|
|
11474
|
+
position: option.lines,
|
|
11475
|
+
color: option.lineColor
|
|
11476
|
+
}, option.lines.length / 3, {
|
|
11477
|
+
vertexColors: true,
|
|
11478
|
+
toneMapped: false,
|
|
11479
|
+
color: 16777215
|
|
11480
|
+
});
|
|
11481
|
+
parent2.add(wall);
|
|
11482
|
+
}
|
|
11483
|
+
if (option.lineDasheds.length) {
|
|
11484
|
+
const wall = this.createLineSegments({
|
|
11485
|
+
position: option.lineDasheds,
|
|
11486
|
+
color: option.lineDashedColor
|
|
11487
|
+
}, option.lineDasheds.length / 3);
|
|
11488
|
+
wall.material = new THREE.LineDashedMaterial({
|
|
11489
|
+
color: 16777215,
|
|
11490
|
+
vertexColors: true,
|
|
11491
|
+
dashSize: 0.05,
|
|
11492
|
+
gapSize: 0.05,
|
|
11493
|
+
toneMapped: false,
|
|
11494
|
+
transparent: true,
|
|
11495
|
+
opacity: 0.7
|
|
11496
|
+
});
|
|
11497
|
+
wall.computeLineDistances();
|
|
11498
|
+
parent2.add(wall);
|
|
11499
|
+
}
|
|
11500
|
+
}
|
|
11501
|
+
}
|
|
11384
11502
|
function createHtml(tagName, options) {
|
|
11385
11503
|
const { is, customElementRegistry, style, text, html, parent: parent2 } = options ?? {};
|
|
11386
11504
|
const element = document.createElement(tagName, { is, customElementRegistry });
|
|
@@ -11565,6 +11683,8 @@ function createPromise() {
|
|
|
11565
11683
|
}
|
|
11566
11684
|
};
|
|
11567
11685
|
}
|
|
11686
|
+
class UIService {
|
|
11687
|
+
}
|
|
11568
11688
|
class CommandFlowComponent extends Component {
|
|
11569
11689
|
static interruptKeys = ["escape"];
|
|
11570
11690
|
static confirmKeys = ["enter"];
|
|
@@ -11594,7 +11714,7 @@ class CommandFlowComponent extends Component {
|
|
|
11594
11714
|
return this._commandManager;
|
|
11595
11715
|
}
|
|
11596
11716
|
get default() {
|
|
11597
|
-
if (!this._default) this._default = this.parent?.findComponentByName("
|
|
11717
|
+
if (!this._default) this._default = this.parent?.findComponentByName("DefaultCommand");
|
|
11598
11718
|
return this._default;
|
|
11599
11719
|
}
|
|
11600
11720
|
get commandName() {
|
|
@@ -11612,6 +11732,7 @@ class CommandFlowComponent extends Component {
|
|
|
11612
11732
|
container = new THREE.Group();
|
|
11613
11733
|
constructor() {
|
|
11614
11734
|
super();
|
|
11735
|
+
this.uiService = new UIService();
|
|
11615
11736
|
this.addEventListener("addFromParent", () => {
|
|
11616
11737
|
this.editor.container.add(this.container);
|
|
11617
11738
|
this.editor.addEventListener("cancelCommand", () => {
|
|
@@ -11833,7 +11954,8 @@ class CommandFlowComponent extends Component {
|
|
|
11833
11954
|
createLineSelector(opt) {
|
|
11834
11955
|
const {
|
|
11835
11956
|
onMove,
|
|
11836
|
-
eventRecordNames = []
|
|
11957
|
+
eventRecordNames = [],
|
|
11958
|
+
radius = 0.08
|
|
11837
11959
|
} = opt ?? {};
|
|
11838
11960
|
const editor = this.editor, object3D = new THREE.Mesh(), wiLine = new LineSegment();
|
|
11839
11961
|
let currentSelectLine = null;
|
|
@@ -11844,6 +11966,7 @@ class CommandFlowComponent extends Component {
|
|
|
11844
11966
|
color: 55561
|
|
11845
11967
|
});
|
|
11846
11968
|
let mode = "none";
|
|
11969
|
+
let paused = false;
|
|
11847
11970
|
const update = (line2) => {
|
|
11848
11971
|
const rectangle = line2.toRectangle(0.025, "butt");
|
|
11849
11972
|
object3D.geometry = editor.renderManager.createGeometry({
|
|
@@ -11874,7 +11997,8 @@ class CommandFlowComponent extends Component {
|
|
|
11874
11997
|
return null;
|
|
11875
11998
|
}
|
|
11876
11999
|
const ppcEventCancel = editor.addEventListener("pointerPositionChange", () => {
|
|
11877
|
-
|
|
12000
|
+
if (paused) return;
|
|
12001
|
+
const result = editor.renderManager.adsorption(radius);
|
|
11878
12002
|
const {
|
|
11879
12003
|
line: line2,
|
|
11880
12004
|
point
|
|
@@ -11936,6 +12060,12 @@ class CommandFlowComponent extends Component {
|
|
|
11936
12060
|
get ended() {
|
|
11937
12061
|
return ended;
|
|
11938
12062
|
},
|
|
12063
|
+
paused() {
|
|
12064
|
+
paused = true;
|
|
12065
|
+
},
|
|
12066
|
+
resume() {
|
|
12067
|
+
paused = false;
|
|
12068
|
+
},
|
|
11939
12069
|
next: getLines,
|
|
11940
12070
|
end,
|
|
11941
12071
|
lines(mode_) {
|
|
@@ -11960,7 +12090,7 @@ class CommandFlowComponent extends Component {
|
|
|
11960
12090
|
},
|
|
11961
12091
|
async awaitEach(mode_, callBack) {
|
|
11962
12092
|
for await (const line2 of this.lines(mode_)) {
|
|
11963
|
-
callBack(line2);
|
|
12093
|
+
callBack(line2, this);
|
|
11964
12094
|
}
|
|
11965
12095
|
return this;
|
|
11966
12096
|
}
|
|
@@ -12380,12 +12510,19 @@ class CommandFlowComponent extends Component {
|
|
|
12380
12510
|
}
|
|
12381
12511
|
function View() {
|
|
12382
12512
|
return createVNode("div", {
|
|
12383
|
-
"class":
|
|
12513
|
+
"class": {
|
|
12514
|
+
"z-20 absolute left-0 top-0 w-full h-full flex flex-col": true,
|
|
12515
|
+
" justify-center items-center bg-[rgba(0,0,0,0.5)]": !isMobileRef.value
|
|
12516
|
+
},
|
|
12384
12517
|
"onClick": (e) => e.stopPropagation(),
|
|
12385
12518
|
"onPointerdown": (e) => e.stopPropagation()
|
|
12386
|
-
}, [createVNode("div", {
|
|
12519
|
+
}, [isMobileRef.value && createVNode("div", {
|
|
12387
12520
|
"class": "flex-1 pointer-events-none"
|
|
12388
|
-
}, null),
|
|
12521
|
+
}, null), createVNode("div", {
|
|
12522
|
+
"class": {
|
|
12523
|
+
"w-[400px] rounded-[8px] overflow-hidden": true
|
|
12524
|
+
}
|
|
12525
|
+
}, [title && createVNode("div", {
|
|
12389
12526
|
"class": "bg-white p-[10px] text-center text-[16px]"
|
|
12390
12527
|
}, [createVNode("h4", null, [title])]), createVNode(Transition, {
|
|
12391
12528
|
"name": "slide-fade"
|
|
@@ -12401,7 +12538,7 @@ class CommandFlowComponent extends Component {
|
|
|
12401
12538
|
"modelValue": width.value,
|
|
12402
12539
|
"onUpdate:modelValue": ($event) => width.value = $event
|
|
12403
12540
|
}, null)]
|
|
12404
|
-
})]);
|
|
12541
|
+
})])]);
|
|
12405
12542
|
}
|
|
12406
12543
|
function close2() {
|
|
12407
12544
|
if (ended) return;
|
|
@@ -12458,13 +12595,13 @@ class CommandFlowComponent extends Component {
|
|
|
12458
12595
|
}
|
|
12459
12596
|
function updateData() {
|
|
12460
12597
|
const helpLine1 = new LineSegment(point, line2.start);
|
|
12461
|
-
const len1 = helpLine1.length
|
|
12598
|
+
const len1 = helpLine1.length;
|
|
12462
12599
|
text1.setText(mToMm(len1) + "mm");
|
|
12463
12600
|
let center = helpLine1.center;
|
|
12464
12601
|
text1.position.set(center.x, center.y, 0);
|
|
12465
12602
|
num1Text.visible = len1 > 1e-9;
|
|
12466
12603
|
const helpLine2 = new LineSegment(point, line2.end);
|
|
12467
|
-
const len2 = helpLine2.length
|
|
12604
|
+
const len2 = helpLine2.length;
|
|
12468
12605
|
text2.setText(mToMm(len2) + "mm");
|
|
12469
12606
|
center = helpLine2.center;
|
|
12470
12607
|
text2.position.set(center.x, center.y, 0);
|
|
@@ -12494,7 +12631,7 @@ class CommandFlowComponent extends Component {
|
|
|
12494
12631
|
close: close2
|
|
12495
12632
|
} = context.openWidthEditor({
|
|
12496
12633
|
defaultWidth: width,
|
|
12497
|
-
maxWidth: line2.length
|
|
12634
|
+
maxWidth: line2.length * 1e3,
|
|
12498
12635
|
minWidth: 0,
|
|
12499
12636
|
showMax: true
|
|
12500
12637
|
});
|
|
@@ -12514,7 +12651,7 @@ class CommandFlowComponent extends Component {
|
|
|
12514
12651
|
close: close2
|
|
12515
12652
|
} = context.openWidthEditor({
|
|
12516
12653
|
defaultWidth: width,
|
|
12517
|
-
maxWidth: line2.length
|
|
12654
|
+
maxWidth: line2.length * 1e3,
|
|
12518
12655
|
minWidth: 0,
|
|
12519
12656
|
showMax: true
|
|
12520
12657
|
});
|
|
@@ -12677,8 +12814,8 @@ class CommandFlowComponent extends Component {
|
|
|
12677
12814
|
return textMesh;
|
|
12678
12815
|
}
|
|
12679
12816
|
}
|
|
12680
|
-
class
|
|
12681
|
-
static name = "
|
|
12817
|
+
class DefaultCommand extends CommandFlowComponent {
|
|
12818
|
+
static name = "DefaultCommand";
|
|
12682
12819
|
container = new THREE.Group();
|
|
12683
12820
|
onAddFromParent() {
|
|
12684
12821
|
const editor = this.editor, commandManager = editor.commandManager;
|
|
@@ -12858,7 +12995,7 @@ class Default extends CommandFlowComponent {
|
|
|
12858
12995
|
}, 6);
|
|
12859
12996
|
const center = line2.center;
|
|
12860
12997
|
let info = "";
|
|
12861
|
-
textObj3D.element.innerText = info + parseInt(line2.length
|
|
12998
|
+
textObj3D.element.innerText = info + parseInt(line2.length * 1e3 + "") + " mm";
|
|
12862
12999
|
textObj3D.position.set(center.x, center.y, 0);
|
|
12863
13000
|
textObj3D.visible = true;
|
|
12864
13001
|
} else {
|
|
@@ -12868,7 +13005,7 @@ class Default extends CommandFlowComponent {
|
|
|
12868
13005
|
}, 6);
|
|
12869
13006
|
const center = wiLine.center;
|
|
12870
13007
|
let info = "";
|
|
12871
|
-
textObj3D.element.innerText = info + parseInt(wiLine.length
|
|
13008
|
+
textObj3D.element.innerText = info + parseInt(wiLine.length * 1e3 + "") + " mm";
|
|
12872
13009
|
textObj3D.position.set(center.x, center.y, 0);
|
|
12873
13010
|
textObj3D.visible = true;
|
|
12874
13011
|
}
|
|
@@ -13412,11 +13549,11 @@ class DrawWindow extends CommandFlowComponent {
|
|
|
13412
13549
|
* @param points
|
|
13413
13550
|
*/
|
|
13414
13551
|
end(next, { start, end, line: line2 }) {
|
|
13415
|
-
const win = new LineSegment(Point.from(start), Point.from(end)), center = win.center, len = win.length
|
|
13552
|
+
const win = new LineSegment(Point.from(start), Point.from(end)), center = win.center, len = win.length;
|
|
13416
13553
|
const doorDataItem = {
|
|
13417
13554
|
p: { x: center.x, y: center.y, z: 0 },
|
|
13418
13555
|
width: len,
|
|
13419
|
-
full: Math.abs(len - line2.length
|
|
13556
|
+
full: Math.abs(len - line2.length) < 0.01,
|
|
13420
13557
|
uuid: uuid()
|
|
13421
13558
|
};
|
|
13422
13559
|
ElMessage({
|
|
@@ -13852,7 +13989,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
13852
13989
|
}), 256)),
|
|
13853
13990
|
createElementVNode("p", _hoisted_12$1, [
|
|
13854
13991
|
_cache[8] || (_cache[8] = createElementVNode("span", { class: "mr-[5px]" }, "长度", -1)),
|
|
13855
|
-
createElementVNode("span", _hoisted_13$1, toDisplayString(Number(line2.length
|
|
13992
|
+
createElementVNode("span", _hoisted_13$1, toDisplayString(Number(line2.length.toFixed(4))) + "m", 1)
|
|
13856
13993
|
])
|
|
13857
13994
|
]),
|
|
13858
13995
|
createElementVNode("div", _hoisted_14$1, [
|
|
@@ -13906,7 +14043,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
13906
14043
|
};
|
|
13907
14044
|
}
|
|
13908
14045
|
});
|
|
13909
|
-
const PropertiesPanelView = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
14046
|
+
const PropertiesPanelView = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f4f386d2"]]);
|
|
13910
14047
|
class PropertiesPanel extends CommandFlowComponent {
|
|
13911
14048
|
static name = "PropertiesPanel";
|
|
13912
14049
|
container = new THREE.Group();
|
|
@@ -14022,7 +14159,7 @@ class PropertiesPanel extends CommandFlowComponent {
|
|
|
14022
14159
|
}
|
|
14023
14160
|
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
14024
14161
|
__proto__: null,
|
|
14025
|
-
|
|
14162
|
+
DefaultCommand,
|
|
14026
14163
|
DrawDoorLine,
|
|
14027
14164
|
DrawLine,
|
|
14028
14165
|
DrawWindow,
|
|
@@ -14412,7 +14549,7 @@ class ViewAngle extends CommandFlowComponent {
|
|
|
14412
14549
|
* @param selectLines
|
|
14413
14550
|
*/
|
|
14414
14551
|
viewAngle(next, selectLines) {
|
|
14415
|
-
const [start, end] = selectLines, radius = Math.min(start.length
|
|
14552
|
+
const [start, end] = selectLines, radius = Math.min(start.length * 0.8, end.length * 0.8);
|
|
14416
14553
|
let center, point1, point2, gapAngle = 0, textAngle = 0;
|
|
14417
14554
|
if (start.isSameEndpointAsStart(end)) {
|
|
14418
14555
|
center = start.start;
|
|
@@ -15761,7 +15898,7 @@ function openEditor(context, winLine, line2, lineMesh) {
|
|
|
15761
15898
|
}
|
|
15762
15899
|
function update() {
|
|
15763
15900
|
LineSegmentUtils.constrainLine(winLine, line2);
|
|
15764
|
-
width.value = mToMm(winLine.length
|
|
15901
|
+
width.value = mToMm(winLine.length);
|
|
15765
15902
|
let w = mmTom(width.value);
|
|
15766
15903
|
center.copy(winLine.center);
|
|
15767
15904
|
startWidth.value = mToMm(line2.start.distance(center) - w * 0.5);
|
|
@@ -15794,7 +15931,7 @@ function openEditor(context, winLine, line2, lineMesh) {
|
|
|
15794
15931
|
"showCancel": false,
|
|
15795
15932
|
"showConfirm": false
|
|
15796
15933
|
}, null)])
|
|
15797
|
-
}], len = winLine.length
|
|
15934
|
+
}], len = winLine.length, value = ref(0), center = winLine.center, width = ref(mToMm(winLine.length)), winLineDir = winLine.direction(), startWidth = ref(mToMm(line2.start.distance(center) - len * 0.5)), endWidth = ref(mToMm(line2.end.distance(center) - len * 0.5)), {
|
|
15798
15935
|
promise,
|
|
15799
15936
|
resolve
|
|
15800
15937
|
} = createPromise(), marginText1 = context.createButton({
|
|
@@ -15908,12 +16045,12 @@ function modifyWindow(context, winLine, line2, index2) {
|
|
|
15908
16045
|
if (l1) {
|
|
15909
16046
|
text1.visible = true;
|
|
15910
16047
|
text1.position.copy(l1.center.toJson(0));
|
|
15911
|
-
text1.element.innerText = `${mToMm(l1.length
|
|
16048
|
+
text1.element.innerText = `${mToMm(l1.length)}mm`;
|
|
15912
16049
|
} else text1.visible = false;
|
|
15913
16050
|
if (l2) {
|
|
15914
16051
|
text2.visible = true;
|
|
15915
16052
|
text2.position.copy(l2.center.toJson(0));
|
|
15916
|
-
text2.element.innerText = `${mToMm(l2.length
|
|
16053
|
+
text2.element.innerText = `${mToMm(l2.length)}mm`;
|
|
15917
16054
|
} else text2.visible = false;
|
|
15918
16055
|
},
|
|
15919
16056
|
onStart() {
|
|
@@ -15961,11 +16098,11 @@ function modifyWindow(context, winLine, line2, index2) {
|
|
|
15961
16098
|
index: index2,
|
|
15962
16099
|
old: {
|
|
15963
16100
|
p: oldWinLine.center.toJson(data.p.z),
|
|
15964
|
-
width: oldWinLine.length
|
|
16101
|
+
width: oldWinLine.length
|
|
15965
16102
|
},
|
|
15966
16103
|
new: {
|
|
15967
16104
|
p: winLine.center.toJson(data.p.z),
|
|
15968
|
-
width: winLine.length
|
|
16105
|
+
width: winLine.length
|
|
15969
16106
|
}
|
|
15970
16107
|
};
|
|
15971
16108
|
data = null;
|
|
@@ -16067,7 +16204,7 @@ async function modifyLine(context, line2) {
|
|
|
16067
16204
|
value: newValue
|
|
16068
16205
|
}];
|
|
16069
16206
|
point.copy(newPoint);
|
|
16070
|
-
width.value = mToMm(line2.length
|
|
16207
|
+
width.value = mToMm(line2.length);
|
|
16071
16208
|
if (follow.value) list.forEach((item) => {
|
|
16072
16209
|
if (item.point === point) item.list.forEach((item2) => {
|
|
16073
16210
|
records.push({
|
|
@@ -16122,7 +16259,7 @@ async function modifyLine(context, line2) {
|
|
|
16122
16259
|
}), {
|
|
16123
16260
|
promise,
|
|
16124
16261
|
resolve
|
|
16125
|
-
} = createPromise(), oldLine = line2, group = new Group(), linesMesh = new Lines([], 65280), linesMesh2 = new LineDashed([], 5745151), width = ref(mToMm(line2.length
|
|
16262
|
+
} = createPromise(), oldLine = line2, group = new Group(), linesMesh = new Lines([], 65280), linesMesh2 = new LineDashed([], 5745151), width = ref(mToMm(line2.length)), dragging = ref(false), ended = ref(false), ControlZ = context.awaitOnlyKeys(["Control", "Z"], {
|
|
16126
16263
|
once: false
|
|
16127
16264
|
}), recordsList = [];
|
|
16128
16265
|
context.renderManager.removeLine(line2);
|
|
@@ -16568,6 +16705,416 @@ class ManualDistance extends CommandFlowComponent {
|
|
|
16568
16705
|
next();
|
|
16569
16706
|
}
|
|
16570
16707
|
}
|
|
16708
|
+
class Shape2D extends THREE.Mesh {
|
|
16709
|
+
constructor(material) {
|
|
16710
|
+
super(
|
|
16711
|
+
new THREE.BufferGeometry(),
|
|
16712
|
+
material ?? new THREE.MeshBasicMaterial({
|
|
16713
|
+
color: 13421772,
|
|
16714
|
+
side: THREE.DoubleSide,
|
|
16715
|
+
transparent: true
|
|
16716
|
+
})
|
|
16717
|
+
);
|
|
16718
|
+
this.frustumCulled = false;
|
|
16719
|
+
}
|
|
16720
|
+
/**
|
|
16721
|
+
* 子类实现
|
|
16722
|
+
*/
|
|
16723
|
+
// abstract updateGeometry(): void
|
|
16724
|
+
/**
|
|
16725
|
+
* 设置顶点
|
|
16726
|
+
*/
|
|
16727
|
+
setPositions(vertices) {
|
|
16728
|
+
let attr = this.geometry.getAttribute(
|
|
16729
|
+
"position"
|
|
16730
|
+
);
|
|
16731
|
+
if (!attr || attr.array.length !== vertices.length) {
|
|
16732
|
+
attr = new THREE.Float32BufferAttribute(
|
|
16733
|
+
vertices,
|
|
16734
|
+
3
|
|
16735
|
+
);
|
|
16736
|
+
this.geometry.setAttribute(
|
|
16737
|
+
"position",
|
|
16738
|
+
attr
|
|
16739
|
+
);
|
|
16740
|
+
} else {
|
|
16741
|
+
const array = attr.array;
|
|
16742
|
+
array.set(vertices);
|
|
16743
|
+
attr.needsUpdate = true;
|
|
16744
|
+
}
|
|
16745
|
+
this.geometry.computeBoundingBox();
|
|
16746
|
+
this.geometry.computeBoundingSphere();
|
|
16747
|
+
}
|
|
16748
|
+
/**
|
|
16749
|
+
* 设置 UV
|
|
16750
|
+
*/
|
|
16751
|
+
setUVs(uvs) {
|
|
16752
|
+
let attr = this.geometry.getAttribute(
|
|
16753
|
+
"uv"
|
|
16754
|
+
);
|
|
16755
|
+
if (!attr || attr.array.length !== uvs.length) {
|
|
16756
|
+
attr = new THREE.Float32BufferAttribute(
|
|
16757
|
+
uvs,
|
|
16758
|
+
2
|
|
16759
|
+
);
|
|
16760
|
+
this.geometry.setAttribute(
|
|
16761
|
+
"uv",
|
|
16762
|
+
attr
|
|
16763
|
+
);
|
|
16764
|
+
} else {
|
|
16765
|
+
const array = attr.array;
|
|
16766
|
+
array.set(uvs);
|
|
16767
|
+
attr.needsUpdate = true;
|
|
16768
|
+
}
|
|
16769
|
+
}
|
|
16770
|
+
/**
|
|
16771
|
+
* 设置索引
|
|
16772
|
+
*/
|
|
16773
|
+
setIndices(indices) {
|
|
16774
|
+
const current = this.geometry.getIndex();
|
|
16775
|
+
if (!current || current.array.length !== indices.length) {
|
|
16776
|
+
this.geometry.setIndex(
|
|
16777
|
+
[...indices]
|
|
16778
|
+
);
|
|
16779
|
+
} else {
|
|
16780
|
+
const array = current.array;
|
|
16781
|
+
array.set(indices);
|
|
16782
|
+
current.needsUpdate = true;
|
|
16783
|
+
}
|
|
16784
|
+
}
|
|
16785
|
+
/**
|
|
16786
|
+
* 从矩形创建
|
|
16787
|
+
*/
|
|
16788
|
+
/**
|
|
16789
|
+
* 从矩形创建
|
|
16790
|
+
*/
|
|
16791
|
+
fromRectangle(rect) {
|
|
16792
|
+
const p0 = rect.p0, p1 = rect.p1, p2 = rect.p2, p3 = rect.p3;
|
|
16793
|
+
this.setPositions([
|
|
16794
|
+
p0.x,
|
|
16795
|
+
p0.y,
|
|
16796
|
+
0,
|
|
16797
|
+
p1.x,
|
|
16798
|
+
p1.y,
|
|
16799
|
+
0,
|
|
16800
|
+
p2.x,
|
|
16801
|
+
p2.y,
|
|
16802
|
+
0,
|
|
16803
|
+
p3.x,
|
|
16804
|
+
p3.y,
|
|
16805
|
+
0
|
|
16806
|
+
]);
|
|
16807
|
+
this.setUVs([
|
|
16808
|
+
0,
|
|
16809
|
+
0,
|
|
16810
|
+
1,
|
|
16811
|
+
0,
|
|
16812
|
+
1,
|
|
16813
|
+
1,
|
|
16814
|
+
0,
|
|
16815
|
+
1
|
|
16816
|
+
]);
|
|
16817
|
+
this.setIndices([
|
|
16818
|
+
0,
|
|
16819
|
+
1,
|
|
16820
|
+
2,
|
|
16821
|
+
0,
|
|
16822
|
+
2,
|
|
16823
|
+
3
|
|
16824
|
+
]);
|
|
16825
|
+
return this;
|
|
16826
|
+
}
|
|
16827
|
+
/**
|
|
16828
|
+
* 设置贴图
|
|
16829
|
+
*/
|
|
16830
|
+
async setTexture(map) {
|
|
16831
|
+
let texture2;
|
|
16832
|
+
if (map instanceof THREE.Texture) {
|
|
16833
|
+
texture2 = map;
|
|
16834
|
+
} else if (typeof map === "string") {
|
|
16835
|
+
texture2 = await new THREE.TextureLoader().loadAsync(map);
|
|
16836
|
+
} else {
|
|
16837
|
+
texture2 = new THREE.CanvasTexture(map);
|
|
16838
|
+
}
|
|
16839
|
+
texture2.needsUpdate = true;
|
|
16840
|
+
const materials = Array.isArray(this.material) ? this.material : [this.material];
|
|
16841
|
+
for (const material of materials) {
|
|
16842
|
+
if (material instanceof THREE.MeshBasicMaterial || material instanceof THREE.MeshStandardMaterial || material instanceof THREE.MeshPhongMaterial || material instanceof THREE.MeshLambertMaterial) {
|
|
16843
|
+
material.map = texture2;
|
|
16844
|
+
material.needsUpdate = true;
|
|
16845
|
+
}
|
|
16846
|
+
}
|
|
16847
|
+
return texture2;
|
|
16848
|
+
}
|
|
16849
|
+
/**
|
|
16850
|
+
* 设置颜色
|
|
16851
|
+
*/
|
|
16852
|
+
setColor(color) {
|
|
16853
|
+
const materials = Array.isArray(this.material) ? this.material : [this.material];
|
|
16854
|
+
for (const material of materials) {
|
|
16855
|
+
if ("color" in material) {
|
|
16856
|
+
material.color.set(color);
|
|
16857
|
+
}
|
|
16858
|
+
}
|
|
16859
|
+
return this;
|
|
16860
|
+
}
|
|
16861
|
+
/**
|
|
16862
|
+
* 设置透明度
|
|
16863
|
+
*/
|
|
16864
|
+
setOpacity(opacity) {
|
|
16865
|
+
const materials = Array.isArray(this.material) ? this.material : [this.material];
|
|
16866
|
+
for (const material of materials) {
|
|
16867
|
+
material.transparent = opacity < 1;
|
|
16868
|
+
material.opacity = opacity;
|
|
16869
|
+
material.needsUpdate = true;
|
|
16870
|
+
}
|
|
16871
|
+
return this;
|
|
16872
|
+
}
|
|
16873
|
+
/**
|
|
16874
|
+
* 获取包围盒
|
|
16875
|
+
*/
|
|
16876
|
+
getBounds() {
|
|
16877
|
+
if (!this.geometry.boundingBox) {
|
|
16878
|
+
this.geometry.computeBoundingBox();
|
|
16879
|
+
}
|
|
16880
|
+
return this.geometry.boundingBox;
|
|
16881
|
+
}
|
|
16882
|
+
/**
|
|
16883
|
+
* 获取尺寸
|
|
16884
|
+
*/
|
|
16885
|
+
getSize() {
|
|
16886
|
+
const size = new THREE.Vector3();
|
|
16887
|
+
this.getBounds().getSize(size);
|
|
16888
|
+
return size;
|
|
16889
|
+
}
|
|
16890
|
+
/**
|
|
16891
|
+
* 获取中心点
|
|
16892
|
+
*/
|
|
16893
|
+
getCenter() {
|
|
16894
|
+
const center = new THREE.Vector3();
|
|
16895
|
+
this.getBounds().getCenter(center);
|
|
16896
|
+
return center;
|
|
16897
|
+
}
|
|
16898
|
+
/**
|
|
16899
|
+
* 清空 geometry
|
|
16900
|
+
*/
|
|
16901
|
+
clearGeometry() {
|
|
16902
|
+
this.geometry.setAttribute(
|
|
16903
|
+
"position",
|
|
16904
|
+
new THREE.Float32BufferAttribute([], 3)
|
|
16905
|
+
);
|
|
16906
|
+
this.geometry.deleteAttribute("uv");
|
|
16907
|
+
this.geometry.setIndex([]);
|
|
16908
|
+
return this;
|
|
16909
|
+
}
|
|
16910
|
+
/**
|
|
16911
|
+
* 销毁
|
|
16912
|
+
*/
|
|
16913
|
+
dispose() {
|
|
16914
|
+
this.geometry.dispose();
|
|
16915
|
+
const materials = Array.isArray(this.material) ? this.material : [this.material];
|
|
16916
|
+
for (const material of materials) {
|
|
16917
|
+
const map = material.map;
|
|
16918
|
+
if (map?.dispose) {
|
|
16919
|
+
map.dispose();
|
|
16920
|
+
}
|
|
16921
|
+
material.dispose();
|
|
16922
|
+
}
|
|
16923
|
+
}
|
|
16924
|
+
}
|
|
16925
|
+
class Wall2D extends Shape2D {
|
|
16926
|
+
line;
|
|
16927
|
+
rectangle = new Rectangle();
|
|
16928
|
+
debouncing = new Debouncing(10);
|
|
16929
|
+
constructor(line2) {
|
|
16930
|
+
super();
|
|
16931
|
+
this.line = line2;
|
|
16932
|
+
line2.onChange = () => this.debouncing.debounce(this.update.bind(this));
|
|
16933
|
+
this.update();
|
|
16934
|
+
this.setColor(16777215);
|
|
16935
|
+
}
|
|
16936
|
+
update() {
|
|
16937
|
+
this.fromRectangle(this.line.toRectangle(DEFAULT_WALL_WIDTH, "butt", this.rectangle));
|
|
16938
|
+
this.clear();
|
|
16939
|
+
const edges = new THREE.LineSegments(
|
|
16940
|
+
new THREE.EdgesGeometry(this.geometry),
|
|
16941
|
+
new THREE.LineBasicMaterial({
|
|
16942
|
+
color: 4235007
|
|
16943
|
+
})
|
|
16944
|
+
);
|
|
16945
|
+
this.add(edges);
|
|
16946
|
+
}
|
|
16947
|
+
dispose() {
|
|
16948
|
+
super.dispose();
|
|
16949
|
+
this.line.onChange = void 0;
|
|
16950
|
+
this.clear();
|
|
16951
|
+
}
|
|
16952
|
+
}
|
|
16953
|
+
class LineAlignmentGuide extends Lines {
|
|
16954
|
+
start = new Vector3();
|
|
16955
|
+
end = new Vector3();
|
|
16956
|
+
constructor() {
|
|
16957
|
+
super();
|
|
16958
|
+
this.continuous = false;
|
|
16959
|
+
}
|
|
16960
|
+
set(line2, points = []) {
|
|
16961
|
+
this.clear();
|
|
16962
|
+
const step = line2.start.leftNormal(line2.end).multiplyScalar(0.4);
|
|
16963
|
+
let start = line2.start.clone().add(step);
|
|
16964
|
+
let end = line2.end.clone().add(step);
|
|
16965
|
+
this.start.copy(start.toJson());
|
|
16966
|
+
this.end.copy(end.toJson());
|
|
16967
|
+
points.forEach((p) => p.add(step));
|
|
16968
|
+
step.normalize();
|
|
16969
|
+
for (let i = 0; i < points.length + 1; i++) {
|
|
16970
|
+
const point = i === points.length ? end : points[i];
|
|
16971
|
+
const pre = i === 0 ? start : points[i - 1];
|
|
16972
|
+
const dist = Number((point.distance(pre) * 1e3).toFixed(0));
|
|
16973
|
+
const center = point.clone().add(pre).multiplyScalar(0.5);
|
|
16974
|
+
if (dist > 0) {
|
|
16975
|
+
this.createText(dist, center, {
|
|
16976
|
+
padding: "1px 0px",
|
|
16977
|
+
background: "#fff",
|
|
16978
|
+
width: "35px",
|
|
16979
|
+
color: "#000",
|
|
16980
|
+
textAlign: "center",
|
|
16981
|
+
borderRadius: "6px"
|
|
16982
|
+
});
|
|
16983
|
+
}
|
|
16984
|
+
}
|
|
16985
|
+
this.setPoint(
|
|
16986
|
+
this.start,
|
|
16987
|
+
this.end,
|
|
16988
|
+
...points.concat([start, end]).flatMap((p) => {
|
|
16989
|
+
const line22 = p.expandAsLine(step, 0.1).translate(-0.05, step);
|
|
16990
|
+
const line222 = line22.clone().rotate(Math.PI * 0.25);
|
|
16991
|
+
return [
|
|
16992
|
+
...line22.points.map((p2) => p2.toVector3()),
|
|
16993
|
+
...line222.points.map((p2) => p2.toVector3())
|
|
16994
|
+
];
|
|
16995
|
+
})
|
|
16996
|
+
);
|
|
16997
|
+
}
|
|
16998
|
+
/**
|
|
16999
|
+
* 创建文本
|
|
17000
|
+
* @param text
|
|
17001
|
+
* @param pos
|
|
17002
|
+
* @param style
|
|
17003
|
+
*/
|
|
17004
|
+
createText(text, pos, style) {
|
|
17005
|
+
const div = document.createElement("div");
|
|
17006
|
+
div.innerHTML = text;
|
|
17007
|
+
div.style.pointerEvents = "none";
|
|
17008
|
+
Object.assign(div.style, { fontSize: "10px", color: "#ffffff", ...style });
|
|
17009
|
+
const css2DObject = new CSS2DObject(div);
|
|
17010
|
+
if (pos instanceof Point) css2DObject.position.set(pos.x, pos.y, 0);
|
|
17011
|
+
else if (pos instanceof Vector3) css2DObject.position.copy(pos);
|
|
17012
|
+
this.add(css2DObject);
|
|
17013
|
+
return css2DObject;
|
|
17014
|
+
}
|
|
17015
|
+
}
|
|
17016
|
+
class DrawHole extends CommandFlowComponent {
|
|
17017
|
+
static name = "DrawHole";
|
|
17018
|
+
container = new THREE.Group();
|
|
17019
|
+
static shortcutKeys = ["h"];
|
|
17020
|
+
static commandName = "draw-hole";
|
|
17021
|
+
defaultWidth = 1;
|
|
17022
|
+
onAddFromParent(parent2) {
|
|
17023
|
+
super.onAddFromParent(parent2);
|
|
17024
|
+
this.editor.container.add(this.container);
|
|
17025
|
+
this.initCommandFlow({
|
|
17026
|
+
shortcutKeys: this.shortcutKeys,
|
|
17027
|
+
commandName: DrawHole.commandName,
|
|
17028
|
+
loop: true
|
|
17029
|
+
}).add(this.createCursor("no-drop")).add(this.selectLine.bind(this), { prompt: `请选择一条线段作为空洞依附墙体, ${this.formatText("TAB")} 修改孔洞默认宽度, ${this.formatText("ESC")} 取消命令` });
|
|
17030
|
+
}
|
|
17031
|
+
/** 选择开始点
|
|
17032
|
+
* @param next
|
|
17033
|
+
*/
|
|
17034
|
+
async selectLine(next) {
|
|
17035
|
+
const holeLine = LineSegment.axisY(this.defaultWidth), wall = new Wall2D(holeLine), lineAlignmentGuide = new LineAlignmentGuide();
|
|
17036
|
+
wall.visible = false;
|
|
17037
|
+
lineAlignmentGuide.visible = false;
|
|
17038
|
+
this.container.add(wall);
|
|
17039
|
+
this.container.add(lineAlignmentGuide);
|
|
17040
|
+
wall.position.z = 0.01;
|
|
17041
|
+
const selector = this.createLineSelector({
|
|
17042
|
+
onMove: (line2, result) => {
|
|
17043
|
+
wall.position.set(result.point.x, result.point.y, wall.position.z);
|
|
17044
|
+
LineSegment.axisY(this.defaultWidth, holeLine);
|
|
17045
|
+
let angle2 = 0;
|
|
17046
|
+
if (line2) {
|
|
17047
|
+
angle2 = LineSegment.angleToYAxis(line2);
|
|
17048
|
+
if (line2.length < holeLine.length) {
|
|
17049
|
+
holeLine.setLength(line2.length);
|
|
17050
|
+
wall.position.set(line2.center.x, line2.center.y, wall.position.z);
|
|
17051
|
+
} else {
|
|
17052
|
+
const ratioHalf = holeLine.length / line2.length * 0.5;
|
|
17053
|
+
const v = Math.min(
|
|
17054
|
+
1 - ratioHalf,
|
|
17055
|
+
Math.max(ratioHalf, line2.projectPointValue(result.point))
|
|
17056
|
+
);
|
|
17057
|
+
const p = line2.pointAt(v);
|
|
17058
|
+
wall.position.set(p.x, p.y, wall.position.z);
|
|
17059
|
+
}
|
|
17060
|
+
let direction = line2.direction();
|
|
17061
|
+
const hole = Point.from(wall.position).expandAsLine(direction, holeLine.length).translate(-holeLine.length * 0.5, direction);
|
|
17062
|
+
lineAlignmentGuide.set(line2, hole.points);
|
|
17063
|
+
lineAlignmentGuide.visible = true;
|
|
17064
|
+
} else lineAlignmentGuide.visible = false;
|
|
17065
|
+
wall.rotation.z = -angle2;
|
|
17066
|
+
wall.visible = true;
|
|
17067
|
+
}
|
|
17068
|
+
});
|
|
17069
|
+
selector.awaitEach("wall", (line2) => {
|
|
17070
|
+
next({
|
|
17071
|
+
line: line2,
|
|
17072
|
+
insertObject: {
|
|
17073
|
+
width: holeLine.length,
|
|
17074
|
+
p: { x: wall.position.x, y: wall.position.y, z: 0 },
|
|
17075
|
+
full: false
|
|
17076
|
+
}
|
|
17077
|
+
});
|
|
17078
|
+
});
|
|
17079
|
+
this.addCommandEndHandle().add(() => {
|
|
17080
|
+
lineAlignmentGuide.clear();
|
|
17081
|
+
this.container.remove(wall);
|
|
17082
|
+
this.container.remove(lineAlignmentGuide);
|
|
17083
|
+
selector.end();
|
|
17084
|
+
});
|
|
17085
|
+
this.awaitOnlyKeys(["tab"], { once: false }).awaitEach(async () => {
|
|
17086
|
+
selector.paused();
|
|
17087
|
+
const w = await this.openWidthEditor({
|
|
17088
|
+
defaultWidth: this.defaultWidth * 1e3,
|
|
17089
|
+
title: "请输入宽度"
|
|
17090
|
+
});
|
|
17091
|
+
this.defaultWidth = w / 1e3;
|
|
17092
|
+
selector.resume();
|
|
17093
|
+
});
|
|
17094
|
+
}
|
|
17095
|
+
/** 执行完成
|
|
17096
|
+
*/
|
|
17097
|
+
onCompleted(data) {
|
|
17098
|
+
WallInsertObject.addInsertObject(data.line, data.insertObject, "passageEntrance");
|
|
17099
|
+
this.renderManager.draw();
|
|
17100
|
+
}
|
|
17101
|
+
/** 回滚操作
|
|
17102
|
+
* @param data
|
|
17103
|
+
*/
|
|
17104
|
+
onRollback(data) {
|
|
17105
|
+
WallInsertObject.removeInsertObject(data.line, data.insertObject);
|
|
17106
|
+
this.renderManager.draw();
|
|
17107
|
+
return data;
|
|
17108
|
+
}
|
|
17109
|
+
/** 撤回回滚
|
|
17110
|
+
* @param data
|
|
17111
|
+
* @returns
|
|
17112
|
+
*/
|
|
17113
|
+
onRevokeRollback(data) {
|
|
17114
|
+
this.onCompleted(data);
|
|
17115
|
+
return data;
|
|
17116
|
+
}
|
|
17117
|
+
}
|
|
16571
17118
|
const _hoisted_1$1 = {
|
|
16572
17119
|
key: 0,
|
|
16573
17120
|
class: "max-w-[150px] min-w-[150px p-[5px] editorToolContent"
|
|
@@ -16684,7 +17231,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16684
17231
|
queueMicrotask(() => variable.set("currentKeyUp", "enter"));
|
|
16685
17232
|
}
|
|
16686
17233
|
const props = __props;
|
|
16687
|
-
const dxfVisible = ref(true), currentCommand = ref(""), dxfSystem = toRaw(props.dxfSystem), isPc = computed(() => !isMobileRef.value), domEventRegister = dxfSystem.findComponentByType(DomEventRegister), domContainer = dxfSystem.findComponentByType(DomContainer), editor = dxfSystem.findComponentByType(Editor), defaultComponent = dxfSystem.findComponentByType(
|
|
17234
|
+
const dxfVisible = ref(true), currentCommand = ref(""), dxfSystem = toRaw(props.dxfSystem), isPc = computed(() => !isMobileRef.value), domEventRegister = dxfSystem.findComponentByType(DomEventRegister), domContainer = dxfSystem.findComponentByType(DomContainer), editor = dxfSystem.findComponentByType(Editor), defaultComponent = dxfSystem.findComponentByType(DefaultCommand), 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 = [
|
|
16688
17235
|
{
|
|
16689
17236
|
command: "default",
|
|
16690
17237
|
name: "默认",
|
|
@@ -16713,6 +17260,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
16713
17260
|
src: images["../assets/images/window.svg"].default,
|
|
16714
17261
|
shortcut: DrawWindow.shortcutKeys.join(" + ")
|
|
16715
17262
|
},
|
|
17263
|
+
{
|
|
17264
|
+
command: DrawHole.commandName,
|
|
17265
|
+
name: "绘制孔洞",
|
|
17266
|
+
show: true,
|
|
17267
|
+
src: images["../assets/images/window.svg"].default,
|
|
17268
|
+
shortcut: DrawHole.shortcutKeys.join(" + ")
|
|
17269
|
+
},
|
|
16716
17270
|
{
|
|
16717
17271
|
command: "point",
|
|
16718
17272
|
name: "修改模式",
|
|
@@ -17308,7 +17862,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
17308
17862
|
};
|
|
17309
17863
|
}
|
|
17310
17864
|
});
|
|
17311
|
-
const EditorToolContent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
17865
|
+
const EditorToolContent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b8090cfc"]]);
|
|
17312
17866
|
class StorageHelper {
|
|
17313
17867
|
static get(key, defaultValue = void 0) {
|
|
17314
17868
|
const value = localStorage.getItem(key);
|
|
@@ -17571,7 +18125,7 @@ class Editor extends Component {
|
|
|
17571
18125
|
function Editor_(dxfSystem, option = {}) {
|
|
17572
18126
|
dxfSystem.addComponent(new Editor(option.viewPermission));
|
|
17573
18127
|
dxfSystem.addComponent(new RenderManager());
|
|
17574
|
-
dxfSystem.addComponent(new
|
|
18128
|
+
dxfSystem.addComponent(new DefaultCommand());
|
|
17575
18129
|
dxfSystem.addComponent(new DrawLine());
|
|
17576
18130
|
dxfSystem.addComponent(new DrawDoorLine());
|
|
17577
18131
|
dxfSystem.addComponent(new DrawWindow());
|
|
@@ -17589,6 +18143,7 @@ function Editor_(dxfSystem, option = {}) {
|
|
|
17589
18143
|
dxfSystem.addComponent(new PropertiesPanel());
|
|
17590
18144
|
dxfSystem.addComponent(new RayDistance());
|
|
17591
18145
|
dxfSystem.addComponent(new ManualDistance());
|
|
18146
|
+
dxfSystem.addComponent(new DrawHole());
|
|
17592
18147
|
}
|
|
17593
18148
|
const EditorPlugin = Object.assign(Editor_, {
|
|
17594
18149
|
create(option = {}) {
|