|
@@ -1,5 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<Teleport to="#right-pano">
|
|
<Teleport to="#right-pano">
|
|
|
|
+ {{ activeEntity?.attrib }}
|
|
<ElButton @click="board.clear()"> 清除 </ElButton>
|
|
<ElButton @click="board.clear()"> 清除 </ElButton>
|
|
<ElButton :disabled="!board.history.state.hasUndo" @click="board.history.undo()">
|
|
<ElButton :disabled="!board.history.state.hasUndo" @click="board.history.undo()">
|
|
撤销
|
|
撤销
|
|
@@ -27,6 +28,7 @@
|
|
<ElButton @click="board.hidenPois()"> 隐藏图例 </ElButton>
|
|
<ElButton @click="board.hidenPois()"> 隐藏图例 </ElButton>
|
|
<ElButton @click="board.showPoisId()"> 显示图例Id </ElButton>
|
|
<ElButton @click="board.showPoisId()"> 显示图例Id </ElButton>
|
|
<ElButton @click="board.hidePoisId()"> 隐藏图例Id </ElButton>
|
|
<ElButton @click="board.hidePoisId()"> 隐藏图例Id </ElButton>
|
|
|
|
+ <ElButton @click="board.blurPoi()" v-if="activeEntity"> 去除聚焦 </ElButton>
|
|
</Teleport>
|
|
</Teleport>
|
|
<div
|
|
<div
|
|
class="board-layout"
|
|
class="board-layout"
|
|
@@ -39,8 +41,25 @@
|
|
import { shallowRef, watch } from "vue";
|
|
import { shallowRef, watch } from "vue";
|
|
import { EditWholeLine, createBoard, EditPoi, changeEnv } from "../";
|
|
import { EditWholeLine, createBoard, EditPoi, changeEnv } from "../";
|
|
import storeData from "./storeData.json";
|
|
import storeData from "./storeData.json";
|
|
|
|
+import floor from "./floorplan_cad.json";
|
|
import { ElButton } from "element-plus";
|
|
import { ElButton } from "element-plus";
|
|
|
|
|
|
|
|
+const rooms = floor.floors.map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ id: item.id.toString(),
|
|
|
|
+ points: item["vertex-xy"].map((p) => ({ ...p, id: p.id.toString() })),
|
|
|
|
+ lines: item["segment"].map((l) => ({
|
|
|
|
+ id: l.id.toString(),
|
|
|
|
+ pointIds: [l.a.toString(), l.b.toString()],
|
|
|
|
+ })),
|
|
|
|
+ polygons: item["segment"].map((l) => ({
|
|
|
|
+ id: l.id.toString(),
|
|
|
|
+ lineIds: [l.id.toString()],
|
|
|
|
+ })),
|
|
|
|
+ };
|
|
|
|
+});
|
|
|
|
+console.log(rooms);
|
|
|
|
+
|
|
changeEnv(true);
|
|
changeEnv(true);
|
|
withDefaults(defineProps<{ width?: number; height?: number; pixelRation?: number }>(), {
|
|
withDefaults(defineProps<{ width?: number; height?: number; pixelRation?: number }>(), {
|
|
width: 320,
|
|
width: 320,
|
|
@@ -51,14 +70,17 @@ type Board = ReturnType<typeof createBoard>;
|
|
|
|
|
|
const board = createBoard();
|
|
const board = createBoard();
|
|
board.bound.setRetainScale(true);
|
|
board.bound.setRetainScale(true);
|
|
-board.bound.setBound([-9.0754444, -5.6740986, 9.0754444, 5.6740986], [0, 0]);
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
|
+ // board.setData({ rooms: rooms });
|
|
board.setData(storeData);
|
|
board.setData(storeData);
|
|
|
|
+ board.bound.autoBound(20);
|
|
}, 500);
|
|
}, 500);
|
|
|
|
|
|
const activeEntity = shallowRef<EditPoi>();
|
|
const activeEntity = shallowRef<EditPoi>();
|
|
-board.bus.on("activePoi", (entity) => (activeEntity.value = entity));
|
|
|
|
|
|
+board.bus.on("activePoi", (entity) => {
|
|
|
|
+ activeEntity.value = entity;
|
|
|
|
+});
|
|
|
|
|
|
const drawing = shallowRef<ReturnType<EditWholeLine["createPolygon"]>>();
|
|
const drawing = shallowRef<ReturnType<EditWholeLine["createPolygon"]>>();
|
|
const drawHandler = () => {
|
|
const drawHandler = () => {
|