Skip to content

fix: allow to insert vertex without setting position and size#555

Merged
tbouffard merged 5 commits into
mainfrom
fix/VertexMixin_insertVertex_allow_optional_size_and_position
Nov 3, 2024
Merged

fix: allow to insert vertex without setting position and size#555
tbouffard merged 5 commits into
mainfrom
fix/VertexMixin_insertVertex_allow_optional_size_and_position

Conversation

@tbouffard

@tbouffard tbouffard commented Nov 2, 2024

Copy link
Copy Markdown
Member

This was allowed in mxGraph, and it is useful in scenario involving layouts (which is in charge of computing the position).
The size of a vertex is sometime computed after the insertion, like in the OrgChart story.

Update the signature of both the createVertex and insertVertex methods, and improve the related JSDoc.
When the position is not set, the default values of the Geometry instance are used.

Refactor tests: introduce helpers functions to remove duplication and make the expectations easier to read.

Notes

Detected in #532

This was allowed in mxGraph, and it is useful in scenario involving layouts (which is in charge of
computing the position).
The size of a vertex is sometime computed after the insertion, like in the OrgChart story.

Update the signature of both the createVertex and insertVertex methods, and improve the related JSDOC.
When the position is not set, the default values of the Geometry instance are used.

Refactor tests: introduce helpers functions to remove duplication and make the expectations easier
to read.
@tbouffard tbouffard added the bug Something isn't working label Nov 2, 2024
Comment thread packages/core/__tests__/view/mixins/VertexMixin.test.ts Outdated
@tbouffard tbouffard marked this pull request as ready for review November 3, 2024 10:46
@tbouffard tbouffard merged commit b5f4072 into main Nov 3, 2024
@tbouffard tbouffard deleted the fix/VertexMixin_insertVertex_allow_optional_size_and_position branch November 3, 2024 11:01
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.

1 participant