Skip to content

Commit

Permalink
Refactor addManipulationBindings function to accept options object
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi committed Feb 6, 2024
1 parent 5b16161 commit 72bb717
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions utils/demo/helpers/addManipulationBindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,27 @@ let registered = false;
*/
export default function addManipulationBindings(
toolGroup,
register = true,
options?
options: {
enableShiftClickZoom?: boolean;
is3DViewport?: boolean;
}
) {
const zoomBindings: Types.IToolBinding[] = [
{
mouseButton: MouseBindings.Secondary,
},
];

if (options?.enableShiftClickZoom === true) {
const { is3DViewport = false, enableShiftClickZoom = false } = options;

if (enableShiftClickZoom === true) {
zoomBindings.push({
mouseButton: MouseBindings.Primary, // Shift Left Click
modifierKey: KeyboardBindings.Shift,
});
}

if (register) {
if (!registered) {
cornerstoneTools.addTool(LengthTool);
cornerstoneTools.addTool(StackScrollMouseWheelTool);
cornerstoneTools.addTool(PanTool);
Expand Down Expand Up @@ -71,10 +75,6 @@ export default function addManipulationBindings(
{
mouseButton: MouseBindings.Auxiliary,
},
{
mouseButton: MouseBindings.Primary, // Ctrl Left drag
modifierKey: KeyboardBindings.Ctrl,
},
],
});
toolGroup.setToolActive(ZoomTool.toolName, {
Expand Down

0 comments on commit 72bb717

Please sign in to comment.