Skip to content
Open
12 changes: 7 additions & 5 deletions frontend/src/renderer/components/grid/HoverButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
IconEyeEdit,
IconTrash,
} from '@tabler/icons-react';
import { useHover } from '@mantine/hooks';
import { useElementSize, useHover, useMergedRef } from '@mantine/hooks';
import { Configuration, CustomizedGridType, DataGridPlot } from '../../types';
import {
applyRange,
Expand Down Expand Up @@ -52,6 +52,8 @@ export const HoverButtons = React.memo(
}: HoverButtonsProps) => {
const { active, updatedConfiguration } = useIbexStore();
const { hovered, ref: hoverRef } = useHover();
const { ref: sizeRef, width: containerWidth } = useElementSize();
const containerRef = useMergedRef(hoverRef, sizeRef);
const previousValueDisplayErrorBands = useRef<boolean | undefined>(
undefined,
);
Expand Down Expand Up @@ -185,7 +187,7 @@ export const HoverButtons = React.memo(
};

return (
<div ref={hoverRef} className={classes.containerButton}>
<div ref={containerRef} className={classes.containerButton}>
<Group justify="space-between" h={'100%'}>
{is3DView || !data.coordinates.length || shouldDisplayMetadata ? (
<Tabs
Expand All @@ -198,10 +200,10 @@ export const HoverButtons = React.memo(
scrollbarSize={6}
offsetScrollbars
maw={
hoverRef?.current?.offsetWidth
containerWidth
? !data.coordinates.length || shouldDisplayMetadata
? hoverRef.current.offsetWidth - 110
: hoverRef.current.offsetWidth - 230
? containerWidth - 110
: containerWidth - 280
: '100%'
}
>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/renderer/layout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ export function MainLayout() {
line: plot?.line || {},
customPreferences: plot?.customPreferences || {},
mode: plot?.mode || 'line',
smoothing: plot?.smoothing,
operations: plot?.operations,
};
}),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import {
CustomizeDataRange,
CustomizeSynchronization,
CustomizeInterpolation,
CustomizeSmoothing,
CustomizeUnaryOperations,
} from './customizableElements';
import { IconLink } from '@tabler/icons-react';
import { initPlotColors } from '../../utils';
Expand Down Expand Up @@ -454,6 +456,26 @@ const Customization = ({
/>
),
},
{
value: 'Data smoothing',
component: (
<CustomizeSmoothing
customizedDataGrid={customizedDataGrid}
selectedPlot={selectedPlot}
setCustomizedDataGrid={setCustomizedDataGrid}
/>
),
},
{
value: 'Unary operations',
component: (
<CustomizeUnaryOperations
customizedDataGrid={customizedDataGrid}
selectedPlot={selectedPlot}
setCustomizedDataGrid={setCustomizedDataGrid}
/>
),
},
];

const items = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
getUrisToInterpolate,
getVectorData,
normalizeIndices,
reapplyAxisOrder,
} from '../../../utils';
import { showNotification } from '@mantine/notifications';
import { Button, Group, NumberInput, Select, Stack } from '@mantine/core';
Expand Down Expand Up @@ -118,6 +119,13 @@ export const CustomizeDownsampling = ({
plotIndex++;
}

// Re-apply axis transposition: the back-end returns data in default axis
// order, so restore the user's transposition after the fetch
const wantedAxeIndexOrder = customizedDataGrid.coordinates.map(
(coord) => coord.axeIndex,
);
await reapplyAxisOrder(updatedDataPlot, wantedAxeIndexOrder);

// Save new configuration with downsampled data
setCustomizedDataGrid({
...customizedDataGrid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
normalizeIndices,
getInterpolationMethods,
getUrisToInterpolate,
reapplyAxisOrder,
} from '../../../utils';
import { showNotification } from '@mantine/notifications';
import { Group, Loader, Select, Stack } from '@mantine/core';
Expand Down Expand Up @@ -118,6 +119,13 @@ export const CustomizeInterpolation = ({
plotIndex++;
}

// Re-apply axis transposition: the back-end returns data in default axis
// order, so restore the user's transposition after the fetch
const wantedAxeIndexOrder = customizedDataGrid.coordinates.map(
(coord) => coord.axeIndex,
);
await reapplyAxisOrder(updatedDataPlot, wantedAxeIndexOrder);

// Save new configuration with interpolated data
setCustomizedDataGrid({
...customizedDataGrid,
Expand Down
Loading
Loading