Skip to content

Commit

Permalink
refactor(opacityShift): Rename variables for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
bnmajor committed Nov 14, 2023
1 parent 858a25f commit a998a42
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/components/VolumeRendering.vue
Original file line number Diff line number Diff line change
@@ -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(
22 changes: 11 additions & 11 deletions src/vtk/PiecewiseWidget/index.js
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a998a42

Please sign in to comment.