Skip to content

Commit

Permalink
Merge pull request danisyellis#30 from danisyellis/konva-cfg
Browse files Browse the repository at this point in the history
size and place canvas element, Is of a fixed size
  • Loading branch information
pkallas authored Nov 22, 2017
2 parents 0118a59 + 981d57c commit 6b04aa6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 25 deletions.
4 changes: 2 additions & 2 deletions public/poetion.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
.poem-canvas {
grid-area: view;
position: relative;
width: 100%;
height: 100%;
/*border: 1px dotted red;*/
}

Expand Down
35 changes: 14 additions & 21 deletions src/client/components/poem-canvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,24 @@ import { Rect, Group } from 'react-konva';

export default class PoemCanvas extends Component {

constructor(props) {
super(props);
this.state = {
color: 'green',
};
this.handleClick = this.handleClick.bind(this);
}
// constructor(props) {
// super(props);
// this.state = {
// size: this.loadCanvas
// };
// this.loadCanvas = this.loadCanvas.bind(this);
// }

handleClick() {
// window.Konva is a global variable for Konva framework namespace
this.setState({
color: window.Konva.Util.getRandomColor(),
});
};
// loadCanvas() {
// // window.Konva is a global variable for Konva framework namespace
// this.setState({
// size: window.Konva.Canvas.setSize(100%, 100%)
// });
// };

render() {
return (
<Rect
x={10}
y={10}
width={400}
height={400}
fill={this.state.color}
onClick={this.handleClick}
/>
<Canvas width={this.loadCanvas} />
);
}
};
4 changes: 2 additions & 2 deletions src/client/components/starter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export default class Starter extends Component {
<div className="react-root">
<Name />
<Credits />
<Stage className="poem-canvas" width={700} height={700}>
<Stage className="poem-canvas" width={1260} height={600}>
<Layer>
<PoemCanvas />
{/* <PoemCanvas /> */}
</Layer>
</Stage>
<BottomUtilityBar />
Expand Down

0 comments on commit 6b04aa6

Please sign in to comment.