Skip to content

Commit

Permalink
add dedicate updatelink signal
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyangXYZ committed Jan 6, 2024
1 parent 71fd90f commit c1e4294
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/TopoEditToolbox.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { ref } from 'vue'
import { Network, SignalEditTopology, SignalAddNode } from '@/hooks/useStates'
import { Network, SignalEditTopology, SignalAddNode,SignalUpdateLinks } from '@/hooks/useStates'
import { Check, Plus, Switch } from '@element-plus/icons-vue'
const nodeType = ref(0)
Expand Down Expand Up @@ -31,7 +31,7 @@ const addNode = () => {
}
const connect = () => {
Network.EstablishConnection()
SignalAddNode.value++
SignalUpdateLinks.value++
}
const finishEdit = () => {
Network.StartWebWorkers()
Expand Down
6 changes: 5 additions & 1 deletion src/hooks/useDrawTopology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
SelectedNode,
SignalEditTopology,
SignalResetCamera,
SignalAddNode
SignalAddNode,
SignalUpdateLinks
} from './useStates'

import * as THREE from 'three'
Expand Down Expand Up @@ -607,6 +608,9 @@ export async function useDrawTopology(dom: HTMLElement) {

watch(SignalAddNode, () => {
drawNodes()
})
watch(SignalUpdateLinks, ()=>{
clearLinks()
drawLinks()
})
watch(Network.SelectedTopo, () => {
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ export const SignalShowSchedule = ref(false)
export const SignalShowStatistics = ref(false)
export const SignalEditTopology = ref(false)
export const SignalAddNode = ref(0)
export const SignalUpdateLinks = ref(0)

0 comments on commit c1e4294

Please sign in to comment.