reuse in startPoint element

This commit is contained in:
Michael Peters 2024-07-20 17:17:01 -07:00
parent fe7010f9d4
commit 971976bf2a

View File

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