Skip to content

Commit 87d3923

Browse files
committed
add active
1 parent f67ec75 commit 87d3923

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/layer/segmentation/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ import {
124124
parseArray,
125125
parseUint64,
126126
verifyArray,
127+
verifyBoolean,
127128
verifyFiniteNonNegativeFloat,
128129
verifyFloat,
129130
verifyObject,
@@ -146,6 +147,7 @@ const MAX_LAYER_BAR_UI_INDICATOR_COLORS = 6;
146147
export interface SegmentPropertyColor {
147148
type: "tag" | "numeric";
148149
property: string;
150+
active: boolean;
149151
map?: Map<string, string>; // TODO is there a color type?
150152
options?: {
151153
min: number;
@@ -334,6 +336,8 @@ export class SegmentationUserLayerColorGroupState
334336
console.log("tags", segmentPropertyMap.tags);
335337

336338
for (const propertyColor of segmentPropertyColors) {
339+
if (!propertyColor.active) continue;
340+
337341
if (propertyColor.type === "tag" && tagsProperty) {
338342
const { tags, values } = tagsProperty;
339343

@@ -460,6 +464,11 @@ export class SegmentationUserLayerColorGroupState
460464
"property",
461465
verifyString,
462466
);
467+
const active = verifyOptionalObjectProperty(
468+
propertyColor,
469+
"active",
470+
verifyBoolean,
471+
);
463472
if (type === "tag") {
464473
const map = verifyObjectProperty(
465474
propertyColor,
@@ -476,6 +485,7 @@ export class SegmentationUserLayerColorGroupState
476485
);
477486
this.segmentPropertyColors.value.push({
478487
type,
488+
active: active ?? true,
479489
property,
480490
map,
481491
});
@@ -508,6 +518,7 @@ export class SegmentationUserLayerColorGroupState
508518
);
509519
this.segmentPropertyColors.value.push({
510520
type,
521+
active: active ?? true,
511522
property,
512523
options,
513524
});
@@ -541,6 +552,7 @@ export class SegmentationUserLayerColorGroupState
541552
const p: any = {};
542553
p["type"] = propertyColor.type;
543554
p["property"] = propertyColor.property;
555+
p["active"] = propertyColor.active;
544556
if (propertyColor.type === "tag") {
545557
const map: any = (p[json_keys.MAP_JSON_KEY] = {});
546558
for (const [key, value] of propertyColor.map!.entries()) {

0 commit comments

Comments
 (0)