@loafacto/ui 0.23.1 → 0.24.0

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/dist/map3d.js CHANGED
@@ -1,9 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { defineComponent, ref, shallowRef, computed, onMounted, onBeforeUnmount, watch, openBlock, createElementBlock, createElementVNode, createBlock, createCommentVNode, createVNode } from "vue";
5
- import { f as LfSelect, e as LfSegmented, c as LfIconButton, _ as _export_sfc } from "./LfSegmented-CvGl-0vv.js";
6
- import { WebGLRenderer, LinearSRGBColorSpace, PCFSoftShadowMap, Vector3, Scene, OrthographicCamera, PerspectiveCamera, HemisphereLight, DirectionalLight, Group, MeshBasicMaterial, LineBasicMaterial, MeshStandardMaterial, DoubleSide, RingGeometry, MOUSE, TOUCH, Box3, LineSegments, LineLoop, Mesh, BoxGeometry, EdgesGeometry, BufferGeometry, Float32BufferAttribute, Vector2, Shape, ShapeGeometry, Raycaster, Color } from "three";
4
+ import { defineComponent, ref, shallowRef, computed, onMounted, onBeforeUnmount, watch, openBlock, createElementBlock, createElementVNode, createBlock, createCommentVNode, createVNode, toDisplayString, createTextVNode, Fragment, renderList, unref, normalizeClass, normalizeStyle, withCtx } from "vue";
5
+ import { e as LfSelect, b as LfIconButton, _ as _export_sfc, f as LfTextField } from "./LfSelect-BrK4QbUk.js";
6
+ import { a as LfSegmented, L as LfAlert } from "./LfSegmented-D2zAGi24.js";
7
+ import { Matrix4, MeshStandardMaterial, Group, Mesh, LineSegments, EdgesGeometry, Vector3, Color, LinearSRGBColorSpace, CylinderGeometry, BoxGeometry, ExtrudeGeometry, Shape, WebGLRenderer, PCFSoftShadowMap, Scene, OrthographicCamera, PerspectiveCamera, HemisphereLight, DirectionalLight, MeshBasicMaterial, LineBasicMaterial, DoubleSide, RingGeometry, MOUSE, TOUCH, Box3, LineLoop, BufferGeometry, Float32BufferAttribute, Vector2, ShapeGeometry, Raycaster, PlaneGeometry } from "three";
7
8
  import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
