Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow transforming selection in SelectionTool #1301

Merged
merged 1 commit into from
Nov 28, 2022
Merged

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Nov 28, 2022

  • I add a prop called transformSelection to SelectionTool, which allows transforming the selection before it gets passed to onSelectionChange, onSelectionEnd and the children render prop. This cleans up the code of AxialSelectionTool quite a bit, since we no longer have to monkey-patch those three props in order to turn the user's selection into an axial selection.
  • I change the way AxialSelectionTool transforms the user's selection into an axial selection. Instead of doing data -> world -> data, we now just do world -> data. See comments.
  • I move the dimension mapper's Axis type ('x' | 'y') into @h5web/shared so I can re-use it everywhere. The name technically conflicts with our Axis component, but it doesn't seem to be a problem for now.

@axelboc axelboc force-pushed the transform-selection branch from 748dff1 to 31107bd Compare November 28, 2022 10:00
@axelboc axelboc requested a review from loichuder November 28, 2022 10:02
@axelboc axelboc force-pushed the transform-selection branch from 31107bd to 9b7aee3 Compare November 28, 2022 10:31
Copy link
Member

@loichuder loichuder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great 👍

packages/lib/src/interactions/SelectionTool.tsx Outdated Show resolved Hide resolved
@axelboc axelboc force-pushed the transform-selection branch from 9b7aee3 to 6f23f8e Compare November 28, 2022 14:21
@axelboc axelboc merged commit b3ff1b3 into main Nov 28, 2022
@axelboc axelboc deleted the transform-selection branch November 28, 2022 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants