Skip to content

fix: correctly update style when calling Graph methods - #380

Merged
tbouffard merged 3 commits into
mainfrom
fix/model_update_style
Apr 8, 2024
Merged

fix: correctly update style when calling Graph methods#380
tbouffard merged 3 commits into
mainfrom
fix/model_update_style

Conversation

@tbouffard

@tbouffard tbouffard commented Apr 4, 2024

Copy link
Copy Markdown
Member

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.
Also fix the signature of Graph.setCellStyle as the cells parameter is optional (previously, it was marked as mandatory).

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 exhibited 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.

Notes

Closes #326

Monitor story

This PR fix the problem described in #325.

mxGraph
mxGraph

maxGraph PR 325
maxGraph_PR_325

now with this PR

PR_.380_Monitor_story.mp4

`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 tbouffard added the bug Something isn't working label Apr 4, 2024
@tbouffard tbouffard changed the title fix: correctly set style update when calling Graph methods fix: correctly set update style when calling Graph methods Apr 5, 2024
@tbouffard tbouffard changed the title fix: correctly set update style when calling Graph methods fix: correctly update style when calling Graph methods Apr 5, 2024
@tbouffard
tbouffard marked this pull request as ready for review April 5, 2024 11:30
Comment thread packages/core/src/view/mixins/CellsMixin.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graph.setCellStyles may not propagate style changes

1 participant