Skip to content

Commit

Permalink
Filter to colored tips when applying measurements coloring
Browse files Browse the repository at this point in the history
Automatically filter to the colored tips when applying the measurements
coloring by clicking on the grouping in the measurements panel. The
filtering is _not_ applied when changing coloring via dropdown.

This commit also ensures that
1. tree visibility is updated when measurements coloring data changes
2. the measurements coloring filter is removed when no longer valid
  • Loading branch information
joverlee521 committed Jan 9, 2025
1 parent 972ed91 commit e586a6c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/actions/measurements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
MeasurementsState,
} from "../reducers/measurements/types";
import { changeColorBy } from "./colors";
import { applyFilter, updateVisibleTipsAndBranchThicknesses } from "./tree";

/**
* Temp object for groupings to keep track of values and their counts so that
Expand Down Expand Up @@ -738,6 +739,7 @@ function updateMeasurementsColorData(
details: "Falling back to the default color-by"
}));
dispatch(changeColorBy(defaultColorBy));
dispatch(applyFilter("remove", hasMeasurementColorAttr, [hasMeasurementColorValue]));
}
dispatch({
type: REMOVE_METADATA,
Expand All @@ -747,6 +749,7 @@ function updateMeasurementsColorData(
/* If there is a valid new color grouping, then add the measurement metadata and coloring */
if (newColorGrouping !== undefined) {
dispatch(addMeasurementsColorData(newColorGrouping));
dispatch(updateVisibleTipsAndBranchThicknesses());
}
}

Expand All @@ -770,6 +773,7 @@ export const applyMeasurementsColorBy = (
}
dispatch(addMeasurementsColorData(groupingValue));
dispatch(changeColorBy(encodeMeasurementColorBy(groupingValue)));
dispatch(applyFilter("add", hasMeasurementColorAttr, [hasMeasurementColorValue]))
});
}

Expand Down

0 comments on commit e586a6c

Please sign in to comment.