You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Link#label()/labels() always return a label exactly as stored, leaving every caller to separately re-resolve it against defaultLabel/the built-in default. LinkView duplicated that merge logic in several places (rendering, label dragging, RotateLabel).
Adds getComputedLabel(index?)/getComputedLabels(), which return each label resolved against defaultLabel/the built-in default, centralizing that resolution into a new link-labels.mjs. LinkView now calls these instead of re-implementing the merge inline.
A label (or defaultLabel) may carry custom properties beyond markup/attrs/size/position - these pass through resolution unmodified, with the label's own value winning over defaultLabel's.
label()/labels() themselves are unchanged - still raw, as stored.
Test plan
grunt karma:joint - 2117/2119 passing; the 2 failures (util.breakText ellipsis, element ports > port labels label attributes) are pre-existing, unrelated to this change (confirmed present on a clean upstream/master checkout too, both in unrelated subsystems - text measurement and port label rotation matrix precision)
grunt test:ts - passing
New QUnit coverage for getComputedLabel/getComputedLabels (resolution against defaultLabel, custom property pass-through) in test/jointjs/links.js
label()/labels() always returned a label exactly as stored, leaving every
caller to separately re-resolve it against defaultLabel/the built-in default
(LinkView duplicated this merge logic in several places: rendering, label
dragging, RotateLabel). getComputedLabel()/getComputedLabels() centralize
that resolution in link-labels.mjs and expose it directly, and LinkView now
calls them instead of re-implementing the merge inline.
A label (or defaultLabel) may also carry custom properties beyond markup/
attrs/size/position - these pass through resolution unmodified, with the
label's own value winning over defaultLabel's.
This removes the method's existing support for a numeric label position: getLabelCoordinates(0.5) now reads 0.5.distance and throws, even though Link.Label.position still supports numbers. Normalize a numeric argument before validating the position object so existing JavaScript callers continue to work.
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
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
Link#label()/labels()always return a label exactly as stored, leaving every caller to separately re-resolve it againstdefaultLabel/the built-in default.LinkViewduplicated that merge logic in several places (rendering, label dragging,RotateLabel).getComputedLabel(index?)/getComputedLabels(), which return each label resolved againstdefaultLabel/the built-in default, centralizing that resolution into a newlink-labels.mjs.LinkViewnow calls these instead of re-implementing the merge inline.defaultLabel) may carry custom properties beyondmarkup/attrs/size/position- these pass through resolution unmodified, with the label's own value winning overdefaultLabel's.label()/labels()themselves are unchanged - still raw, as stored.Test plan
grunt karma:joint- 2117/2119 passing; the 2 failures (util.breakText ellipsis,element ports > port labels label attributes) are pre-existing, unrelated to this change (confirmed present on a cleanupstream/mastercheckout too, both in unrelated subsystems - text measurement and port label rotation matrix precision)grunt test:ts- passinggetComputedLabel/getComputedLabels(resolution againstdefaultLabel, custom property pass-through) intest/jointjs/links.js