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

cornerstonejs tools convention: one tool multiple callbacks #254

Open
Ouwen opened this issue Oct 21, 2022 · 0 comments
Open

cornerstonejs tools convention: one tool multiple callbacks #254

Ouwen opened this issue Oct 21, 2022 · 0 comments

Comments

@Ouwen
Copy link
Contributor

Ouwen commented Oct 21, 2022

Current cornerstone tools follow the structure of callbacks which are associated with events. For example,
https://github.com/cornerstonejs/cornerstone3D-beta/blob/2a336d5bd6bb0af865d99ffd8af48ba1ce779f64/packages/tools/src/tools/StackScrollTool.ts#L15-L19

There are currently tool some duplicates for different input types (e.g.)
https://github.com/cornerstonejs/cornerstone3D-beta/blob/2a336d5bd6bb0af865d99ffd8af48ba1ce779f64/packages/tools/src/tools/StackScrollToolMouseWheelTool.ts#L14-L15

This requires users to register two tools:
StackScrollTool for touchDrag and mouseDrag events
StackScrollToolMouseWheelTool for mouseWheel events

Rather than having two separate tools, we can merge the functionality of the mouseWheel callback into the stackScrollTool and provide an API to configure these callbacks on/off without the need to register a separate tool such as the below.

{
   touchDragEnabled: boolean | (evt: EventTypes.MouseDragEventType) => boolean; 
   mouseDragEnabled: boolean | (evt: EventTypes.MouseDragEventType) => boolean; 
   mouseWheelEnabled: boolean | (evt: EventTypes.MouseDragEventType) => boolean
}
   

Same convention can be applied to v3 Pan / MultiTouchPan, StackScroll MultiTouch, Zoom / Zoom pinch / Zoom wheel.

wayfarer3130 pushed a commit that referenced this issue Jan 20, 2023
…tions (#254)

* chore: use the jest testing framework

* chore: switch to github actions

The NPM_TOKEN secret should be set in an environment called "publish"
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

No branches or pull requests

1 participant