fix: correctly update style when calling Graph methods - #380
Merged
Conversation
`GraphDataModel.setStyle` does the actual style change. Its current implementation requires to pass an instance of CellStyle which is different from the current style hold by the Cell. Previously, the Graph methods directly update the Cell style instance prior calling the style update so nothing happened. The problem was spotted in the Monitor story which is now fixed. Introduce a convenient `Cell.getClonedStyle` method to ease style update and update the JSDOC of several functions to warn users about how to correctly make the style update happen. The fix has a slight side effects exhibits by the EdgeMixin tests. The `sourcePort` and `targetPort` cell style properties are now set to null at vertex insertion. This should not have any effects for the end user.
tbouffard
marked this pull request as ready for review
April 5, 2024 11:30
tbouffard
commented
Apr 8, 2024
# Conflicts: # packages/core/__tests__/util/styleUtils.test.ts
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.
GraphDataModel.setStyledoes the actual style change. Its current implementation requires to pass an instance of CellStyle which is different from the current style hold by the Cell. Previously, the Graph methods directly update the Cell style instance prior calling the style update so nothing happened.The problem was spotted in the Monitor story which is now fixed.
Also fix the signature of Graph.setCellStyle as the
cellsparameter is optional (previously, it was marked as mandatory).Introduce a convenient
Cell.getClonedStylemethod to ease style update and update the JSDOC of several functions to warn users about how to correctly make the style update happen.The fix has a slight side effects exhibited by the EdgeMixin tests. The
sourcePortandtargetPortcell style properties are now set to null at vertex insertion. This should not have any effects for the end user.Notes
Closes #326
Monitor story
This PR fix the problem described in #325.
mxGraph

maxGraph PR 325

now with this PR
PR_.380_Monitor_story.mp4