add context sensitivity to annotation "label" menu item (#1015)

* cache common results to reduce jank

* add util function in support of annotation labelling

* enable/disable annotation edit menus per issue 972; improve formatting

* PR review requests
This commit is contained in:
Bruce Martin
2019-11-04 14:22:38 -08:00
committed by GitHub
parent 823d819eee
commit 7599af451f
6 changed files with 223 additions and 101 deletions
+6 -6
View File
@@ -1,8 +1,8 @@
import { unassignedCategoryLabel } from "../globals";
import {
World,
ControlsHelpers as CH,
AnnotationsHelpers as AH
ControlsHelpers,
AnnotationsHelpers
} from "../util/stateManager";
import clip from "../util/clip";
import quantile from "../util/quantile";
@@ -92,7 +92,7 @@ const WorldReducer = (
Object.keys(action.expressionData)
)
];
unclippedVarData = CH.pruneVarDataCache(
unclippedVarData = ControlsHelpers.pruneVarDataCache(
unclippedVarData,
allTheGenesWeNeed
);
@@ -208,7 +208,7 @@ const WorldReducer = (
/* set all values to to new label */
const unclipped = {
...state.unclipped,
obsAnnotations: AH.setLabelByValue(
obsAnnotations: AnnotationsHelpers.setLabelByValue(
state.unclipped.obsAnnotations,
metadataField,
oldLabelName,
@@ -229,7 +229,7 @@ const WorldReducer = (
/* set all values to unassigned in obsAnnotations */
const unclipped = {
...state.unclipped,
obsAnnotations: AH.setLabelByValue(
obsAnnotations: AnnotationsHelpers.setLabelByValue(
state.unclipped.obsAnnotations,
metadataField,
label,
@@ -249,7 +249,7 @@ const WorldReducer = (
const mask = crossfilter.allSelectedMask();
const unclipped = {
...state.unclipped,
obsAnnotations: AH.setLabelByMask(
obsAnnotations: AnnotationsHelpers.setLabelByMask(
state.unclipped.obsAnnotations,
metadataField,
mask,