Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: edit range peaks #2953

Merged
merged 10 commits into from
Mar 16, 2024
15 changes: 6 additions & 9 deletions src/component/1d/Viewer1D.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,11 @@ function Viewer1D({ emptyText = undefined }: Viewer1DProps) {

const xPPM = scaleState.scaleX().invert(event.x);

const propagateEvent = () => {
Events.emit('mouseClick', {
...event,
xPPM,
});
};
Events.emit('mouseClick', {
...event,
xPPM,
});

const keyModifiers = getModifiersKey(event as unknown as MouseEvent);

switch (keyModifiers) {
Expand All @@ -322,9 +321,7 @@ function Viewer1D({ emptyText = undefined }: Viewer1DProps) {
payload: event,
});
break;
case options.editRange.id:
propagateEvent();
break;

case options.integral.id:
dispatch({
type: 'CUT_INTEGRAL',
Expand Down
6 changes: 4 additions & 2 deletions src/component/EventsTrackers/BrushTracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ export function useBrushTracker() {
return useContext(BrushContext);
}

interface Position {
export interface Position {
x: number;
y: number;
}
export type OnClick = (element: React.MouseEvent & Position) => void;

export type ClickOptions = React.MouseEvent & Position;
export type OnClick = (element: ClickOptions) => void;
export type { OnClick as OnDoubleClick };
export type OnZoom = (
event: Pick<React.WheelEvent, 'deltaY' | 'shiftKey' | 'deltaMode'> & Position,
Expand Down
2 changes: 2 additions & 0 deletions src/component/elements/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const Select = forwardRef(function Select(
itemTextField = 'label',
returnValue = true,
textRender,
...otherProps
} = props;

const handleOnChanged = useCallback(
Expand All @@ -87,6 +88,7 @@ const Select = forwardRef(function Select(
className={className}
style={style}
required
{...otherProps}
>
{placeholder && (
<option value="" disabled>
Expand Down
4 changes: 2 additions & 2 deletions src/component/modal/editRange/EditRangeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import useSpectrum from '../../hooks/useSpectrum';
import { hasCouplingConstant } from '../../panels/extra/utilities/MultiplicityUtilities';
import { formatNumber } from '../../utility/formatNumber';

import SignalsForm from './forms/components/SignalsForm';
import SignalsContent from './forms/components/SignalsContent';
import editRangeFormValidation from './forms/validation/EditRangeValidation';

const styles = css`
Expand Down Expand Up @@ -242,7 +242,7 @@ function EditRangeModal({
onSubmit={handleOnSave}
>
<>
<SignalsForm range={range} preferences={rangesPreferences} />
<SignalsContent range={range} />
<FormikOnChange onChange={changeHandler} />
</>
</Formik>
Expand Down
149 changes: 0 additions & 149 deletions src/component/modal/editRange/forms/components/AddSignalFormTab.tsx

This file was deleted.

161 changes: 0 additions & 161 deletions src/component/modal/editRange/forms/components/CouplingsTable.tsx

This file was deleted.

Loading
Loading