diff --git a/src/components/App/App.scss b/src/components/App/App.scss
index 5e99f65..3bd71fa 100644
--- a/src/components/App/App.scss
+++ b/src/components/App/App.scss
@@ -1,9 +1,9 @@
.App {
+ max-width: 100vw;
max-height: 100vh;
-
display: grid;
grid-template-columns: repeat(3, 1fr);
- grid-template-rows: 1fr;
+ grid-template-rows: 1fr 1fr 1/2fr;
grid-column-gap: 0;
grid-row-gap: 0;
}
diff --git a/src/components/App/App.tsx b/src/components/App/App.tsx
index 3791fc4..4904e7c 100644
--- a/src/components/App/App.tsx
+++ b/src/components/App/App.tsx
@@ -8,9 +8,11 @@ import './App.scss';
export default function App(): JSX.Element {
return (
+
+
+
-
{
handleMouseDown(startPos: Point) {
const endPos = startPos;
- this.setState({...this.state, startPos, endPos, isSelecting: true});
+ let lines = [...this.state.lines];
+ lines[0] = true;
+ this.setState({...this.state, startPos, endPos, lines, isSelecting: true});
}
handleMouseUp(endPos: Point) {
- if (this.moveIsValid(endPos))
- this.setState({...this.state, endPos, isSelecting: false});
+ if (!this.moveIsValid(endPos))
+ return;
+
+ this.setState({...this.state, endPos, isSelecting: false});
}
handleMouseOver(endPos: Point) {
- if (this.moveIsValid(endPos))
- this.setState({...this.state, endPos});
+ if (!this.moveIsValid(endPos))
+ return;
+
+ this.setState({...this.state, endPos});
}
renderCell(s: string, pos: Point): JSX.Element {
@@ -80,7 +86,6 @@ export default class Board extends React.Component {
startPos={{...this.state.startPos}}
endPos={{...this.state.endPos}}
cellSize={60}
- isVisible={this.state.lines[0]}
/>
);
}
@@ -91,8 +96,8 @@ export default class Board extends React.Component {
oy.map((s, x) =>
this.renderCell(s, {x, y})));
- let lines = this.state.lines.map((ox, x) =>
- this.renderLine(x));
+ let lines = this.state.lines.filter(x => x).map((ox, x) =>
+ this.renderLine(x));
return (
diff --git a/src/components/Line/Line.tsx b/src/components/Line/Line.tsx
index ac40d38..a190e1b 100644
--- a/src/components/Line/Line.tsx
+++ b/src/components/Line/Line.tsx
@@ -8,7 +8,6 @@ interface ILineProps {
startPos: Point;
endPos: Point;
cellSize: number;
- isVisible: boolean;
}
export default function Line(props: ILineProps): JSX.Element {
@@ -17,7 +16,6 @@ export default function Line(props: ILineProps): JSX.Element {
return (
-
+
);
}