Skip to content

Commit

Permalink
Only enable selections when config showing & fix enable/disableSelect…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
VictoriaBeilsten-Edmands authored and PeterC-DLS committed Oct 9, 2024
1 parent 3e932dd commit 5cf00b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/component/src/ConnectedPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ function ConnectedPlot({
broadcast = true,
clear = false
) => {
const id = hUpdateSelection(selection, clear);
const id = hUpdateSelection(selection, broadcast, clear);
if (broadcast) {
if (clear) {
sendClientMessage('clear_selection_data', {
Expand Down
8 changes: 5 additions & 3 deletions client/component/src/PlotToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,18 @@ function PlotToolbar(props: PropsWithChildren): JSX.Element {
const last = selections[selections.length - 1];
console.log('Setting current selection', last.id);
setCurrentSelectionID(last.id);
enableSelection(last);
if (showSelectionConfig) {
enableSelection(last);
}
}
} else {
} else if (showSelectionConfig) {
const selection = selections.find((s) => s.id === currentSelectionID);
if (selection) {
enableSelection(selection);
}
}
}
}, [canSelect, currentSelectionID, selections]);
}, [canSelect, currentSelectionID, selections, showSelectionConfig]);

const isLine = plotType === 'Line';
const isHeatmap = plotType === 'Heatmap';
Expand Down
4 changes: 2 additions & 2 deletions client/component/src/selections/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ function useSelections(initSelections?: SelectionBase[]) {
* Set fixed and asDashed properties of selection to false.
* @param {SelectionBase} s - The selection to modify.
*/
function enableSelection(s: SelectionBase) {
function disableSelection(s: SelectionBase) {
s.fixed = false;
s.asDashed = false;
}
Expand All @@ -601,7 +601,7 @@ function enableSelection(s: SelectionBase) {
* Set fixed and asDashed properties of selection to true.
* @param {SelectionBase} s - The selection to modify.
*/
function disableSelection(s: SelectionBase) {
function enableSelection(s: SelectionBase) {
s.fixed = true;
s.asDashed = true;
}
Expand Down

0 comments on commit 5cf00b3

Please sign in to comment.