Skip to content

Conversation

@tbouffard
Copy link
Member

@tbouffard tbouffard commented Jun 29, 2024

Previously, it was hard to enable rotation, because the VertexHandler.rotationEnabled property value was used in the constructor. The sole solution was to override VertexHandler.isRotationHandleVisible to ignore the value of rotationEnabled.
In mxGraph this was advised to do change the value globally by updating the prototype of the VertexHandler rotationEnabled property
This no longer works in maxGraph (VertexHandler is defined as an ES6 class).

The rotationEnabled property has been removed. Instead, the value is now stored in a global configuration state: VertexHandlerConfig.rotationEnabled It is also possible to override a new VertexHandler.isRotationEnabled to enable the rotation for a single Graph implementation.

Each of the 2 methods is used separately in the Handles and Stencils stories for demonstration. The Handles story has been migrated to TypeScript to ease the maintenance

In addition, improve JSDoc and type usage in some other handlers

BREAKING CHANGES:
VertexHandler.rotationEnabled has been removed as it was not possible to correctly change its value.
Use VertexHandlerConfig.rotationEnabled to configure the rotation behavior globally or override the VertexHandler.isRotationEnabled method.

Notes

Closes #267

New behavior in the updated stories

Handles

story_handles.mp4

Stencils

story_stencils.mp4

Previously, it was hard to enable rotation, because the `VertexHandler.rotationEnabled` property
value was used in the constructor. The sole solution was to override `VertexHandler.isRotationHandleVisible`
to ignore the value of `rotationEnabled`.
In `mxGraph` this was advised to do change the value globally by updating the prototype of the
VertexHandler rotationEnabled property
This no longer works in maxGraph (VertexHandler is defined as an ES6 class).

The `rotationEnabled` property has been removed. Instead, the value is now stored in a global
configuration state: `VertexHandlerConfig.rotationEnabled`
It is also possible to override a new `VertexHandler.isRotationEnabled` to enable the rotation for a
single Graph implementation.

Each of the 2 methods is used separately in the `Handles` and `Stencils` stories for demonstration.
The Handles story has been migrated to TypeScript to ease the maintenance

In addition, improve JSDoc and type usage in some other handlers

BREAKING CHANGES:
`VertexHandler.rotationEnabled` has been removed as it was not possible to correctly change its value.
Use the `VertexHandlerConfig` class to configure the rotation behavior globally or override the new
`VertexHandler.isRotationEnabled` method.
@tbouffard tbouffard marked this pull request as ready for review July 1, 2024 05:18
@tbouffard tbouffard merged commit eb5077b into main Jul 1, 2024
@tbouffard tbouffard deleted the refactor/improve_type_VertexHandler branch July 1, 2024 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Question] How to use the VertexHandler rotationEnabled

1 participant