Edge label positioning#533
Open
Wagner-Laranjeiras wants to merge 2 commits into
Open
Conversation
Contributor
|
Hi @Wagner-Laranjeiras , thanks for the contribution. This is a good start. However the approach completely bypasses the post-processing if the label has been placed by ELK. This create the issue that rotation and bounding to the edge are not preserved (making every label "free"). Ideally this should also be layout engine agnostic and not depend on sprotty-elk |
…positions instead of the edge midpoint (eclipse-sprotty#514) Signed-off-by: Wagner Laranjeiras <wagner.laranjeiras@typefox.io>
Wagner-Laranjeiras
force-pushed
the
wagner-laranjeiras/514/edge-label-positioning
branch
from
July 17, 2026 05:56
1e995d8 to
8aeaf9f
Compare
…e-label-positioning
Wagner-Laranjeiras
marked this pull request as ready for review
July 17, 2026 05:58
Author
|
thank you for your review @gfontorbe ! I worked on it. Here's the updated commit. 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #514: edge labels positioned by a layout engine (e.g. ELK) were being
re-placed at the edge's geometric midpoint at render time, ignoring the
engine's coordinates.
EdgeLayoutPostprocessornow honors an engine-assigned position: when anon-moveable edge label with no explicit
edgePlacementcarries a non-originposition, its center is projected onto the edge (deriving the anchor and
tangent) and the existing rotation/alignment pipeline is applied. Labels that
were never positioned still fall back to the previous midpoint behavior.
The change is engine-agnostic (it reads the label's own model position, with
no dependency on
sprotty-elk) and preserves rotation and edge-binding, asrequested in the review.
Changes
packages/sprotty/src/features/edge-layout/edge-layout.ts: project the labelcenter onto the edge for engine-positioned labels; extract the shared
applyRotationAndAlignmenthelper.Tests
EdgeLayoutPostprocessorcovering the fix, the no-regressionpaths (unpositioned/moveable/explicit
edgePlacement), the origin sentinel,and the nested-nodes "free space" case.
edge label, including a nested-nodes scenario where the label lands in the free
space between containers rather than at the edge midpoint.