|
@@ -25,9 +25,14 @@
|
|
|
@endLine="endLine"
|
|
|
@cancelEndLine="cancelEndLine"
|
|
|
@startDrag="startDrag"
|
|
|
- ></component>
|
|
|
+ />
|
|
|
</template>
|
|
|
<line v-if="lineStartPoint" v-bind="dashLineAttr" class="dash-line" />
|
|
|
+ <HelpLine
|
|
|
+ :lines="helpLines"
|
|
|
+ :curNode="curNode"
|
|
|
+ :wrapSize="wrapSize"
|
|
|
+ ></HelpLine>
|
|
|
</svg>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -38,6 +43,7 @@ import SvgRect from "./components/svgRect.vue";
|
|
|
import SvgCircle from "./components/svgCircle.vue";
|
|
|
import SvgRhombic from "./components/svgRhombic.vue";
|
|
|
import SvgLines from "./components/svgLines.vue";
|
|
|
+import HelpLine from "./components/helpLine.vue";
|
|
|
import Bar from "./components/bar.vue";
|
|
|
import {
|
|
|
findFromArray,
|
|
@@ -57,30 +63,45 @@ const isDragging = ref(false);
|
|
|
const lineStartPoint = ref(null);
|
|
|
const lineEndPoint = ref(null);
|
|
|
const lines = reactive([
|
|
|
- // { start: { targetId: 1, pos: "right" }, end: { targetId: 2, pos: "left" } },
|
|
|
- // { start: { targetId: 2, pos: "right" }, end: { targetId: 3, pos: "left" } },
|
|
|
+ { start: { targetId: 1, pos: "right" }, end: { targetId: 2, pos: "left" } },
|
|
|
+ { start: { targetId: 2, pos: "right" }, end: { targetId: 3, pos: "left" } },
|
|
|
]);
|
|
|
const nodes = ref([
|
|
|
- // {
|
|
|
- // id: 1,
|
|
|
- // pos: { x: 200, y: 200 },
|
|
|
- // type: "rect",
|
|
|
- // size: { width: 100, height: 100 },
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id: 2,
|
|
|
- // type: "rhombic",
|
|
|
- // pos: { x: 350, y: 210 },
|
|
|
- // size: { width: 120, height: 80 },
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id: 3,
|
|
|
- // pos: { x: 550, y: 220 },
|
|
|
- // type: "circle",
|
|
|
- // size: { width: 60, height: 60 },
|
|
|
- // },
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ pos: { x: 200, y: 200 },
|
|
|
+ type: "rect",
|
|
|
+ size: { width: 100, height: 100 },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ type: "rhombic",
|
|
|
+ pos: { x: 350, y: 210 },
|
|
|
+ size: { width: 120, height: 80 },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ pos: { x: 550, y: 220 },
|
|
|
+ type: "circle",
|
|
|
+ size: { width: 60, height: 60 },
|
|
|
+ },
|
|
|
]);
|
|
|
|
|
|
+const helpLines = computed(() => {
|
|
|
+ const lines = [];
|
|
|
+ nodes.value.forEach((node) => {
|
|
|
+ if (node.id !== curNodeId.value) {
|
|
|
+ lines.push(
|
|
|
+ countPointByPos("left", node.pos, node.size),
|
|
|
+ countPointByPos("top", node.pos, node.size),
|
|
|
+ countPointByPos("right", node.pos, node.size),
|
|
|
+ countPointByPos("bottom", node.pos, node.size)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return lines;
|
|
|
+});
|
|
|
+
|
|
|
const curNode = computed(() => {
|
|
|
return curNodeId.value !== 0
|
|
|
? nodes.value.find((i) => i.id === curNodeId.value)
|