feat!: ease the configuration to rotate the selected vertex #480
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.
Previously, it was hard to enable rotation, because the
VertexHandler.rotationEnabledproperty value was used in the constructor. The sole solution was to overrideVertexHandler.isRotationHandleVisibleto ignore the value ofrotationEnabled.In
mxGraphthis was advised to do change the value globally by updating the prototype of the VertexHandler rotationEnabled propertyThis no longer works in maxGraph (VertexHandler is defined as an ES6 class).
The
rotationEnabledproperty has been removed. Instead, the value is now stored in a global configuration state:VertexHandlerConfig.rotationEnabledIt is also possible to override a newVertexHandler.isRotationEnabledto enable the rotation for a single Graph implementation.Each of the 2 methods is used separately in the
HandlesandStencilsstories for demonstration. The Handles story has been migrated to TypeScript to ease the maintenanceIn addition, improve JSDoc and type usage in some other handlers
BREAKING CHANGES:
VertexHandler.rotationEnabledhas been removed as it was not possible to correctly change its value.Use
VertexHandlerConfig.rotationEnabledto configure the rotation behavior globally or override theVertexHandler.isRotationEnabledmethod.Notes
Closes #267
New behavior in the updated stories
Handles
story_handles.mp4
Stencils
story_stencils.mp4