Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
feat: optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
neko-para committed Aug 23, 2023
1 parent 63e081a commit 8af32f6
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions packages/client/src/views/VisualView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ function handleDown(ev: PointerEvent) {
if (ev.pointerId !== 1) {
return
}
ev.stopPropagation()
svgEl.value?.setPointerCapture(1)
saveBase = base.value
saveX = ev.offsetX
saveY = ev.offsetY
if (ev.buttons === 4) {
ev.stopPropagation()
svgEl.value?.setPointerCapture(1)
saveBase = base.value
saveX = ev.offsetX
saveY = ev.offsetY
}
}
function handleMove(ev: PointerEvent) {
Expand All @@ -172,6 +174,8 @@ function handleUp(ev: PointerEvent) {
saveBase = null
saveX = null
saveY = null
} else {
active.value = ''
}
}
Expand Down Expand Up @@ -212,8 +216,9 @@ function handleWheel(ev: WheelEvent) {
<g
v-for="vert in vertexs"
:key="vert.name"
@mousedown="
() => {
@pointerup="
ev => {
ev.stopPropagation()
active = vert.name
}
"
Expand All @@ -236,15 +241,17 @@ function handleWheel(ev: WheelEvent) {
<path
v-bind="edge.path"
:stroke="
edge.from === active
? 'red'
: edge.to === active
? 'blue'
active
? edge.from === active
? 'red'
: edge.to === active
? 'blue'
: 'gray'
: edge.path.stroke!
"
:stroke-width="edge.from === active || edge.to === active ? 2 : 1"
></path>
<polygon v-bind="edge.poly"></polygon>
<polygon v-bind="edge.poly" fill="transparent"></polygon>
</g>
</g>
</svg>
Expand Down

0 comments on commit 8af32f6

Please sign in to comment.