ffmpeg-explorer/src/ButtonEdge.svelte

64 lines
1.3 KiB
Svelte
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script>
import { BaseEdge, EdgeLabelRenderer, getBezierPath } from "@xyflow/svelte";
import { auto, removeEdge } from "./stores.js";
export let id;
export let sourceX;
export let sourceY;
export let targetX;
export let targetY;
export let sourcePosition;
export let targetPosition;
export let markerEnd;
$: positions = getBezierPath({
sourceX,
sourceY,
sourcePosition,
targetX,
targetY,
targetPosition,
});
$: edgePath = positions[0];
$: labelX = positions[1];
$: labelY = positions[2];
function onClick(e) {
e.stopPropagation();
removeEdge(id);
}
</script>
<BaseEdge path={edgePath} {markerEnd} />
<EdgeLabelRenderer>
<div
style="position: absolute; transform: translate(-50%, -50%) translate({labelX}px,{labelY}px); fontSize: 12; pointer-events: all"
class="nodrag nopan"
>
{#if !$auto}
<button class="edgebutton" on:click={onClick}>×</button>
{/if}
</div>
</EdgeLabelRenderer>
<style>
.edgebutton {
padding: 0;
top: -3px;
position: relative;
width: 8px;
height: 8px;
background: pink;
border: none;
cursor: pointer;
font-size: 8px;
line-height: 1;
box-shadow: none;
}
/* .edgebutton:hover { */
/* box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.08); */
/* } */
</style>