diff --git a/v3/src/components/data-display/components/legend/categorical-legend.tsx b/v3/src/components/data-display/components/legend/categorical-legend.tsx index dd3ff3401..1d87f7fd6 100644 --- a/v3/src/components/data-display/components/legend/categorical-legend.tsx +++ b/v3/src/components/data-display/components/legend/categorical-legend.tsx @@ -2,7 +2,7 @@ import {observer} from "mobx-react-lite" import {mstReaction} from "../../../../utilities/mst-reaction" import {comparer, reaction} from "mobx" import {drag, range, select} from "d3" -import React, {useCallback, useEffect, useMemo, useRef, useState} from "react" +import React, {useCallback, useEffect, useMemo, useRef} from "react" import { logMessageWithReplacement } from "../../../../lib/log-message" // import { setOrExtendSelection } from "../../../../models/data/data-set-utils" import {isSelectionAction} from "../../../../models/data/data-set-actions" diff --git a/v3/src/components/data-display/inspector/display-item-format-control.tsx b/v3/src/components/data-display/inspector/display-item-format-control.tsx index 24c041ce8..22b391551 100644 --- a/v3/src/components/data-display/inspector/display-item-format-control.tsx +++ b/v3/src/components/data-display/inspector/display-item-format-control.tsx @@ -136,7 +136,7 @@ export const DisplayItemFormatControl = observer(function PointFormatControl(pro return ( {category} - handleCatPointColorChange(color, category)} swatchBackgroundColor={dataConfiguration.getLegendColorForCategory(category)}/> @@ -149,10 +149,10 @@ export const DisplayItemFormatControl = observer(function PointFormatControl(pro {t("DG.Inspector.legendColor")} {/* Sets the min and max colors for numeric legend. Currently not implemented so this sets the same color for all the points*/} - handlePointColorChange(color)} swatchBackgroundColor={displayItemDescription.pointColor}/> - handlePointColorChange(color)} swatchBackgroundColor={displayItemDescription.pointColor}/> diff --git a/v3/src/components/data-display/inspector/point-color-setting.tsx b/v3/src/components/data-display/inspector/point-color-setting.tsx index 5e661c770..6d079d818 100644 --- a/v3/src/components/data-display/inspector/point-color-setting.tsx +++ b/v3/src/components/data-display/inspector/point-color-setting.tsx @@ -13,16 +13,13 @@ import styles from "./point-color-setting-shared.scss" import "./point-color-setting.scss" interface ColorPickerIProps { - onColorChange: (color: string) => void | ((color: string, cat: string) => void) | - ((color: string, quantile: number) => void) + onColorChange: (color: string) => void propertyLabel: string swatchBackgroundColor: string - attrType?: string - quantile?: number } export const PointColorSetting = observer(function PointColorSetting({onColorChange, - propertyLabel, swatchBackgroundColor, attrType, quantile=0}: ColorPickerIProps) { + propertyLabel, swatchBackgroundColor}: ColorPickerIProps) { const [showColorPicker, setShowColorPicker] = useState(false) const [inputValue, setInputValue] = useState(missingColor) const popoverRef = useRef(null) @@ -34,7 +31,6 @@ export const PointColorSetting = observer(function PointColorSetting({onColorCha const paletteColors = ["#000000", "#a9a9a9", "#d3d3d3", "#FFFFFF", "#ad2323", "#ff9632", "#ffee33", "#1d6914", "#2a4bd7", "#814a19", "#8126c0", "#29d0d0", "#e9debb", "#ffcdf3", "#9dafff", "#81c57a"] - useOutsidePointerDown({ref: popoverContainerRef, handler: () => setOpenPopover?.(null)}) const handleSwatchClick = (cat: string) => { @@ -44,14 +40,8 @@ export const PointColorSetting = observer(function PointColorSetting({onColorCha const updateValue = useCallback((value: string) => { setInputValue(value) setNonStandardColorSelected(true) - if (attrType === "categorical") { - (onColorChange as (color: string, cat: string) => void)(value, propertyLabel) - } else if (attrType === "numeric") { - (onColorChange as (color: string, quantile: number) => void)(value, quantile) - } else { - (onColorChange as (color: string) => void)(value) - } - }, [attrType, propertyLabel]) + onColorChange(value) + }, [onColorChange]) const rejectValue = useCallback(() => { setShowColorPicker(false) diff --git a/v3/src/models/shared/shared-case-metadata.ts b/v3/src/models/shared/shared-case-metadata.ts index f2f63ff0d..90f345fc2 100644 --- a/v3/src/models/shared/shared-case-metadata.ts +++ b/v3/src/models/shared/shared-case-metadata.ts @@ -1,5 +1,5 @@ import { observable } from "mobx" -import { getSnapshot, getType, Instance, ISerializedActionCall, onAction, types } from "mobx-state-tree" +import { getSnapshot, getType, Instance, ISerializedActionCall, types } from "mobx-state-tree" import { onAnyAction } from "../../utilities/mst-utils" import { CategorySet, createProvisionalCategorySet, ICategorySet } from "../data/category-set" import { DataSet, IDataSet } from "../data/data-set"