Skip to content

Commit d6a4380

Browse files
committed
fix(reslicecursor): fix camera update when mouse wheel on rotation handle
When the cursor is hover the rotation handle, a mouse wheel event wrongly assumes that the rotation line action was active.
1 parent 5f98f55 commit d6a4380

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Sources/Widgets/Core/AbstractWidget/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function extend(publicAPI, model, initialValues = {}) {
112112
macro.get(publicAPI, model, [
113113
'representations',
114114
'widgetState',
115-
'activeState',
115+
'activeState', // stores the last activated sub state(handle)
116116
]);
117117
macro.moveToProtected(publicAPI, model, ['widgetManager']);
118118
macro.event(publicAPI, model, 'ActivateHandle');

Sources/Widgets/Widgets3D/ResliceCursorWidget/behavior.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,10 @@ export default function widgetBehavior(publicAPI, model) {
226226
isScrolling = true;
227227
publicAPI.translateCenterOnPlaneDirection(step);
228228

229-
publicAPI.invokeInternalInteractionEvent();
229+
publicAPI.invokeInternalInteractionEvent(
230+
// Force interaction mode because mouse cursor could be above rotation handle
231+
InteractionMethodsName.TranslateCenter
232+
);
230233
isScrolling = false;
231234

232235
return macro.EVENT_ABORT;
@@ -256,15 +259,17 @@ export default function widgetBehavior(publicAPI, model) {
256259

257260
publicAPI.handleEvent = (callData) => {
258261
if (model.activeState.getActive()) {
259-
publicAPI[publicAPI.getActiveInteraction()](callData);
260-
publicAPI.invokeInternalInteractionEvent();
262+
const methodName = publicAPI.getActiveInteraction();
263+
publicAPI[methodName](callData);
264+
publicAPI.invokeInternalInteractionEvent(methodName);
261265
return macro.EVENT_ABORT;
262266
}
263267
return macro.VOID;
264268
};
265269

266-
publicAPI.invokeInternalInteractionEvent = () => {
267-
const methodName = publicAPI.getActiveInteraction();
270+
publicAPI.invokeInternalInteractionEvent = (
271+
methodName = publicAPI.getActiveInteraction()
272+
) => {
268273
const computeFocalPointOffset =
269274
methodName !== InteractionMethodsName.RotateLine;
270275
const canUpdateFocalPoint =

0 commit comments

Comments
 (0)