toolbar and grid
This commit is contained in:
parent
c5638832a7
commit
99d9f34ffd
2 changed files with 27 additions and 1 deletions
15
mapsy/src/components/Grid.jsx
Normal file
15
mapsy/src/components/Grid.jsx
Normal file
|
@ -0,0 +1,15 @@
|
|||
import React from 'react';
|
||||
import { Rect } from 'react-konva';
|
||||
|
||||
const Grid = ({ gridSize, canvasSize }) => {
|
||||
const lines = [];
|
||||
for (let i = 0; i <= canvasSize; i += gridSize) {
|
||||
lines.push(
|
||||
<Rect key={`v-${i}`} x={i} y={0} width={1} height={canvasSize} fill="lightgray" />,
|
||||
<Rect key={`h-${i}`} x={0} y={i} width={canvasSize} height={1} fill="lightgray" />
|
||||
);
|
||||
}
|
||||
return lines;
|
||||
};
|
||||
|
||||
export default Grid;
|
|
@ -1 +1,12 @@
|
|||
import React from 'react';
|
||||
import React from 'react';
|
||||
|
||||
const Toolbar = ({ setTool }) => {
|
||||
return (
|
||||
<div className="toolbar">
|
||||
<button onClick={() => setTool('draw')}>Draw</button>
|
||||
<button onClick={() => setTool('erase')}>Erase</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Toolbar;
|
Loading…
Reference in a new issue