Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Sources/Widgets/Widgets3D/PaintWidget/behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@ import macro from 'vtk.js/Sources/macros';
import { vec3 } from 'gl-matrix';

export default function widgetBehavior(publicAPI, model) {
// --------------------------------------------------------------------------
// Interactor events
// --------------------------------------------------------------------------

function ignoreKey(e) {
return e.altKey || e.controlKey || e.shiftKey;
}

publicAPI.handleLeftButtonPress = (callData) => {
if (!model.activeState || !model.activeState.getActive()) {
// if (!model.activeState || !model.activeState.getActive()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this comment.

if (
!model.activeState ||
!model.activeState.getActive() ||
ignoreKey(callData)
) {
return macro.VOID;
}

Expand Down
11 changes: 10 additions & 1 deletion Sources/Widgets/Widgets3D/ShapeWidget/behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,14 @@ export default function widgetBehavior(publicAPI, model) {
return model.hasFocus ? macro.EVENT_ABORT : macro.VOID;
};

// --------------------------------------------------------------------------
// Interactor events
// --------------------------------------------------------------------------

function ignoreKey(e) {
return e.altKey || e.controlKey || e.shiftKey;
}

// --------------------------------------------------------------------------
// Left click: Add point / End interaction
// --------------------------------------------------------------------------
Expand All @@ -514,7 +522,8 @@ export default function widgetBehavior(publicAPI, model) {
if (
!model.activeState ||
!model.activeState.getActive() ||
!model.pickable
!model.pickable ||
ignoreKey(e)
) {
return macro.VOID;
}
Expand Down
14 changes: 12 additions & 2 deletions Sources/Widgets/Widgets3D/SplineWidget/behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ export default function widgetBehavior(publicAPI, model) {
model.firstHandle = null;
};

// --------------------------------------------------------------------------
// Interactor events
// --------------------------------------------------------------------------

function ignoreKey(e) {
return e.altKey || e.controlKey || e.shiftKey;
}

// --------------------------------------------------------------------------
// Right click: Delete handle
// --------------------------------------------------------------------------
Expand All @@ -144,7 +152,8 @@ export default function widgetBehavior(publicAPI, model) {
if (
!model.activeState ||
!model.activeState.getActive() ||
!model.pickable
!model.pickable ||
ignoreKey(e)
) {
return macro.VOID;
}
Expand Down Expand Up @@ -179,7 +188,8 @@ export default function widgetBehavior(publicAPI, model) {
if (
!model.activeState ||
!model.activeState.getActive() ||
!model.pickable
!model.pickable ||
ignoreKey(e)
) {
return macro.VOID;
}
Expand Down