8
9
  import { mergeGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js";
9
10
  function parseColor(value) {
@@ -77,6 +78,212 @@ function colorOf(theme, item, fallback) {
77
78
  if (c) return toHex(c);
78
79
  return item.tone ? theme.tones[item.tone] : fallback;
79
80
  }
81
+ const MODEL_SHAPES = ["rbox", "box", "cyl"];
82
+ const MODEL_MATERIALS = ["body", "dark", "accent", "metal", "wood", "card", "bin", "glass"];
83
+ const MODEL_SHAPE_LABEL = { rbox: "둥근 상자", box: "상자", cyl: "원기둥" };
84
+ const MODEL_MATERIAL_LABEL = {
85
+ body: "몸체",
86
+ dark: "어두운 면",
87
+ accent: "강조",
88
+ metal: "금속",
89
+ wood: "나무",
90
+ card: "종이 상자",
91
+ bin: "통",
92
+ glass: "유리"
93
+ };
94
+ const col$2 = (hex) => typeof hex === "number" ? new Color().setHex(hex, LinearSRGBColorSpace) : new Color().setStyle(hex, LinearSRGBColorSpace);
95
+ function roundedRect(w, d, r) {
96
+ r = Math.max(1e-3, Math.min(r, w / 2 - 1e-3, d / 2 - 1e-3));
97
+ const s = new Shape();
98
+ const x = -w / 2;
99
+ const y = -d / 2;
100
+ s.moveTo(x + r, y);
101
+ s.lineTo(x + w - r, y);
102
+ s.quadraticCurveTo(x + w, y, x + w, y + r);
103
+ s.lineTo(x + w, y + d - r);
104
+ s.quadraticCurveTo(x + w, y + d, x + w - r, y + d);
105
+ s.lineTo(x + r, y + d);
106
+ s.quadraticCurveTo(x, y + d, x, y + d - r);
107
+ s.lineTo(x, y + r);
108
+ s.quadraticCurveTo(x, y, x + r, y);
109
+ return s;
110
+ }
111
+ function roundedBox(w, h, d, r, b) {
112
+ const bs = Math.min(b, h / 3, w / 4, d / 4);
113
+ const g = new ExtrudeGeometry(roundedRect(w - 2 * bs, d - 2 * bs, r - bs), {
114
+ depth: Math.max(1e-3, h - 2 * bs),
115
+ bevelEnabled: true,
116
+ bevelThickness: bs,
117
+ bevelSize: bs,
118
+ bevelSegments: 2,
119
+ curveSegments: 6
120
+ });
121
+ g.rotateX(-Math.PI / 2);
122
+ g.translate(0, bs, 0);
123
+ return g;
124
+ }
125
+ function partGeometry(p) {
126
+ const [w, h, d] = p.size;
127
+ const g = p.shape === "cyl" ? new CylinderGeometry(w / 2, w / 2, h, 24).translate(0, h / 2, 0) : p.shape === "rbox" ? roundedBox(w, h, d, Math.min(0.08, Math.min(w, d) / 4), Math.min(0.012, h / 4)) : new BoxGeometry(w, h, d).translate(0, h / 2, 0);
128
+ g.applyMatrix4(new Matrix4().makeRotationY((p.rotY ?? 0) * Math.PI / 180).setPosition(p.pos[0], p.pos[1], p.pos[2]));
129
+ for (const k of Object.keys(g.attributes)) if (k !== "position" && k !== "normal") g.deleteAttribute(k);
130
+ return g.index ? g.toNonIndexed() : g;
131
+ }
132
+ class ModelMaterials {
133
+ constructor(theme) {
134
+ __publicField(this, "base", {
135
+ body: new MeshStandardMaterial({ roughness: 0.55, metalness: 0.05 }),
136
+ dark: new MeshStandardMaterial({ color: col$2(3817800), roughness: 0.6 }),
137
+ accent: new MeshStandardMaterial({ roughness: 0.5, metalness: 0.05 }),
138
+ metal: new MeshStandardMaterial({ color: col$2(9213342), roughness: 0.35, metalness: 0.55 }),
139
+ wood: new MeshStandardMaterial({ color: col$2(12158799), roughness: 0.9 }),
140
+ card: new MeshStandardMaterial({ color: col$2(13213802), roughness: 0.85 }),
141
+ bin: new MeshStandardMaterial({ color: col$2(4156316), roughness: 0.6 }),
142
+ glass: new MeshStandardMaterial({ color: col$2(12375014), roughness: 0.15, metalness: 0.1, transparent: true, opacity: 0.4, depthWrite: false })
143
+ });
144
+ __publicField(this, "custom", /* @__PURE__ */ new Map());
145
+ if (theme) this.setTheme(theme);
146
+ }
147
+ setTheme(theme) {
148
+ this.base.body.color = col$2(theme.object);
149
+ this.base.accent.color = col$2(theme.tones.warning);
150
+ }
151
+ of(p) {
152
+ if (!p.color) return this.base[p.material] ?? this.base.body;
153
+ const k = `${p.material}:${p.color}`;
154
+ let m = this.custom.get(k);
155
+ if (!m) {
156
+ m = (this.base[p.material] ?? this.base.body).clone();
157
+ m.color = col$2(p.color);
158
+ this.custom.set(k, m);
159
+ }
160
+ return m;
161
+ }
162
+ dispose() {
163
+ Object.values(this.base).forEach((m) => m.dispose());
164
+ this.custom.forEach((m) => m.dispose());
165
+ this.custom.clear();
166
+ }
167
+ }
168
+ const moves = (m) => {
169
+ var _a;
170
+ return !!m && ((((_a = m.path) == null ? void 0 : _a.length) ?? 0) >= 2 || !!m.spin);
171
+ };
172
+ function buildModel(model, mats, edgeMat, opts = {}) {
173
+ const out = new Group();
174
+ const byMat = /* @__PURE__ */ new Map();
175
+ const edges = [];
176
+ model.parts.forEach((p, i) => {
177
+ const g = partGeometry(p);
178
+ const m = mats.of(p);
179
+ if (opts.separate || moves(p.motion)) {
180
+ const mesh = new Mesh(g, m);
181
+ mesh.castShadow = p.material !== "glass";
182
+ mesh.receiveShadow = true;
183
+ mesh.userData.part = i;
184
+ if (moves(p.motion)) {
185
+ mesh.matrixAutoUpdate = false;
186
+ mesh.userData.motion = p.motion;
187
+ mesh.userData.centre = p.pos;
188
+ }
189
+ if (p.material !== "glass") {
190
+ const e = new LineSegments(new EdgesGeometry(g, 30), edgeMat);
191
+ e.name = "edges";
192
+ e.raycast = () => void 0;
193
+ mesh.add(e);
194
+ }
195
+ out.add(mesh);
196
+ return;
197
+ }
198
+ byMat.set(m, [...byMat.get(m) ?? [], g]);
199
+ if (p.material !== "glass") edges.push(new EdgesGeometry(g, 30));
200
+ });
201
+ for (const [m, list] of byMat) {
202
+ const merged = list.length === 1 ? list[0] : mergeGeometries(list, false);
203
+ if (list.length > 1) list.forEach((g) => g.dispose());
204
+ const mesh = new Mesh(merged, m);
205
+ mesh.castShadow = m !== mats.base.glass;
206
+ mesh.receiveShadow = true;
207
+ out.add(mesh);
208
+ }
209
+ if (edges.length) {
210
+ const merged = edges.length === 1 ? edges[0] : mergeGeometries(edges, false);
211
+ if (edges.length > 1) edges.forEach((g) => g.dispose());
212
+ const e = new LineSegments(merged, edgeMat);
213
+ e.name = "edges";
214
+ e.raycast = () => void 0;
215
+ out.add(e);
216
+ }
217
+ return out;
218
+ }
219
+ function disposeModel(g) {
220
+ g.traverse((o) => {
221
+ const geo = o.geometry;
222
+ geo == null ? void 0 : geo.dispose();
223
+ });
224
+ }
225
+ const modelMoves = (model) => model.parts.some((p) => moves(p.motion));
226
+ const ease$1 = (u) => u < 0.5 ? 2 * u * u : 1 - 2 * (1 - u) * (1 - u);
227
+ function motionMatrix(m, centre, t, out = new Matrix4()) {
228
+ out.identity();
229
+ const path = m.path ?? [];
230
+ if (path.length >= 2) {
231
+ const period = m.periodS ?? 10;
232
+ const u = ((t / period + (m.phase ?? 0)) % 1 + 1) % 1;
233
+ const n = path.length;
234
+ const k = u * n;
235
+ const i = Math.floor(k) % n;
236
+ const a = path[i];
237
+ const b = path[(i + 1) % n];
238
+ const e = ease$1(k - Math.floor(k));
239
+ out.makeTranslation(a[0] + (b[0] - a[0]) * e, a[1] + (b[1] - a[1]) * e, a[2] + (b[2] - a[2]) * e);
240
+ }
241
+ if (m.spin) {
242
+ const c = new Vector3(centre[0], 0, centre[2]);
243
+ out.multiply(
244
+ new Matrix4().makeTranslation(c.x, 0, c.z).multiply(new Matrix4().makeRotationY(m.spin * Math.PI / 180 * t)).multiply(new Matrix4().makeTranslation(-c.x, 0, -c.z))
245
+ );
246
+ }
247
+ return out;
248
+ }
249
+ function animateModel(g, t) {
250
+ const tmp = new Matrix4();
251
+ g.traverse((o) => {
252
+ const m = o.userData.motion;
253
+ if (!m) return;
254
+ motionMatrix(m, o.userData.centre, t, tmp);
255
+ o.matrix.copy(tmp);
256
+ o.matrixWorldNeedsUpdate = true;
257
+ });
258
+ }
259
+ function defaultModel(footprint, height) {
260
+ const { w, h } = footprint;
261
+ const H = Math.max(0.1, height);
262
+ const base = Math.min(0.12, H / 5);
263
+ return {
264
+ footprint: { w, h },
265
+ height: H,
266
+ parts: [
267
+ { name: "받침", shape: "rbox", size: [w, base, h], pos: [0, 0, 0], material: "dark" },
268
+ { name: "몸체", shape: "rbox", size: [Math.max(0.05, w - 0.06), Math.max(0.05, H - base - 0.05), Math.max(0.05, h - 0.06)], pos: [0, base, 0], material: "body" },
269
+ { name: "띠", shape: "box", size: [Math.max(0.05, w - 0.04), 0.05, Math.max(0.05, h - 0.04)], pos: [0, H - 0.05, 0], material: "accent" }
270
+ ]
271
+ };
272
+ }
273
+ function modelProblems(model) {
274
+ const out = [];
275
+ if (!model.parts.length) out.push("부품이 하나도 없습니다");
276
+ if (model.parts.length > 300) out.push("부품이 300 개를 넘습니다");
277
+ if (!(model.footprint.w >= 0.05 && model.footprint.h >= 0.05)) out.push("바닥 크기가 너무 작습니다(0.05 m 이상)");
278
+ if (!(model.height >= 0.01 && model.height <= 50)) out.push("높이는 0.01 ~ 50 m 여야 합니다");
279
+ model.parts.forEach((p, i) => {
280
+ const n = p.name ? `${i + 1}번(${p.name})` : `${i + 1}번`;
281
+ if (p.size.some((v) => !(v >= 5e-3 && v <= 100))) out.push(`${n} 부품: 크기는 0.005 ~ 100 m 여야 합니다`);
282
+ if (p.pos.some((v) => !(Math.abs(v) <= 100))) out.push(`${n} 부품: 위치가 너무 멉니다(±100 m)`);
283
+ if (p.color && !/^#[0-9a-fA-F]{6}$/.test(p.color)) out.push(`${n} 부품: 색은 #rrggbb 꼴이어야 합니다`);
284
+ });
285
+ return out;
286
+ }
80
287
  const ISO_ELEVATION = Math.asin(1 / Math.sqrt(3));
81
288
  const UP = new Vector3(0, 1, 0);
82
289
  const SLAB = 0.14;
@@ -85,7 +292,7 @@ const MOVER_SIZE = { w: 0.9, h: 0.7, height: 0.45 };
85
292
  const dirFrom = (az, el) => new Vector3(Math.cos(el) * Math.sin(az), Math.sin(el), Math.cos(el) * Math.cos(az));
86
293
  const ease = (k) => k < 0.5 ? 4 * k * k * k : 1 - Math.pow(-2 * k + 2, 3) / 2;
87
294
  const toWorld = (x, y, elevation = 0) => new Vector3(x, elevation, -y);
88
- const col = (hex) => new Color().setHex(hex, LinearSRGBColorSpace);
295
+ const col$1 = (hex) => new Color().setHex(hex, LinearSRGBColorSpace);
89
296
  function strip(out, ax, az, bx, bz, half, y) {
90
297
  const len = Math.hypot(bx - ax, bz - az);
91
298
  if (len < 1e-3) return;
@@ -168,6 +375,10 @@ class MapScene {
168
375
  ring: new MeshBasicMaterial({ side: DoubleSide, transparent: true, opacity: 0.9, depthWrite: false })
169
376
  });
170
377
  __publicField(this, "objectMats", /* @__PURE__ */ new Map());
378
+ /** 오브젝트 모델의 재질(몸체 · 강조색은 테마를 따른다) */
379
+ __publicField(this, "modelMats", new ModelMaterials());
380
+ /** 움직이는 부품이 있는 모델 — 매 프레임 animateModel */
381
+ __publicField(this, "animated", []);
171
382
  __publicField(this, "ringGeo", new RingGeometry(0.62, 0.78, 40).rotateX(-Math.PI / 2));
172
383
  // --- 고르기 ---------------------------------------------------------------------------------------------------------
173
384
  __publicField(this, "onWheel", () => {
@@ -193,6 +404,7 @@ class MapScene {
193
404
  const dt = Math.min(0.1, (now - this.clock) / 1e3);
194
405
  this.clock = now;
195
406
  this.stepMovers(dt);
407
+ if (this.animated.length && !this.reduce) for (const g of this.animated) animateModel(g, now / 1e3);
196
408
  if (this.tween) this.tween(now);
197
409
  else {
198
410
  if (this.follow) {
@@ -552,15 +764,16 @@ class MapScene {
552
764
  this.scene.background = null;
553
765
  this.hemi.intensity = (theme.dark ? 0.62 : 0.78) * Math.PI;
554
766
  this.sun.intensity = (theme.dark ? 0.75 : 0.85) * Math.PI;
555
- this.mats.floor.color = col(theme.floor);
556
- this.mats.grid.color = col(theme.grid);
767
+ this.mats.floor.color = col$1(theme.floor);
768
+ this.mats.grid.color = col$1(theme.grid);
557
769
  this.mats.grid.opacity = theme.dark ? 0.55 : 0.75;
558
- this.mats.lane.color = col(theme.lane);
559
- this.mats.wall.color = col(theme.wall);
560
- this.mats.edge.color = col(theme.edge);
770
+ this.mats.lane.color = col$1(theme.lane);
771
+ this.mats.wall.color = col$1(theme.wall);
772
+ this.mats.edge.color = col$1(theme.edge);
561
773
  this.mats.edge.opacity = theme.dark ? 0.5 : 0.28;
562
- this.mats.select.color = col(theme.select);
563
- this.mats.ring.color = col(theme.select);
774
+ this.mats.select.color = col$1(theme.select);
775
+ this.mats.ring.color = col$1(theme.select);
776
+ this.modelMats.setTheme(theme);
564
777
  for (const m of this.objectMats.values()) m.dispose();
565
778
  this.objectMats.clear();
566
779
  if (this.doc) this.setDoc(this.doc, true);
@@ -586,6 +799,7 @@ class MapScene {
586
799
  for (const f of this.floors.values()) this.root.remove(f.group);
587
800
  this.owned.forEach((o) => o.dispose());
588
801
  this.owned = [];
802
+ this.animated = [];
589
803
  this.floors.clear();
590
804
  this.zones.clear();
591
805
  this.objects.clear();
@@ -593,7 +807,7 @@ class MapScene {
593
807
  objectMat(hex) {
594
808
  let m = this.objectMats.get(hex);
595
809
  if (!m) {
596
- m = new MeshStandardMaterial({ color: col(hex), roughness: 0.7, metalness: 0.05 });
810
+ m = new MeshStandardMaterial({ color: col$1(hex), roughness: 0.7, metalness: 0.05 });
597
811
  this.objectMats.set(hex, m);
598
812
  }
599
813
  return m;
@@ -604,6 +818,7 @@ class MapScene {
604
818
  return e;
605
819
  }
606
820
  buildFloor(f) {
821
+ var _a, _b;
607
822
  const g = new Group();
608
823
  g.name = `floor:${f.id}`;
609
824
  const elevation = f.elevation ?? 0;
@@ -683,21 +898,69 @@ class MapScene {
683
898
  }
684
899
  for (const z of f.zones ?? []) this.buildZone(g, f.id, z);
685
900
  for (const o of f.objects ?? []) {
686
- const height = o.height ?? 1;
901
+ const model = typeof o.model === "string" ? (_b = (_a = this.doc) == null ? void 0 : _a.models) == null ? void 0 : _b[o.model] : o.model;
902
+ const height = o.height ?? (model == null ? void 0 : model.height) ?? 1;
687
903
  const holder = new Group();
688
904
  holder.userData.pick = { kind: "object", id: o.id, name: o.name };
689
905
  const p = toWorld(o.x, o.y);
690
906
  holder.position.set(p.x, 0, p.z);
691
907
  holder.rotation.y = (o.rotation ?? 0) * Math.PI / 180;
692
- const geo = this.own(new BoxGeometry(o.w, height, o.h).translate(0, height / 2, 0));
693
- const box = new Mesh(geo, this.objectMat(colorOf(this.theme, o, this.theme.object)));
694
- box.castShadow = true;
695
- box.receiveShadow = true;
696
- box.add(this.outline(geo));
697
- holder.add(box);
908
+ if (model && model.parts.length && model.footprint.w > 0 && model.footprint.h > 0 && model.height > 0) {
909
+ const shape = buildModel(model, this.modelMats, this.mats.edge);
910
+ shape.scale.set(o.w / model.footprint.w, height / model.height, o.h / model.footprint.h);
911
+ this.own({ dispose: () => disposeModel(shape) });
912
+ if (modelMoves(model)) this.animated.push(shape);
913
+ holder.add(shape);
914
+ } else {
915
+ const geo = this.own(new BoxGeometry(o.w, height, o.h).translate(0, height / 2, 0));
916
+ const box = new Mesh(geo, this.objectMat(colorOf(this.theme, o, this.theme.object)));
917
+ box.castShadow = true;
918
+ box.receiveShadow = true;
919
+ box.add(this.outline(geo));
920
+ holder.add(box);
921
+ }
698
922
  g.add(holder);
699
923
  this.objects.set(o.id, { group: holder, floorId: f.id, w: o.w, h: o.h, height });
700
924
  }
925
+ this.buildExtras(g, f);
926
+ }
927
+ /**
928
+ * 서비스 고유의 것(MapExtra) — 맵은 뜻을 모르니 자리만 표시한다. 크기가 있으면 납작한 판, 없으면 기둥 표지
929
+ * (받침 원판 · 가는 기둥 · 머리). 고르기 · 다가가기는 설비와 같이 다룬다(objects 에 넣는다).
930
+ */
931
+ buildExtras(g, f) {
932
+ for (const e of f.extras ?? []) {
933
+ const holder = new Group();
934
+ holder.userData.pick = { kind: "extra", id: e.id, name: e.name };
935
+ const p = toWorld(e.x, e.y);
936
+ holder.position.set(p.x, 0, p.z);
937
+ holder.rotation.y = (e.rotation ?? 0) * Math.PI / 180;
938
+ const mat = this.objectMat(colorOf(this.theme, e, this.theme.tones.info));
939
+ let w = 0.6;
940
+ let h = 0.6;
941
+ let height = 1;
942
+ if (e.w && e.h) {
943
+ w = e.w;
944
+ h = e.h;
945
+ height = 0.06;
946
+ const geo = this.own(new BoxGeometry(e.w, 0.06, e.h).translate(0, 0.03, 0));
947
+ const plate = new Mesh(geo, mat);
948
+ plate.receiveShadow = true;
949
+ plate.add(this.outline(geo));
950
+ holder.add(plate);
951
+ } else {
952
+ const disc = this.own(new CylinderGeometry(0.3, 0.3, 0.06, 24).translate(0, 0.03, 0));
953
+ const pole = this.own(new CylinderGeometry(0.035, 0.035, 0.8, 8).translate(0, 0.46, 0));
954
+ const head = this.own(new CylinderGeometry(0.14, 0.14, 0.14, 16).translate(0, 0.93, 0));
955
+ for (const geo of [disc, pole, head]) {
956
+ const m = new Mesh(geo, mat);
957
+ m.castShadow = true;
958
+ holder.add(m);
959
+ }
960
+ }
961
+ g.add(holder);
962
+ this.objects.set(e.id, { group: holder, floorId: f.id, w, h, height });
963
+ }
701
964
  }
702
965
  buildZone(g, floorId, z) {
703
966
  if (z.polygon.length < 3) return;
@@ -718,10 +981,10 @@ class MapScene {
718
981
  }
719
982
  paintZone(v) {
720
983
  const on = this.selected === v.zone.id;
721
- const c = col(colorOf(this.theme, v.zone, this.theme.tones.info));
984
+ const c = col$1(colorOf(this.theme, v.zone, this.theme.tones.info));
722
985
  v.face.material.color = c;
723
986
  v.face.material.opacity = on ? 0.32 : 0.16;
724
- v.line.material.color = on ? col(this.theme.select) : c;
987
+ v.line.material.color = on ? col$1(this.theme.select) : c;
725
988
  v.line.material.opacity = on ? 1 : 0.75;
726
989
  }
727
990
  // --- 그리기: 표식 · 경로 --------------------------------------------------------------------------------------------
@@ -756,8 +1019,8 @@ class MapScene {
756
1019
  }
757
1020
  paintMover(v) {
758
1021
  const c = colorOf(this.theme, v.mover, this.theme.tones.info);
759
- v.body.material.color = col(this.theme.dark ? 3359061 : 16317180);
760
- v.stripe.material.color = col(c);
1022
+ v.body.material.color = col$1(this.theme.dark ? 3359061 : 16317180);
1023
+ v.stripe.material.color = col$1(c);
761
1024
  v.tag.style.setProperty("--lf-map3d-tag-dot", `#${c.toString(16).padStart(6, "0")}`);
762
1025
  }
763
1026
  /** 표식의 목표 자리. instant 면 바로 그 자리로(처음 · 층 바꿈). */
@@ -816,7 +1079,7 @@ class MapScene {
816
1079
  }
817
1080
  if (!out.length) continue;
818
1081
  const geo = flat(out);
819
- const mat = new MeshBasicMaterial({ color: col(colorOf(this.theme, r, this.theme.select)), transparent: true, opacity: r.dashed ? 0.55 : 0.75, side: DoubleSide, depthWrite: false });
1082
+ const mat = new MeshBasicMaterial({ color: col$1(colorOf(this.theme, r, this.theme.select)), transparent: true, opacity: r.dashed ? 0.55 : 0.75, side: DoubleSide, depthWrite: false });
820
1083
  this.routeOwned.push(geo, mat);
821
1084
  const mesh = new Mesh(geo, mat);
822
1085
  mesh.renderOrder = 2;
@@ -843,7 +1106,7 @@ class MapScene {
843
1106
  const r = this.canvas.getBoundingClientRect();
844
1107
  const ray = new Raycaster();
845
1108
  ray.setFromCamera(new Vector2((clientX - r.left) / r.width * 2 - 1, -((clientY - r.top) / r.height) * 2 + 1), this.cam);
846
- const rank = (k) => k === "mover" ? 0 : k === "object" ? 1 : 2;
1109
+ const rank = (k) => k === "mover" ? 0 : k === "object" || k === "extra" ? 1 : 2;
847
1110
  let best = null;
848
1111
  for (const h of ray.intersectObjects([this.moverGroup, this.root], true)) {
849
1112
  if (!visible(h.object)) continue;
@@ -923,20 +1186,21 @@ class MapScene {
923
1186
  this.routeOwned.forEach((o) => o.dispose());
924
1187
  for (const m of Object.values(this.mats)) m.dispose();
925
1188
  for (const m of this.objectMats.values()) m.dispose();
1189
+ this.modelMats.dispose();
926
1190
  this.ringGeo.dispose();
927
1191
  this.hoverTag.remove();
928
1192
  this.renderer.dispose();
929
1193
  }
930
1194
  }
931
- const _hoisted_1 = {
1195
+ const _hoisted_1$2 = {
932
1196
  key: 0,
933
1197
  class: "lf-map3d__bar"
934
1198
  };
935
1199
  const ICON_ROTATE_LEFT = "M13,4.07V1L8.45,5.55L13,10V6.09C15.84,6.57 18,9.03 18,12C18,14.97 15.84,17.43 13,17.91V19.93C16.95,19.44 20,16.08 20,12C20,7.92 16.95,4.56 13,4.07M7.1,18.32C8.26,19.22 9.61,19.76 11,19.93V17.9C10.13,17.75 9.29,17.41 8.54,16.87L7.1,18.32M6.09,13H4.07C4.24,14.39 4.79,15.73 5.69,16.89L7.1,15.47C6.58,14.72 6.23,13.88 6.09,13M7.11,8.53L5.7,7.11C4.8,8.27 4.24,9.61 4.07,11H6.09C6.23,10.13 6.58,9.28 7.11,8.53Z";
936
1200
  const ICON_ROTATE_RIGHT = "M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z";
937
- const ICON_FIT = "M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z";
1201
+ const ICON_FIT$1 = "M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z";
938
1202
  const ALL = "__all__";
939
- const _sfc_main = /* @__PURE__ */ defineComponent({
1203
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
940
1204
  __name: "LfMap3d",
941
1205
  props: {
942
1206
  doc: {},
@@ -1110,7 +1374,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1110
1374
  class: "lf-map3d__labels",
1111
1375
  "aria-hidden": "true"
1112
1376
  }, null, 512),
1113
- __props.controls ? (openBlock(), createElementBlock("div", _hoisted_1, [
1377
+ __props.controls ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
1114
1378
  floorOptions.value.length > 1 ? (openBlock(), createBlock(LfSelect, {
1115
1379
  key: 0,
1116
1380
  "model-value": floorValue.value,
@@ -1148,7 +1412,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1148
1412
  })
1149
1413
  }, null, 8, ["label", "disabled"]),
1150
1414
  createVNode(LfIconButton, {
1151
- "icon-path": ICON_FIT,
1415
+ "icon-path": ICON_FIT$1,
1152
1416
  label: t.value.fit,
1153
1417
  size: "sm",
1154
1418
  onClick: _cache[2] || (_cache[2] = ($event) => {
@@ -1161,12 +1425,925 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1161
1425
  };
1162
1426
  }
1163
1427
  });
1164
- const LfMap3d = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bf869e20"]]);
1428
+ const LfMap3d = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-bf869e20"]]);
1429
+ const col = (hex) => new Color().setHex(hex, LinearSRGBColorSpace);
1430
+ class ModelScene {
1431
+ constructor(canvas, theme) {
1432
+ /** 부품을 눌렀다(순번), 빈 곳이면 null. 끌어 돌린 것은 누른 것이 아니다. */
1433
+ __publicField(this, "onPick", () => void 0);
1434
+ __publicField(this, "renderer");
1435
+ __publicField(this, "scene", new Scene());
1436
+ __publicField(this, "camera", new PerspectiveCamera(32, 1, 0.02, 500));
1437
+ __publicField(this, "controls");
1438
+ __publicField(this, "hemi", new HemisphereLight("#ffffff", "#8b9299", 1));
1439
+ __publicField(this, "sun", new DirectionalLight("#ffffff", 1));
1440
+ __publicField(this, "floorMat", new MeshStandardMaterial({ roughness: 0.95, metalness: 0 }));
1441
+ __publicField(this, "floor", new Mesh(new PlaneGeometry(1, 1).rotateX(-Math.PI / 2), this.floorMat));
1442
+ __publicField(this, "gridMat", new LineBasicMaterial({ transparent: true }));
1443
+ __publicField(this, "grid", null);
1444
+ __publicField(this, "edgeMat", new LineBasicMaterial({ transparent: true, opacity: 0.35 }));
1445
+ __publicField(this, "selectMat", new LineBasicMaterial({ depthTest: false, transparent: true }));
1446
+ __publicField(this, "mats", new ModelMaterials());
1447
+ __publicField(this, "shown", null);
1448
+ __publicField(this, "mark", null);
1449
+ __publicField(this, "model", null);
1450
+ __publicField(this, "selected", null);
1451
+ __publicField(this, "raf", 0);
1452
+ __publicField(this, "down", null);
1453
+ __publicField(this, "reduce", typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches);
1454
+ __publicField(this, "onDown", (e) => {
1455
+ this.down = new Vector2(e.clientX, e.clientY);
1456
+ });
1457
+ __publicField(this, "onUp", (e) => {
1458
+ const d = this.down;
1459
+ this.down = null;
1460
+ if (!d || d.distanceTo(new Vector2(e.clientX, e.clientY)) > 4) return;
1461
+ if (!this.shown) return this.onPick(null);
1462
+ const r = this.canvas.getBoundingClientRect();
1463
+ const ndc = new Vector2((e.clientX - r.left) / r.width * 2 - 1, -((e.clientY - r.top) / r.height) * 2 + 1);
1464
+ const ray = new Raycaster();
1465
+ ray.setFromCamera(ndc, this.camera);
1466
+ const hit = ray.intersectObjects(this.shown.children, true)[0];
1467
+ let o = (hit == null ? void 0 : hit.object) ?? null;
1468
+ while (o && o.userData.part === void 0) o = o.parent;
1469
+ this.onPick(o ? o.userData.part : null);
1470
+ });
1471
+ __publicField(this, "loop", () => {
1472
+ this.raf = requestAnimationFrame(this.loop);
1473
+ if (this.shown && this.model && modelMoves(this.model) && !this.reduce) animateModel(this.shown, performance.now() / 1e3);
1474
+ this.controls.update();
1475
+ this.renderer.render(this.scene, this.camera);
1476
+ });
1477
+ this.canvas = canvas;
1478
+ this.renderer = new WebGLRenderer({ canvas, antialias: true, alpha: true });
1479
+ this.renderer.outputColorSpace = LinearSRGBColorSpace;
1480
+ this.renderer.shadowMap.enabled = true;
1481
+ this.renderer.shadowMap.type = PCFSoftShadowMap;
1482
+ this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
1483
+ this.sun.castShadow = true;
1484
+ this.sun.shadow.mapSize.set(1024, 1024);
1485
+ this.sun.shadow.bias = -5e-4;
1486
+ this.sun.shadow.normalBias = 0.02;
1487
+ this.floor.receiveShadow = true;
1488
+ this.scene.add(this.hemi, this.sun, this.sun.target, this.floor);
1489
+ this.controls = new OrbitControls(this.camera, canvas);
1490
+ this.controls.enableDamping = true;
1491
+ this.controls.dampingFactor = 0.12;
1492
+ this.controls.maxPolarAngle = Math.PI / 2 - 0.04;
1493
+ canvas.addEventListener("pointerdown", this.onDown);
1494
+ canvas.addEventListener("pointerup", this.onUp);
1495
+ this.setTheme(theme);
1496
+ this.resize();
1497
+ this.loop();
1498
+ }
1499
+ /** 모델을 새로 그린다. keepView 면 카메라를 그대로 둔다(고치는 중에 화면이 튀지 않게). */
1500
+ setModel(model, keepView = false) {
1501
+ const first = !this.model;
1502
+ this.model = model;
1503
+ if (this.shown) {
1504
+ this.shown.removeFromParent();
1505
+ disposeModel(this.shown);
1506
+ this.shown = null;
1507
+ }
1508
+ if (model && model.parts.length) {
1509
+ this.shown = buildModel(model, this.mats, this.edgeMat, { separate: true });
1510
+ this.scene.add(this.shown);
1511
+ }
1512
+ this.layoutFloor();
1513
+ if (!keepView || first) this.frame();
1514
+ this.select(this.selected);
1515
+ }
1516
+ /** 부품 하나에 윤곽을 그린다(편집기에서 고른 부품). */
1517
+ select(part) {
1518
+ this.selected = part;
1519
+ if (this.mark) {
1520
+ this.mark.removeFromParent();
1521
+ this.mark.geometry.dispose();
1522
+ this.mark = null;
1523
+ }
1524
+ if (part === null || !this.shown) return;
1525
+ const mesh = this.shown.children.find((c) => c.userData.part === part);
1526
+ if (!mesh) return;
1527
+ const box = new Box3().setFromObject(mesh);
1528
+ if (box.isEmpty()) return;
1529
+ const pad = 0.01;
1530
+ box.expandByScalar(pad);
1531
+ const { min: a, max: b } = box;
1532
+ const p = [
1533
+ a.x,
1534
+ a.y,
1535
+ a.z,
1536
+ b.x,
1537
+ a.y,
1538
+ a.z,
1539
+ b.x,
1540
+ a.y,
1541
+ a.z,
1542
+ b.x,
1543
+ a.y,
1544
+ b.z,
1545
+ b.x,
1546
+ a.y,
1547
+ b.z,
1548
+ a.x,
1549
+ a.y,
1550
+ b.z,
1551
+ a.x,
1552
+ a.y,
1553
+ b.z,
1554
+ a.x,
1555
+ a.y,
1556
+ a.z,
1557
+ a.x,
1558
+ b.y,
1559
+ a.z,
1560
+ b.x,
1561
+ b.y,
1562
+ a.z,
1563
+ b.x,
1564
+ b.y,
1565
+ a.z,
1566
+ b.x,
1567
+ b.y,
1568
+ b.z,
1569
+ b.x,
1570
+ b.y,
1571
+ b.z,
1572
+ a.x,
1573
+ b.y,
1574
+ b.z,
1575
+ a.x,
1576
+ b.y,
1577
+ b.z,
1578
+ a.x,
1579
+ b.y,
1580
+ a.z,
1581
+ a.x,
1582
+ a.y,
1583
+ a.z,
1584
+ a.x,
1585
+ b.y,
1586
+ a.z,
1587
+ b.x,
1588
+ a.y,
1589
+ a.z,
1590
+ b.x,
1591
+ b.y,
1592
+ a.z,
1593
+ b.x,
1594
+ a.y,
1595
+ b.z,
1596
+ b.x,
1597
+ b.y,
1598
+ b.z,
1599
+ a.x,
1600
+ a.y,
1601
+ b.z,
1602
+ a.x,
1603
+ b.y,
1604
+ b.z
1605
+ ];
1606
+ const geo = new BufferGeometry();
1607
+ geo.setAttribute("position", new Float32BufferAttribute(p, 3));
1608
+ this.mark = new LineSegments(geo, this.selectMat);
1609
+ this.mark.renderOrder = 10;
1610
+ this.scene.add(this.mark);
1611
+ }
1612
+ /** 모델이 화면에 꽉 차게 — 비스듬히 내려다보는 처음 시점으로. */
1613
+ frame() {
1614
+ const m = this.model;
1615
+ const w = (m == null ? void 0 : m.footprint.w) ?? 1;
1616
+ const h = (m == null ? void 0 : m.footprint.h) ?? 1;
1617
+ const H = (m == null ? void 0 : m.height) ?? 1;
1618
+ const centre = new Vector3(0, H / 2, 0);
1619
+ const radius = Math.max(0.3, Math.hypot(w, h, H) / 2);
1620
+ const dist = radius / Math.sin(this.camera.fov * Math.PI / 360) * 1.15;
1621
+ const az = Math.PI / 4;
1622
+ const el = 0.55;
1623
+ this.camera.position.set(centre.x + dist * Math.cos(el) * Math.sin(az), centre.y + dist * Math.sin(el), centre.z + dist * Math.cos(el) * Math.cos(az));
1624
+ this.camera.near = Math.max(0.01, dist / 100);
1625
+ this.camera.far = dist * 20;
1626
+ this.camera.updateProjectionMatrix();
1627
+ this.controls.target.copy(centre);
1628
+ this.controls.minDistance = radius * 0.6;
1629
+ this.controls.maxDistance = dist * 4;
1630
+ this.controls.update();
1631
+ this.placeSun(radius);
1632
+ }
1633
+ setTheme(theme) {
1634
+ this.hemi.intensity = (theme.dark ? 0.62 : 0.78) * Math.PI;
1635
+ this.sun.intensity = (theme.dark ? 0.75 : 0.85) * Math.PI;
1636
+ this.floorMat.color = col(theme.floor);
1637
+ this.gridMat.color = col(theme.grid);
1638
+ this.gridMat.opacity = theme.dark ? 0.55 : 0.75;
1639
+ this.edgeMat.color = col(theme.edge);
1640
+ this.edgeMat.opacity = theme.dark ? 0.5 : 0.3;
1641
+ this.selectMat.color = col(theme.select);
1642
+ this.mats.setTheme(theme);
1643
+ }
1644
+ resize() {
1645
+ const w = this.canvas.clientWidth || 1;
1646
+ const h = this.canvas.clientHeight || 1;
1647
+ this.renderer.setSize(w, h, false);
1648
+ this.camera.aspect = w / h;
1649
+ this.camera.updateProjectionMatrix();
1650
+ }
1651
+ /** 바닥 · 격자는 모델보다 조금 크게(0.5 m 단위로 올림). */
1652
+ layoutFloor() {
1653
+ const m = this.model;
1654
+ const half = Math.ceil((Math.max((m == null ? void 0 : m.footprint.w) ?? 1, (m == null ? void 0 : m.footprint.h) ?? 1) / 2 + 0.5) / 0.5) * 0.5;
1655
+ this.floor.scale.set(half * 2, 1, half * 2);
1656
+ this.floor.position.y = -1e-3;
1657
+ if (this.grid) {
1658
+ this.grid.removeFromParent();
1659
+ this.grid.geometry.dispose();
1660
+ }
1661
+ const pts = [];
1662
+ for (let v = -half; v <= half + 1e-6; v += 0.5) pts.push(v, 1e-3, -half, v, 1e-3, half, -half, 1e-3, v, half, 1e-3, v);
1663
+ const geo = new BufferGeometry();
1664
+ geo.setAttribute("position", new Float32BufferAttribute(pts, 3));
1665
+ this.grid = new LineSegments(geo, this.gridMat);
1666
+ this.grid.raycast = () => void 0;
1667
+ this.scene.add(this.grid);
1668
+ }
1669
+ placeSun(radius) {
1670
+ const r = Math.max(2, radius * 3);
1671
+ this.sun.position.set(r * 0.6, r * 1.4, r * 0.8);
1672
+ this.sun.target.position.set(0, 0, 0);
1673
+ const cam = this.sun.shadow.camera;
1674
+ cam.left = -r;
1675
+ cam.right = r;
1676
+ cam.top = r;
1677
+ cam.bottom = -r;
1678
+ cam.near = 0.1;
1679
+ cam.far = r * 4;
1680
+ cam.updateProjectionMatrix();
1681
+ }
1682
+ dispose() {
1683
+ var _a, _b;
1684
+ cancelAnimationFrame(this.raf);
1685
+ this.canvas.removeEventListener("pointerdown", this.onDown);
1686
+ this.canvas.removeEventListener("pointerup", this.onUp);
1687
+ this.controls.dispose();
1688
+ if (this.shown) disposeModel(this.shown);
1689
+ (_a = this.mark) == null ? void 0 : _a.geometry.dispose();
1690
+ (_b = this.grid) == null ? void 0 : _b.geometry.dispose();
1691
+ this.floor.geometry.dispose();
1692
+ [this.floorMat, this.gridMat, this.edgeMat, this.selectMat].forEach((m) => m.dispose());
1693
+ this.mats.dispose();
1694
+ this.renderer.dispose();
1695
+ }
1696
+ }
1697
+ const _hoisted_1$1 = {
1698
+ key: 0,
1699
+ class: "lf-model-viewer__bar"
1700
+ };
1701
+ const _hoisted_2$1 = {
1702
+ key: 1,
1703
+ class: "lf-model-viewer__empty"
1704
+ };
1705
+ const ICON_FIT = "M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z";
1706
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1707
+ __name: "LfModelViewer",
1708
+ props: {
1709
+ model: {},
1710
+ selected: { default: null },
1711
+ controls: { type: Boolean, default: true },
1712
+ fitLabel: { default: "처음 시점으로" },
1713
+ emptyText: { default: "부품이 없습니다" }
1714
+ },
1715
+ emits: ["update:selected", "pick"],
1716
+ setup(__props, { expose: __expose, emit: __emit }) {
1717
+ const props = __props;
1718
+ const emit = __emit;
1719
+ const root = ref(null);
1720
+ const canvas = ref(null);
1721
+ const scene = shallowRef(null);
1722
+ let resizeObs = null;
1723
+ let themeObs = null;
1724
+ let themeFrame = 0;
1725
+ onMounted(() => {
1726
+ const s = new ModelScene(canvas.value, readMapTheme(root.value));
1727
+ s.onPick = (part) => {
1728
+ s.select(part);
1729
+ emit("update:selected", part);
1730
+ emit("pick", part);
1731
+ };
1732
+ s.setModel(props.model);
1733
+ s.select(props.selected);
1734
+ scene.value = s;
1735
+ resizeObs = new ResizeObserver(() => s.resize());
1736
+ resizeObs.observe(root.value);
1737
+ themeObs = new MutationObserver(() => {
1738
+ cancelAnimationFrame(themeFrame);
1739
+ themeFrame = requestAnimationFrame(() => s.setTheme(readMapTheme(root.value)));
1740
+ });
1741
+ themeObs.observe(document.documentElement, { attributes: true, attributeFilter: ["style", "class", "data-theme", "data-lf-theme"] });
1742
+ });
1743
+ onBeforeUnmount(() => {
1744
+ var _a;
1745
+ resizeObs == null ? void 0 : resizeObs.disconnect();
1746
+ themeObs == null ? void 0 : themeObs.disconnect();
1747
+ cancelAnimationFrame(themeFrame);
1748
+ (_a = scene.value) == null ? void 0 : _a.dispose();
1749
+ scene.value = null;
1750
+ });
1751
+ watch(() => props.model, (m) => {
1752
+ var _a;
1753
+ return (_a = scene.value) == null ? void 0 : _a.setModel(m, true);
1754
+ }, { deep: true });
1755
+ watch(() => props.selected, (p) => {
1756
+ var _a;
1757
+ return (_a = scene.value) == null ? void 0 : _a.select(p);
1758
+ });
1759
+ function fit() {
1760
+ var _a;
1761
+ (_a = scene.value) == null ? void 0 : _a.frame();
1762
+ }
1763
+ __expose({
1764
+ /** 모델이 꽉 차는 처음 시점으로 */
1765
+ fit
1766
+ });
1767
+ return (_ctx, _cache) => {
1768
+ return openBlock(), createElementBlock("div", {
1769
+ ref_key: "root",
1770
+ ref: root,
1771
+ class: "lf-model-viewer"
1772
+ }, [
1773
+ createElementVNode("canvas", {
1774
+ ref_key: "canvas",
1775
+ ref: canvas,
1776
+ class: "lf-model-viewer__canvas"
1777
+ }, null, 512),
1778
+ __props.controls ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
1779
+ createVNode(LfIconButton, {
1780
+ "icon-path": ICON_FIT,
1781
+ label: __props.fitLabel,
1782
+ size: "sm",
1783
+ onClick: fit
1784
+ }, null, 8, ["label"])
1785
+ ])) : createCommentVNode("", true),
1786
+ !__props.model || !__props.model.parts.length ? (openBlock(), createElementBlock("p", _hoisted_2$1, toDisplayString(__props.emptyText), 1)) : createCommentVNode("", true)
1787
+ ], 512);
1788
+ };
1789
+ }
1790
+ });
1791
+ const LfModelViewer = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-46071075"]]);
1792
+ const _hoisted_1 = { class: "lf-me__view" };
1793
+ const _hoisted_2 = { class: "lf-me__side" };
1794
+ const _hoisted_3 = { class: "lf-me__sec" };
1795
+ const _hoisted_4 = { class: "lf-me__head" };
1796
+ const _hoisted_5 = { class: "lf-me__tools" };
1797
+ const _hoisted_6 = { class: "lf-me__grid3" };
1798
+ const _hoisted_7 = { class: "lf-me__sec" };
1799
+ const _hoisted_8 = { class: "lf-me__head" };
1800
+ const _hoisted_9 = { class: "lf-me__count" };
1801
+ const _hoisted_10 = {
1802
+ key: 0,
1803
+ class: "lf-me__tools"
1804
+ };
1805
+ const _hoisted_11 = {
1806
+ class: "lf-me__parts",
1807
+ role: "listbox",
1808
+ "aria-label": "부품"
1809
+ };
1810
+ const _hoisted_12 = ["aria-selected", "onClick"];
1811
+ const _hoisted_13 = { class: "lf-me__no" };
1812
+ const _hoisted_14 = { class: "lf-me__pname" };
1813
+ const _hoisted_15 = { class: "lf-me__pmeta" };
1814
+ const _hoisted_16 = {
1815
+ key: 0,
1816
+ class: "lf-me__sec"
1817
+ };
1818
+ const _hoisted_17 = { class: "lf-me__head" };
1819
+ const _hoisted_18 = { class: "lf-me__row" };
1820
+ const _hoisted_19 = { class: "lf-me__grid2" };
1821
+ const _hoisted_20 = { class: "lf-me__color" };
1822
+ const _hoisted_21 = ["value", "disabled"];
1823
+ const _hoisted_22 = { class: "lf-me__label" };
1824
+ const _hoisted_23 = { class: "lf-me__grid3" };
1825
+ const _hoisted_24 = { class: "lf-me__grid3" };
1826
+ const _hoisted_25 = { class: "lf-me__grid2" };
1827
+ const _hoisted_26 = { class: "lf-me__head lf-me__head--sub" };
1828
+ const _hoisted_27 = { class: "lf-me__no" };
1829
+ const _hoisted_28 = {
1830
+ key: 0,
1831
+ class: "lf-me__hint"
1832
+ };
1833
+ const _hoisted_29 = {
1834
+ key: 1,
1835
+ class: "lf-me__hint"
1836
+ };
1837
+ const _hoisted_30 = { class: "lf-me__problems" };
1838
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1839
+ __name: "LfModelEditor",
1840
+ props: {
1841
+ modelValue: {},
1842
+ readonly: { type: Boolean, default: false }
1843
+ },
1844
+ emits: ["update:modelValue"],
1845
+ setup(__props, { expose: __expose, emit: __emit }) {
1846
+ const props = __props;
1847
+ const emit = __emit;
1848
+ const AXES = ["x", "y", "z"];
1849
+ const SHAPE_ICON = {
1850
+ rbox: "M7 4h10a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3zm0 2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H7z",
1851
+ box: "M4 4h16v16H4V4zm2 2v12h12V6H6z",
1852
+ cyl: "M12 3c4.4 0 8 1.3 8 3v12c0 1.7-3.6 3-8 3s-8-1.3-8-3V6c0-1.7 3.6-3 8-3zm6 5.2C16.5 8.7 14.4 9 12 9s-4.5-.3-6-.8V18c.4.4 2.6 1 6 1s5.6-.6 6-1V8.2zM12 5c-3.4 0-5.6.6-6 1 .4.4 2.6 1 6 1s5.6-.6 6-1c-.4-.4-2.6-1-6-1z"
1853
+ };
1854
+ const MATERIAL_SWATCH = {
1855
+ body: "var(--map3d-object, var(--admin-text-muted))",
1856
+ dark: "#3a4148",
1857
+ accent: "var(--admin-status-warning, #f59e0b)",
1858
+ metal: "#8c959e",
1859
+ wood: "#b9874f",
1860
+ card: "#c9a06a",
1861
+ bin: "#3f6b9c",
1862
+ glass: "#bcd3e6"
1863
+ };
1864
+ const clone = (v) => JSON.parse(JSON.stringify(v));
1865
+ const round = (v) => Math.round(v * 1e3) / 1e3;
1866
+ const numOr = (v, fallback) => {
1867
+ const n = typeof v === "number" ? v : Number(v);
1868
+ return Number.isFinite(n) ? round(n) : fallback;
1869
+ };
1870
+ const model = computed(() => props.modelValue);
1871
+ const sel = ref(null);
1872
+ const part = computed(() => sel.value === null ? null : model.value.parts[sel.value] ?? null);
1873
+ const problems = computed(() => modelProblems(model.value));
1874
+ const moving = (p) => {
1875
+ var _a, _b, _c;
1876
+ return (((_b = (_a = p.motion) == null ? void 0 : _a.path) == null ? void 0 : _b.length) ?? 0) >= 2 || !!((_c = p.motion) == null ? void 0 : _c.spin);
1877
+ };
1878
+ const swatch = (p) => p.color || MATERIAL_SWATCH[p.material];
1879
+ watch(
1880
+ () => model.value.parts.length,
1881
+ (n) => {
1882
+ if (sel.value !== null && sel.value >= n) sel.value = n ? n - 1 : null;
1883
+ }
1884
+ );
1885
+ const past = ref([]);
1886
+ const future = ref([]);
1887
+ let lastKey = null;
1888
+ function commit(next, key = null) {
1889
+ if (props.readonly) return;
1890
+ if (!(key && key === lastKey && past.value.length)) {
1891
+ past.value.push(clone(model.value));
1892
+ if (past.value.length > 200) past.value.shift();
1893
+ }
1894
+ future.value = [];
1895
+ lastKey = key;
1896
+ emit("update:modelValue", next);
1897
+ }
1898
+ function undo() {
1899
+ const prev = past.value.pop();
1900
+ if (!prev) return;
1901
+ future.value.push(clone(model.value));
1902
+ lastKey = null;
1903
+ emit("update:modelValue", prev);
1904
+ }
1905
+ function redo() {
1906
+ const next = future.value.pop();
1907
+ if (!next) return;
1908
+ past.value.push(clone(model.value));
1909
+ lastKey = null;
1910
+ emit("update:modelValue", next);
1911
+ }
1912
+ function setTop(which, v) {
1913
+ const m = clone(model.value);
1914
+ if (which === "fw") m.footprint.w = numOr(v, m.footprint.w);
1915
+ else if (which === "fh") m.footprint.h = numOr(v, m.footprint.h);
1916
+ else m.height = numOr(v, m.height);
1917
+ commit(m, `top:${which}`);
1918
+ }
1919
+ function editPart(fn, key) {
1920
+ if (sel.value === null) return;
1921
+ const m = clone(model.value);
1922
+ const p = m.parts[sel.value];
1923
+ if (!p) return;
1924
+ fn(p);
1925
+ commit(m, `part:${sel.value}:${key}`);
1926
+ }
1927
+ function setPart(k, v) {
1928
+ editPart((p) => {
1929
+ if (v === void 0) delete p[k];
1930
+ else p[k] = v;
1931
+ }, String(k));
1932
+ }
1933
+ function setVec(which, axis, v) {
1934
+ editPart((p) => {
1935
+ const min = which === "size" ? 5e-3 : -100;
1936
+ p[which][axis] = Math.max(min, numOr(v, p[which][axis]));
1937
+ }, `${which}${axis}`);
1938
+ }
1939
+ function setMotion(patch) {
1940
+ editPart((p) => {
1941
+ var _a;
1942
+ const m = { ...p.motion ?? {}, ...patch };
1943
+ for (const k of Object.keys(m)) if (m[k] === void 0) delete m[k];
1944
+ if (!m.spin && !(((_a = m.path) == null ? void 0 : _a.length) ?? 0)) delete p.motion;
1945
+ else p.motion = m;
1946
+ }, `motion:${Object.keys(patch).join(",")}`);
1947
+ }
1948
+ function addPathPoint() {
1949
+ editPart((p) => {
1950
+ var _a;
1951
+ const path = [...((_a = p.motion) == null ? void 0 : _a.path) ?? []];
1952
+ path.push(path.length ? [...path[path.length - 1]] : [0, 0, 0]);
1953
+ p.motion = { ...p.motion ?? {}, path };
1954
+ }, `path:add:${Date.now()}`);
1955
+ }
1956
+ function removePathPoint(j) {
1957
+ editPart((p) => {
1958
+ var _a;
1959
+ const path = (((_a = p.motion) == null ? void 0 : _a.path) ?? []).filter((_, i) => i !== j);
1960
+ const m = { ...p.motion ?? {}, path };
1961
+ if (!path.length) delete m.path;
1962
+ if (!m.spin && !m.path) delete p.motion;
1963
+ else p.motion = m;
1964
+ }, `path:del:${Date.now()}`);
1965
+ }
1966
+ function setPathPoint(j, axis, v) {
1967
+ editPart((p) => {
1968
+ var _a, _b;
1969
+ const pt = (_b = (_a = p.motion) == null ? void 0 : _a.path) == null ? void 0 : _b[j];
1970
+ if (pt) pt[axis] = numOr(v, pt[axis]);
1971
+ }, `path:${j}:${axis}`);
1972
+ }
1973
+ function addPart(shape) {
1974
+ const m = clone(model.value);
1975
+ const s = Math.max(0.1, Math.min(m.footprint.w, m.footprint.h) / 2);
1976
+ m.parts.push({ shape, size: [round(s), round(Math.max(0.05, m.height / 2)), round(s)], pos: [0, 0, 0], material: "body" });
1977
+ commit(m);
1978
+ sel.value = m.parts.length - 1;
1979
+ }
1980
+ function duplicate() {
1981
+ if (sel.value === null) return;
1982
+ const m = clone(model.value);
1983
+ const p = clone(m.parts[sel.value]);
1984
+ p.pos = [round(p.pos[0] + 0.1), p.pos[1], round(p.pos[2] + 0.1)];
1985
+ m.parts.splice(sel.value + 1, 0, p);
1986
+ commit(m);
1987
+ sel.value = sel.value + 1;
1988
+ }
1989
+ function reorder(dir) {
1990
+ if (sel.value === null) return;
1991
+ const to = sel.value + dir;
1992
+ const m = clone(model.value);
1993
+ if (to < 0 || to >= m.parts.length) return;
1994
+ const [p] = m.parts.splice(sel.value, 1);
1995
+ m.parts.splice(to, 0, p);
1996
+ commit(m);
1997
+ sel.value = to;
1998
+ }
1999
+ function removePart() {
2000
+ if (sel.value === null) return;
2001
+ const m = clone(model.value);
2002
+ m.parts.splice(sel.value, 1);
2003
+ commit(m);
2004
+ sel.value = m.parts.length ? Math.min(sel.value, m.parts.length - 1) : null;
2005
+ }
2006
+ function onKey(e) {
2007
+ const t = e.target;
2008
+ if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable)) return;
2009
+ const mod = e.ctrlKey || e.metaKey;
2010
+ if (mod && e.key.toLowerCase() === "z") {
2011
+ e.preventDefault();
2012
+ if (e.shiftKey) redo();
2013
+ else undo();
2014
+ } else if (mod && e.key.toLowerCase() === "y") {
2015
+ e.preventDefault();
2016
+ redo();
2017
+ } else if ((e.key === "Delete" || e.key === "Backspace") && sel.value !== null && !props.readonly) {
2018
+ e.preventDefault();
2019
+ removePart();
2020
+ } else if (e.key === "Escape") {
2021
+ sel.value = null;
2022
+ }
2023
+ }
2024
+ __expose({ undo, redo });
2025
+ return (_ctx, _cache) => {
2026
+ var _a, _b, _c;
2027
+ return openBlock(), createElementBlock("div", {
2028
+ class: "lf-me",
2029
+ tabindex: "-1",
2030
+ onKeydown: onKey
2031
+ }, [
2032
+ createElementVNode("div", _hoisted_1, [
2033
+ createVNode(LfModelViewer, {
2034
+ model: model.value,
2035
+ selected: sel.value,
2036
+ onPick: _cache[0] || (_cache[0] = (p) => sel.value = p)
2037
+ }, null, 8, ["model", "selected"])
2038
+ ]),
2039
+ createElementVNode("div", _hoisted_2, [
2040
+ createElementVNode("section", _hoisted_3, [
2041
+ createElementVNode("div", _hoisted_4, [
2042
+ _cache[14] || (_cache[14] = createElementVNode("h4", null, "모델", -1)),
2043
+ createElementVNode("div", _hoisted_5, [
2044
+ createVNode(LfIconButton, {
2045
+ icon: "undo",
2046
+ label: "실행 취소 (Ctrl+Z)",
2047
+ size: "sm",
2048
+ disabled: __props.readonly || !past.value.length,
2049
+ onClick: undo
2050
+ }, null, 8, ["disabled"]),
2051
+ createVNode(LfIconButton, {
2052
+ icon: "redo",
2053
+ label: "다시 실행 (Ctrl+Shift+Z)",
2054
+ size: "sm",
2055
+ disabled: __props.readonly || !future.value.length,
2056
+ onClick: redo
2057
+ }, null, 8, ["disabled"])
2058
+ ])
2059
+ ]),
2060
+ createElementVNode("div", _hoisted_6, [
2061
+ createVNode(LfTextField, {
2062
+ "model-value": model.value.footprint.w,
2063
+ type: "number",
2064
+ size: "sm",
2065
+ label: "가로 w (m)",
2066
+ readonly: __props.readonly,
2067
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = (v) => setTop("fw", v))
2068
+ }, null, 8, ["model-value", "readonly"]),
2069
+ createVNode(LfTextField, {
2070
+ "model-value": model.value.footprint.h,
2071
+ type: "number",
2072
+ size: "sm",
2073
+ label: "세로 h (m)",
2074
+ readonly: __props.readonly,
2075
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = (v) => setTop("fh", v))
2076
+ }, null, 8, ["model-value", "readonly"]),
2077
+ createVNode(LfTextField, {
2078
+ "model-value": model.value.height,
2079
+ type: "number",
2080
+ size: "sm",
2081
+ label: "높이 (m)",
2082
+ readonly: __props.readonly,
2083
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = (v) => setTop("height", v))
2084
+ }, null, 8, ["model-value", "readonly"])
2085
+ ])
2086
+ ]),
2087
+ createElementVNode("section", _hoisted_7, [
2088
+ createElementVNode("div", _hoisted_8, [
2089
+ createElementVNode("h4", null, [
2090
+ _cache[15] || (_cache[15] = createTextVNode("부품 ", -1)),
2091
+ createElementVNode("span", _hoisted_9, toDisplayString(model.value.parts.length), 1)
2092
+ ]),
2093
+ !__props.readonly ? (openBlock(), createElementBlock("div", _hoisted_10, [
2094
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(MODEL_SHAPES), (s) => {
2095
+ return openBlock(), createBlock(LfIconButton, {
2096
+ key: s,
2097
+ "icon-path": SHAPE_ICON[s],
2098
+ label: `${unref(MODEL_SHAPE_LABEL)[s]} 더하기`,
2099
+ size: "sm",
2100
+ onClick: ($event) => addPart(s)
2101
+ }, null, 8, ["icon-path", "label", "onClick"]);
2102
+ }), 128)),
2103
+ createVNode(LfIconButton, {
2104
+ icon: "content_copy",
2105
+ label: "복제",
2106
+ size: "sm",
2107
+ disabled: sel.value === null,
2108
+ onClick: duplicate
2109
+ }, null, 8, ["disabled"]),
2110
+ createVNode(LfIconButton, {
2111
+ icon: "arrow_upward",
2112
+ label: "위로",
2113
+ size: "sm",
2114
+ disabled: sel.value === null || sel.value === 0,
2115
+ onClick: _cache[4] || (_cache[4] = ($event) => reorder(-1))
2116
+ }, null, 8, ["disabled"]),
2117
+ createVNode(LfIconButton, {
2118
+ icon: "arrow_downward",
2119
+ label: "아래로",
2120
+ size: "sm",
2121
+ disabled: sel.value === null || sel.value >= model.value.parts.length - 1,
2122
+ onClick: _cache[5] || (_cache[5] = ($event) => reorder(1))
2123
+ }, null, 8, ["disabled"]),
2124
+ createVNode(LfIconButton, {
2125
+ icon: "delete",
2126
+ label: "지우기 (Delete)",
2127
+ size: "sm",
2128
+ danger: "",
2129
+ disabled: sel.value === null,
2130
+ onClick: removePart
2131
+ }, null, 8, ["disabled"])
2132
+ ])) : createCommentVNode("", true)
2133
+ ]),
2134
+ createElementVNode("ul", _hoisted_11, [
2135
+ (openBlock(true), createElementBlock(Fragment, null, renderList(model.value.parts, (p, i) => {
2136
+ return openBlock(), createElementBlock("li", {
2137
+ key: i,
2138
+ role: "option",
2139
+ "aria-selected": sel.value === i,
2140
+ class: normalizeClass(["lf-me__part", { "lf-me__part--on": sel.value === i }]),
2141
+ onClick: ($event) => sel.value = sel.value === i ? null : i
2142
+ }, [
2143
+ createElementVNode("span", _hoisted_13, toDisplayString(i + 1), 1),
2144
+ createElementVNode("span", {
2145
+ class: "lf-me__swatch",
2146
+ style: normalizeStyle({ background: swatch(p) })
2147
+ }, null, 4),
2148
+ createElementVNode("span", _hoisted_14, toDisplayString(p.name || unref(MODEL_SHAPE_LABEL)[p.shape]), 1),
2149
+ createElementVNode("span", _hoisted_15, [
2150
+ createTextVNode(toDisplayString(unref(MODEL_MATERIAL_LABEL)[p.material]), 1),
2151
+ moving(p) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2152
+ createTextVNode(" · 움직임")
2153
+ ], 64)) : createCommentVNode("", true)
2154
+ ])
2155
+ ], 10, _hoisted_12);
2156
+ }), 128))
2157
+ ])
2158
+ ]),
2159
+ part.value ? (openBlock(), createElementBlock("section", _hoisted_16, [
2160
+ createElementVNode("div", _hoisted_17, [
2161
+ createElementVNode("h4", null, toDisplayString((sel.value ?? 0) + 1) + "번 부품", 1)
2162
+ ]),
2163
+ createVNode(LfTextField, {
2164
+ "model-value": part.value.name ?? "",
2165
+ size: "sm",
2166
+ label: "이름",
2167
+ readonly: __props.readonly,
2168
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = (v) => setPart("name", String(v ?? "") || void 0))
2169
+ }, null, 8, ["model-value", "readonly"]),
2170
+ createElementVNode("div", _hoisted_18, [
2171
+ createVNode(LfSegmented, {
2172
+ "model-value": part.value.shape,
2173
+ options: unref(MODEL_SHAPES).map((s) => ({ value: s, label: unref(MODEL_SHAPE_LABEL)[s] })),
2174
+ size: "sm",
2175
+ "aria-label": "모양",
2176
+ disabled: __props.readonly,
2177
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = (v) => setPart("shape", v))
2178
+ }, null, 8, ["model-value", "options", "disabled"])
2179
+ ]),
2180
+ createElementVNode("div", _hoisted_19, [
2181
+ createVNode(LfSelect, {
2182
+ "model-value": part.value.material,
2183
+ options: unref(MODEL_MATERIALS).map((m) => ({ value: m, label: unref(MODEL_MATERIAL_LABEL)[m] })),
2184
+ size: "sm",
2185
+ label: "재질",
2186
+ disabled: __props.readonly,
2187
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = (v) => setPart("material", v))
2188
+ }, null, 8, ["model-value", "options", "disabled"]),
2189
+ createElementVNode("div", _hoisted_20, [
2190
+ createVNode(LfTextField, {
2191
+ "model-value": part.value.color ?? "",
2192
+ size: "sm",
2193
+ label: "색 (#rrggbb)",
2194
+ placeholder: "재질 색",
2195
+ readonly: __props.readonly,
2196
+ "onUpdate:modelValue": _cache[9] || (_cache[9] = (v) => setPart("color", String(v ?? "").trim() || void 0))
2197
+ }, null, 8, ["model-value", "readonly"]),
2198
+ createElementVNode("input", {
2199
+ type: "color",
2200
+ class: "lf-me__picker",
2201
+ value: part.value.color ?? "#cccccc",
2202
+ disabled: __props.readonly,
2203
+ "aria-label": "색 고르기",
2204
+ onInput: _cache[10] || (_cache[10] = (e) => setPart("color", e.target.value))
2205
+ }, null, 40, _hoisted_21)
2206
+ ])
2207
+ ]),
2208
+ createElementVNode("p", _hoisted_22, [
2209
+ _cache[16] || (_cache[16] = createTextVNode("크기 (m) — 가로 · 높이 · 세로", -1)),
2210
+ part.value.shape === "cyl" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2211
+ createTextVNode(" (원기둥은 가로가 지름)")
2212
+ ], 64)) : createCommentVNode("", true)
2213
+ ]),
2214
+ createElementVNode("div", _hoisted_23, [
2215
+ (openBlock(true), createElementBlock(Fragment, null, renderList(part.value.size, (v, k) => {
2216
+ return openBlock(), createBlock(LfTextField, {
2217
+ key: "s" + k,
2218
+ "model-value": v,
2219
+ type: "number",
2220
+ size: "sm",
2221
+ "aria-label": `크기 ${AXES[k]}`,
2222
+ readonly: __props.readonly,
2223
+ "onUpdate:modelValue": (x) => setVec("size", k, x)
2224
+ }, null, 8, ["model-value", "aria-label", "readonly", "onUpdate:modelValue"]);
2225
+ }), 128))
2226
+ ]),
2227
+ _cache[18] || (_cache[18] = createElementVNode("p", { class: "lf-me__label" }, "위치 (m) — x · y(밑면) · z, 바닥면 가운데 기준", -1)),
2228
+ createElementVNode("div", _hoisted_24, [
2229
+ (openBlock(true), createElementBlock(Fragment, null, renderList(part.value.pos, (v, k) => {
2230
+ return openBlock(), createBlock(LfTextField, {
2231
+ key: "p" + k,
2232
+ "model-value": v,
2233
+ type: "number",
2234
+ size: "sm",
2235
+ "aria-label": `위치 ${AXES[k]}`,
2236
+ readonly: __props.readonly,
2237
+ "onUpdate:modelValue": (x) => setVec("pos", k, x)
2238
+ }, null, 8, ["model-value", "aria-label", "readonly", "onUpdate:modelValue"]);
2239
+ }), 128))
2240
+ ]),
2241
+ createElementVNode("div", _hoisted_25, [
2242
+ createVNode(LfTextField, {
2243
+ "model-value": part.value.rotY ?? 0,
2244
+ type: "number",
2245
+ size: "sm",
2246
+ label: "제자리 회전 (도)",
2247
+ readonly: __props.readonly,
2248
+ "onUpdate:modelValue": _cache[11] || (_cache[11] = (v) => setPart("rotY", numOr(v, 0) || void 0))
2249
+ }, null, 8, ["model-value", "readonly"]),
2250
+ createVNode(LfTextField, {
2251
+ "model-value": ((_a = part.value.motion) == null ? void 0 : _a.spin) ?? 0,
2252
+ type: "number",
2253
+ size: "sm",
2254
+ label: "돌기 (도/초)",
2255
+ readonly: __props.readonly,
2256
+ "onUpdate:modelValue": _cache[12] || (_cache[12] = (v) => setMotion({ spin: numOr(v, 0) || void 0 }))
2257
+ }, null, 8, ["model-value", "readonly"])
2258
+ ]),
2259
+ createElementVNode("div", _hoisted_26, [
2260
+ _cache[17] || (_cache[17] = createElementVNode("p", { class: "lf-me__label" }, "경로 움직임 — 자기 위치에서의 변위, 끝에서 처음으로 돈다", -1)),
2261
+ !__props.readonly ? (openBlock(), createBlock(LfIconButton, {
2262
+ key: 0,
2263
+ icon: "add",
2264
+ label: "경로 점 더하기",
2265
+ size: "sm",
2266
+ onClick: addPathPoint
2267
+ })) : createCommentVNode("", true)
2268
+ ]),
2269
+ ((_c = (_b = part.value.motion) == null ? void 0 : _b.path) == null ? void 0 : _c.length) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2270
+ (openBlock(true), createElementBlock(Fragment, null, renderList(part.value.motion.path, (pt, j) => {
2271
+ return openBlock(), createElementBlock("div", {
2272
+ key: "m" + j,
2273
+ class: "lf-me__path"
2274
+ }, [
2275
+ createElementVNode("span", _hoisted_27, toDisplayString(j + 1), 1),
2276
+ (openBlock(true), createElementBlock(Fragment, null, renderList(pt, (v, k) => {
2277
+ return openBlock(), createBlock(LfTextField, {
2278
+ key: k,
2279
+ "model-value": v,
2280
+ type: "number",
2281
+ size: "sm",
2282
+ "aria-label": `경로 ${j + 1} ${AXES[k]}`,
2283
+ readonly: __props.readonly,
2284
+ "onUpdate:modelValue": (x) => setPathPoint(j, k, x)
2285
+ }, null, 8, ["model-value", "aria-label", "readonly", "onUpdate:modelValue"]);
2286
+ }), 128)),
2287
+ !__props.readonly ? (openBlock(), createBlock(LfIconButton, {
2288
+ key: 0,
2289
+ icon: "remove",
2290
+ label: "이 점 빼기",
2291
+ size: "sm",
2292
+ onClick: ($event) => removePathPoint(j)
2293
+ }, null, 8, ["onClick"])) : createCommentVNode("", true)
2294
+ ]);
2295
+ }), 128)),
2296
+ createVNode(LfTextField, {
2297
+ "model-value": part.value.motion.periodS ?? 10,
2298
+ type: "number",
2299
+ size: "sm",
2300
+ label: "한 바퀴 (초)",
2301
+ readonly: __props.readonly,
2302
+ "onUpdate:modelValue": _cache[13] || (_cache[13] = (v) => setMotion({ periodS: numOr(v, 10) }))
2303
+ }, null, 8, ["model-value", "readonly"]),
2304
+ part.value.motion.path.length < 2 ? (openBlock(), createElementBlock("p", _hoisted_28, "점이 둘 이상이어야 움직입니다.")) : createCommentVNode("", true)
2305
+ ], 64)) : createCommentVNode("", true)
2306
+ ])) : model.value.parts.length ? (openBlock(), createElementBlock("p", _hoisted_29, "부품을 고르면(목록이나 3D 에서 누르기) 여기서 고칩니다.")) : createCommentVNode("", true),
2307
+ problems.value.length ? (openBlock(), createBlock(LfAlert, {
2308
+ key: 2,
2309
+ tone: "warning",
2310
+ dense: ""
2311
+ }, {
2312
+ default: withCtx(() => [
2313
+ createElementVNode("ul", _hoisted_30, [
2314
+ (openBlock(true), createElementBlock(Fragment, null, renderList(problems.value, (p) => {
2315
+ return openBlock(), createElementBlock("li", { key: p }, toDisplayString(p), 1);
2316
+ }), 128))
2317
+ ])
2318
+ ]),
2319
+ _: 1
2320
+ })) : createCommentVNode("", true)
2321
+ ])
2322
+ ], 32);
2323
+ };
2324
+ }
2325
+ });
2326
+ const LfModelEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-12b50041"]]);
1165
2327
  export {
1166
2328
  ISO_ELEVATION,
1167
2329
  LfMap3d,
2330
+ LfModelEditor,
2331
+ LfModelViewer,
2332
+ MODEL_MATERIALS,
2333
+ MODEL_MATERIAL_LABEL,
2334
+ MODEL_SHAPES,
2335
+ MODEL_SHAPE_LABEL,
1168
2336
  MapScene,
2337
+ ModelMaterials,
2338
+ ModelScene,
2339
+ animateModel,
2340
+ buildModel,
1169
2341
  colorOf,
2342
+ defaultModel,
2343
+ disposeModel,
2344
+ modelMoves,
2345
+ modelProblems,
2346
+ motionMatrix,
1170
2347
  parseColor,
1171
2348
  readMapTheme
1172
2349
  };