fix(editor): Address edge toolbar rendering glitches (#10839)

This commit is contained in:
Raúl Gómez Morales
2024-09-17 11:22:49 +02:00
committed by GitHub
parent 7f4ef31507
commit e0c0ddee59
5 changed files with 94 additions and 66 deletions

View File

@@ -7,7 +7,6 @@ import type {
ConnectStartEvent,
} from '@/types';
import type {
EdgeMouseEvent,
Connection,
XYPosition,
ViewportTransform,
@@ -31,6 +30,7 @@ import { isPresent } from '@/utils/typesUtils';
import { GRID_SIZE } from '@/utils/nodeViewUtils';
import { CanvasKey } from '@/constants';
import { onKeyDown, onKeyUp } from '@vueuse/core';
import CanvasArrowHeadMarker from './elements/edges/CanvasArrowHeadMarker.vue';
const $style = useCssModule();
@@ -261,19 +261,7 @@ function onClickConnectionAdd(connection: Connection) {
emit('click:connection:add', connection);
}
/**
* Connection hover
*/
const hoveredEdges = ref<Record<string, boolean>>({});
function onMouseEnterEdge(event: EdgeMouseEvent) {
hoveredEdges.value[event.edge.id] = true;
}
function onMouseLeaveEdge(event: EdgeMouseEvent) {
hoveredEdges.value[event.edge.id] = false;
}
const arrowHeadMarkerId = ref('custom-arrow-head');
/**
* Executions
@@ -511,8 +499,6 @@ provide(CanvasKey, {
:selection-key-code="selectionKeyCode"
:pan-activation-key-code="panningKeyCode"
data-test-id="canvas"
@edge-mouse-enter="onMouseEnterEdge"
@edge-mouse-leave="onMouseLeaveEdge"
@connect-start="onConnectStart"
@connect="onConnect"
@connect-end="onConnectEnd"
@@ -543,8 +529,8 @@ provide(CanvasKey, {
<template #edge-canvas-edge="canvasEdgeProps">
<Edge
v-bind="canvasEdgeProps"
:marker-end="`url(#${arrowHeadMarkerId})`"
:read-only="readOnly"
:hovered="hoveredEdges[canvasEdgeProps.id]"
@add="onClickConnectionAdd"
@delete="onDeleteConnection"
/>
@@ -554,6 +540,8 @@ provide(CanvasKey, {
<CanvasConnectionLine v-bind="connectionLineProps" />
</template>
<CanvasArrowHeadMarker :id="arrowHeadMarkerId" />
<Background data-test-id="canvas-background" pattern-color="#aaa" :gap="GRID_SIZE" />
<Transition name="minimap">