Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement partially transparent visualizations #11582

Merged
merged 8 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
- [Table Input Widget is now matched for Table.input method instead of
Table.new. Values must be string literals, and their content is parsed to the
suitable type][11612].
- [Visualizations on components are slightly transparent when not
focused][11582].
- [New design for vector-editing widget][11620]

[11151]: https://github.com/enso-org/enso/pull/11151
Expand All @@ -56,6 +58,7 @@
[11564]: https://github.com/enso-org/enso/pull/11564
[11597]: https://github.com/enso-org/enso/pull/11597
[11612]: https://github.com/enso-org/enso/pull/11612
[11582]: https://github.com/enso-org/enso/pull/11582
[11620]: https://github.com/enso-org/enso/pull/11620

#### Enso Standard Library
Expand Down
11 changes: 6 additions & 5 deletions app/gui/src/project-view/components/GraphEditor/GraphEdge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function junctionPoints(inputs: Inputs): JunctionPoints | null {
const halfSourceSize = inputs.sourceSize?.scale(0.5) ?? Vec2.Zero
// The maximum x-distance from the source (our local coordinate origin) for the point where the
// edge will begin.
const sourceMaxXOffset = Math.max(halfSourceSize.x - theme.node.corner_radius, 0)
const sourceMaxXOffset = Math.max(halfSourceSize.x, 0)
const attachmentTarget = inputs.targetOffset
const targetWellBelowSource = inputs.targetOffset.y >= theme.edge.min_approach_height
const targetBelowSource = inputs.targetOffset.y > 0
Expand Down Expand Up @@ -388,10 +388,11 @@ function render(sourcePos: Vec2, elements: Element[]): string {
const sourceOriginPoint = computed(() => {
const source = sourceRect.value
if (source == null) return null
const sourceStartPosY = Math.max(
source.top + theme.node.corner_radius,
source.bottom - theme.node.corner_radius,
)
const target = targetPos.value
const targetAbove = target != null ? target.y < source.bottom : false
const targetAside = target != null ? source.left > target.x || source.right < target.x : false
const offset = targetAside || targetAbove ? theme.node.corner_radius : 0
const sourceStartPosY = Math.max(source.top + offset, source.bottom - offset)
return new Vec2(source.center().x, sourceStartPosY)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ const dragPointer = usePointer(
{ pointerCapturedBy: 'target' },
)
const isDragged = computed(() => dragPointer.dragging && significantMove.value)
watch(isDragged, () => graph.db.moveNodeToTop(nodeId.value))

const isRecordingOverridden = computed({
get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ customElements.define(ensoVisualizationHost, defineCustomElement(VisualizationHo
</script>

<template>
<div class="GraphVisualization" :style="style">
<div class="GraphVisualization" :style="style" :class="{ isFocused }">
<WithFullscreenMode :fullscreen="isFullscreen" @update:animating="fullscreenAnimating = $event">
<div
ref="panelElement"
Expand Down Expand Up @@ -280,6 +280,11 @@ customElements.define(ensoVisualizationHost, defineCustomElement(VisualizationHo
background: var(--color-visualization-bg);
/** Prevent drawing on top of other UI elements (e.g. dropdown widgets). */
isolation: isolate;
opacity: 0.9;
}

.isFocused {
opacity: 1;
}

.VisualizationPanel {
Expand Down
Loading