Skip to content

Commit

Permalink
feat: activate resizing for integrals/ranges when its tool selected
Browse files Browse the repository at this point in the history
close #1648
  • Loading branch information
hamed-musallam committed Aug 2, 2022
1 parent 6797c43 commit 4c75f34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/component/1d/IntegralResizable.tsx
Expand Up @@ -9,6 +9,7 @@ import { useScaleChecked } from '../context/ScaleContext';
import Resizer from '../elements/resizer/Resizer';
import { HighlightedSource, useHighlight } from '../highlight/index';
import { RESIZE_INTEGRAL } from '../reducer/types/Types';
import { options } from '../toolbar/ToolTypes';
import { formatNumber } from '../utility/formatNumber';

const stylesOnHover = css`
Expand Down Expand Up @@ -51,7 +52,11 @@ function IntegralResizable({
integralData,
integralFormat,
}: IntegralResizableProps) {
const { height, margin } = useChartData();
const {
height,
margin,
toolOptions: { selectedTool },
} = useChartData();
const { viewerRef } = useGlobal();
const { scaleX } = useScaleChecked();
const dispatch = useDispatch();
Expand Down Expand Up @@ -99,6 +104,7 @@ function IntegralResizable({
onEnd={handleOnStopResizing}
parentElement={viewerRef}
key={`${id}_${to}_${from}`}
disabled={selectedTool !== options.integral.id}
>
{({ x1, x2 }, isActive) => (
<g
Expand Down
1 change: 1 addition & 0 deletions src/component/1d/ranges/Range.tsx
Expand Up @@ -155,6 +155,7 @@ function Range({
onEnd={handleOnStopResizing}
parentElement={viewerRef}
key={`${id}_${to}_${from}`}
disabled={selectedTool !== options.rangesPicking.id}
>
{({ x1, x2 }, isActive) => (
<g
Expand Down

0 comments on commit 4c75f34

Please sign in to comment.