Skip to content

Commit

Permalink
Fix the Rect rendering bug
Browse files Browse the repository at this point in the history
This commit passes absolute values to the Paper width and height components.

WARNING: this commit uses magic numbers to fix problems. These are temporary,
poor-practice bug fixes for an upcoming demo. If you have a reactivity problem
in the future, check this commit out and fix it.
  • Loading branch information
carterjbastian committed Mar 4, 2017
1 parent ea3eb63 commit f3cac24
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/components/Diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ export default class Diagram extends Component {
const clickY = e.clientY;

// Find the location of this click relative to the element itself
const topLeftX = clickX;
const topLeftY = clickY;
// NOTE FOR FUTURE DEVS: This offset was figured out via guess and check
// since we have a quick deadline coming up. This is not reactive and is
// a horrible best practice. Change this to compute the offset on the fly.
const topLeftX = clickX - 8;
const topLeftY = clickY - 75;

console.log(topLeftX);
console.log(topLeftY);
Expand All @@ -48,7 +51,7 @@ export default class Diagram extends Component {
return (
<div onClick={this.handleClick}
style={{position: 'absolute', width: '100%', height: '100%', margin: 0, padding: 0}}>
<Paper width='100%' height='100%'>
<Paper position='absolute' width={615} height={608}>
<Set>
{
this.state.blocks.map(function(ele, pos) {
Expand Down

0 comments on commit f3cac24

Please sign in to comment.