mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-07 08:28:12 +08:00
Change appearance of centroid labels of unselected values (#1491)
* add opacity change on selection state * change overlay z-index to capture pointer * https://www.youtube.com/watch?v=xrg-RgF5F8o * render null if no coloring by continuous * run lint on push + pr * revert commit wrong branch
This commit is contained in:
@@ -8,6 +8,7 @@ export default
|
|||||||
colorAccessor: state.colors.colorAccessor,
|
colorAccessor: state.colors.colorAccessor,
|
||||||
dilatedValue: state.pointDilation.categoryField,
|
dilatedValue: state.pointDilation.categoryField,
|
||||||
labels: state.centroidLabels.labels,
|
labels: state.centroidLabels.labels,
|
||||||
|
categoricalSelection: state.categoricalSelection,
|
||||||
}))
|
}))
|
||||||
class CentroidLabels extends PureComponent {
|
class CentroidLabels extends PureComponent {
|
||||||
// Check to see if centroids have either just been displayed or removed from the overlay
|
// Check to see if centroids have either just been displayed or removed from the overlay
|
||||||
@@ -33,11 +34,21 @@ class CentroidLabels extends PureComponent {
|
|||||||
dilatedValue,
|
dilatedValue,
|
||||||
dispatch,
|
dispatch,
|
||||||
colorAccessor,
|
colorAccessor,
|
||||||
|
categoricalSelection,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
if (!colorAccessor || labels.size === undefined || labels.size === 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
const {
|
||||||
|
categoryValueIndices,
|
||||||
|
categoryValueSelected,
|
||||||
|
} = categoricalSelection?.[colorAccessor];
|
||||||
|
|
||||||
const labelSVGS = [];
|
const labelSVGS = [];
|
||||||
let fontSize = "15px";
|
let fontSize = "15px";
|
||||||
let fontWeight = null;
|
let fontWeight = null;
|
||||||
|
const deselectOpacity = 0.375;
|
||||||
labels.forEach((coords, label) => {
|
labels.forEach((coords, label) => {
|
||||||
fontSize = "15px";
|
fontSize = "15px";
|
||||||
fontWeight = null;
|
fontWeight = null;
|
||||||
@@ -46,6 +57,8 @@ class CentroidLabels extends PureComponent {
|
|||||||
fontWeight = "800";
|
fontWeight = "800";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selected = categoryValueSelected[categoryValueIndices.get(label)];
|
||||||
|
|
||||||
// Mirror LSB middle truncation
|
// Mirror LSB middle truncation
|
||||||
let displayLabel = label;
|
let displayLabel = label;
|
||||||
if (displayLabel.length > categoryLabelDisplayStringLongLength) {
|
if (displayLabel.length > categoryLabelDisplayStringLongLength) {
|
||||||
@@ -77,6 +90,7 @@ class CentroidLabels extends PureComponent {
|
|||||||
fontWeight,
|
fontWeight,
|
||||||
fill: "black",
|
fill: "black",
|
||||||
userSelect: "none",
|
userSelect: "none",
|
||||||
|
opacity: selected ? 1 : deselectOpacity,
|
||||||
}}
|
}}
|
||||||
onMouseEnter={(e) =>
|
onMouseEnter={(e) =>
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export default class GraphOverlayLayer extends PureComponent {
|
|||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
zIndex: 1,
|
zIndex: 2,
|
||||||
backgroundColor: displaying ? "rgba(255, 255, 255, 0.55)" : "",
|
backgroundColor: displaying ? "rgba(255, 255, 255, 0.55)" : "",
|
||||||
}}
|
}}
|
||||||
onMouseMove={handleCanvasEvent}
|
onMouseMove={handleCanvasEvent}
|
||||||
|
|||||||
Reference in New Issue
Block a user