Files
ueblueprint/scss/ueb-link.scss
2022-03-27 13:42:20 +02:00

57 lines
2.0 KiB
SCSS

ueb-link {
--ueb-from-input-coefficient: calc(2 * var(--ueb-from-input) - 1);
/* when from-y > to-y */
--ueb-y-opposite : clamp(0, var(--ueb-from-y) - var(--ueb-to-y) - 1, 1);
display : block;
min-width : calc(var(--ueb-link-min-width) * 1px);
/*
* This makes the element transparent to the hover events so that multiple path elements can stand nearby and have
* their hover behavior correctly firing.
*/
visibility : hidden;
}
ueb-link svg {
--ueb-y-opposite-coefficient: calc(2* var(--ueb-y-opposite) - 1);
position : absolute;
top : 0;
left : 0;
width : 100%;
height : 100%;
min-height : 1px;
transform : scaleY(calc(var(--ueb-y-opposite-coefficient) * var(--ueb-from-input-coefficient)));
overflow : visible;
}
ueb-link svg path {
visibility : visible;
stroke : var(--ueb-pin-color);
stroke-width: 1;
}
ueb-link.ueb-link-dragging svg path,
ueb-link svg g:hover path {
stroke-width: 5;
transition : stroke-width 0.8s;
}
ueb-link-message {
display : block;
visibility: visible;
position : absolute;
top : calc(100% * (1 - var(--ueb-y-opposite)) + 22px);
left : calc(
/* If originates from an output pin, start with 100% */
(1 - var(--ueb-from-input)) * 100%
/* If originates from an input pin, then sum, otherwise subtract */
+ (var(--ueb-from-input-coefficient)) * var(--ueb-start-percentage)
/* Fixed offset */
+ 15px);
border : 1px solid #000;
padding : 4px 8px;
border-radius: 2px;
background : linear-gradient(to bottom, #2a2a2a 0, #151515 50%, #2a2a2a 100%);
color : var(--ueb-pin-dim-color);
white-space : nowrap;
z-index : 1000000;
}