From a998a424adf81c02f8aa5f95c62d54cc37b82ce8 Mon Sep 17 00:00:00 2001 From: Brianna Major Date: Tue, 14 Nov 2023 11:09:57 -0500 Subject: [PATCH] refactor(opacityShift): Rename variables for clarity --- src/components/VolumeRendering.vue | 6 +++--- src/vtk/PiecewiseWidget/index.js | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/VolumeRendering.vue b/src/components/VolumeRendering.vue index 98498629d..0e71385f2 100644 --- a/src/components/VolumeRendering.vue +++ b/src/components/VolumeRendering.vue @@ -120,7 +120,7 @@ export default defineComponent({ { mode, shift: pwfWidget.getOpacityPointShift(), - shiftAlpha: pwfWidget.getOpacityAlphaShift(), + shiftAlpha: pwfWidget.getOpacityValueShift(), } ); } @@ -282,8 +282,8 @@ export default defineComponent({ const rangeShift = ref(0); const rangeWidth = ref(0); - onKeyDown('Control', () => pwfWidget.setCtrlKeyIsDown(true)); - onKeyUp('Control', () => pwfWidget.setCtrlKeyIsDown(false)); + onKeyDown('Control', () => pwfWidget.setShiftOpacityValues(true)); + onKeyUp('Control', () => pwfWidget.setShiftOpacityValues(false)); // reset case watch( diff --git a/src/vtk/PiecewiseWidget/index.js b/src/vtk/PiecewiseWidget/index.js index d6d9ab62c..88d513eff 100644 --- a/src/vtk/PiecewiseWidget/index.js +++ b/src/vtk/PiecewiseWidget/index.js @@ -75,7 +75,7 @@ function vtkPiecewiseWidget(publicAPI, model) { model.pwMode = Mode.Gaussians; model.opacityPoints = []; model.opacityPointShift = 0; - model.opacityAlphaShift = 0; + model.opacityValueShift = 0; publicAPI.setGaussiansMode = () => { model.pwMode = Mode.Gaussians; @@ -92,9 +92,9 @@ function vtkPiecewiseWidget(publicAPI, model) { publicAPI.getMode = () => model.pwMode; publicAPI.shiftPosition = (coords, meta) => { - if (model.ctrlKeyIsDown) { - model.opacityAlphaShift = - meta.originalOpacityAlphaShift + coords[1] - meta.originalXY[1]; + if (model.shiftOpacityValues) { + model.opacityValueShift = + meta.originalOpacityValueShift + coords[1] - meta.originalXY[1]; } else { model.opacityPointShift = meta.originalOpacityPointShift + coords[0] - meta.originalXY[0]; @@ -137,7 +137,7 @@ function vtkPiecewiseWidget(publicAPI, model) { model.dragAction = { originalXY: mouseCoords, originalOpacityPointShift: model.opacityPointShift, - originalOpacityAlphaShift: model.opacityAlphaShift, + originalOpacityValueShift: model.opacityValueShift, }; return true; @@ -157,7 +157,7 @@ function vtkPiecewiseWidget(publicAPI, model) { model.opacities = samplePiecewiseLinear( model.opacityPoints, model.opacityPointShift, - model.opacityAlphaShift + model.opacityValueShift ); publicAPI.invokeOpacityChange(publicAPI, true); } @@ -171,12 +171,12 @@ function vtkPiecewiseWidget(publicAPI, model) { // deep copy model.opacityPoints = points.map((p) => [p[0], p[1]]); model.opacityPointShift = shift; - model.opacityAlphaShift = shiftAlpha; + model.opacityValueShift = shiftAlpha; model.opacities = samplePiecewiseLinear( model.opacityPoints, model.opacityPointShift, - model.opacityAlphaShift + model.opacityValueShift ); publicAPI.modified(); } @@ -185,7 +185,7 @@ function vtkPiecewiseWidget(publicAPI, model) { publicAPI.getEffectiveOpacityPoints = () => model.opacityPoints.map((p) => [ p[0] + model.opacityPointShift, - p[1] + model.opacityAlphaShift, + p[1] + model.opacityValueShift, ]); publicAPI.render = () => { @@ -213,8 +213,8 @@ export function extend(publicAPI, model, initialValues = {}) { macro.setGet(publicAPI, model, [ 'opacityPoints', 'opacityPointShift', - 'opacityAlphaShift', - 'ctrlKeyIsDown', + 'opacityValueShift', + 'shiftOpacityValues', ]); // Object specific methods