reuse in startPoint element
This commit is contained in:
parent
fe7010f9d4
commit
971976bf2a
@ -153,7 +153,6 @@ const Grid: FC = () => {
|
|||||||
);
|
);
|
||||||
setRedoActions([]);
|
setRedoActions([]);
|
||||||
|
|
||||||
// single-click tools
|
|
||||||
if (drawModeInfo.pointsType === 'single') {
|
if (drawModeInfo.pointsType === 'single') {
|
||||||
const toolLines = drawModeInfo.getToolLines(
|
const toolLines = drawModeInfo.getToolLines(
|
||||||
point,
|
point,
|
||||||
@ -165,7 +164,6 @@ const Grid: FC = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// click and drag tools -------------------------------------------
|
|
||||||
if (lodash.isEqual(startPoint, point)) {
|
if (lodash.isEqual(startPoint, point)) {
|
||||||
setStartPoint(null);
|
setStartPoint(null);
|
||||||
return;
|
return;
|
||||||
@ -330,17 +328,12 @@ const Grid: FC = () => {
|
|||||||
}, [startPoint, mousePoint, drawMode, drawModeInfo, lineColor]);
|
}, [startPoint, mousePoint, drawMode, drawModeInfo, lineColor]);
|
||||||
|
|
||||||
const startPointElement = useMemo(() => {
|
const startPointElement = useMemo(() => {
|
||||||
let point = snapToGrid(
|
if (drawModeInfo.pointsType === 'single') return null;
|
||||||
|
const point = snapToGrid(
|
||||||
mousePoint,
|
mousePoint,
|
||||||
drawModeInfo.gridGap,
|
drawModeInfo.gridGap,
|
||||||
drawModeInfo.gridOffset
|
drawModeInfo.gridOffset
|
||||||
);
|
);
|
||||||
if (
|
|
||||||
drawMode === 'square' ||
|
|
||||||
drawMode === 'square-small' ||
|
|
||||||
drawMode === 'star'
|
|
||||||
)
|
|
||||||
return null;
|
|
||||||
return (
|
return (
|
||||||
<circle
|
<circle
|
||||||
className="node"
|
className="node"
|
||||||
@ -348,9 +341,7 @@ const Grid: FC = () => {
|
|||||||
cy={point.y}
|
cy={point.y}
|
||||||
r="4"
|
r="4"
|
||||||
fill={
|
fill={
|
||||||
drawMode === 'line' || drawMode === 'grid'
|
drawModeInfo.pointsType === 'double' ? lineColor : '#ff0000'
|
||||||
? lineColor
|
|
||||||
: '#ff0000'
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user