feat!: ease the configuration to rotate the selected vertex by tbouffard · Pull Request #480 · maxGraph/maxGraph

@tbouffard

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.

This was referenced

Jun 29, 2024

tbouffard

@tbouffard tbouffard marked this pull request as ready for review

July 1, 2024 05:18

@tbouffard tbouffard deleted the refactor/improve_type_VertexHandler branch

July 1, 2024 05:18