Files
ueblueprint/scss/ueb-link.scss
2023-05-20 21:40:48 +02:00

83 lines
2.3 KiB
SCSS

@use "style.scss";
ueb-link {
position: absolute;
--ueb-link-color: rgb(var(--ueb-link-color-rgb));
--ueb-from-input-coefficient: calc(2 * var(--ueb-from-input) - 1);
/* when from-y > to-y */
--ueb-y-reflected: clamp(0, var(--ueb-from-y) - var(--ueb-to-y) - 1, 1);
display: block;
margin-left: calc(var(--ueb-link-start) * -1px);
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-reflected-coefficient: calc(2 * var(--ueb-y-reflected) - 1);
position: absolute;
width: 100%;
height: 100%;
min-height: 1px;
transform: scaleY(calc(var(--ueb-y-reflected-coefficient) * var(--ueb-from-input-coefficient)));
z-index: 1;
}
ueb-link .ueb-link-area path {
visibility: visible;
stroke: var(--ueb-link-color);
stroke-width: calc(1.5px / var(--ueb-scale));
}
ueb-link[data-dragging="true"] .ueb-link-area path,
ueb-link .ueb-link-area:hover path {
stroke-width: calc(6px / var(--ueb-scale));
transition: stroke-width 0.8s;
}
ueb-link[data-dragging="true"] .ueb-link-message {
display: block;
visibility: visible;
}
.ueb-link-message {
display: none;
position: absolute;
top: calc(100% * (1 - var(--ueb-y-reflected)) + 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;
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;
}
.ueb-link-message-icon {
display: inline-block;
padding: 4px;
width: 16px;
height: 16px;
vertical-align: middle;
}
.ueb-link-message-text {
padding: 4px;
padding-left: 0;
vertical-align: middle;
}
.ueb-link-message-icon svg {
width: 100%;
height: 100%;
}