Created
October 14, 2019 18:10
-
-
Save patientplatypus/83c7f70db61375c3901f1f21e65a1af9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the following does not work and i have no idea why | |
//the error i get is: | |
//there was an error: RuntimeError: "unreachable executed" | |
// handle_mouse_down http://localhost:3000/static/js/5.chunk.js:139 | |
// mouseDown http://localhost:3000/static/js/3.chunk.js:1207 | |
// mouseMove http://localhost:3000/static/js/3.chunk.js:1222 | |
//3.chunk.js:1210:17 | |
mouseDown = () => { | |
console.log('value of this.dragArray: ', this.dragArray); | |
console.log('value of this.dragArray[this.dragArray.length - 1]: ', this.dragArray[this.dragArray.length - 1]); | |
let lastDrag = this.dragArray[this.dragArray.length - 1]; | |
console.log('value of lastDrag: ', lastDrag); //this gives {x: 234, y:235} for example (as it ought) | |
try{ | |
let newWASM = this.state.wasm.handle_mouse_down( | |
this.state.sprayImg.width, | |
this.state.sprayImg.height, | |
this.canvasRefWASM.current.width, | |
this.canvasRefWASM.current.height, | |
lastDrag.x,//this breaks! but if I put 234 here it's fine. As far as I can tell, it's not a type problem | |
lastDrag.y,//wasm simply fails to load and i dont know why. | |
this.state.sprayImg.data); | |
console.log('value of newWasm: ', newWASM); | |
} | |
catch(e){ | |
console.log('there was an error: ', e); | |
} | |
} | |
mouseMove = (event) => { | |
this.mouseListener(event); | |
if(this.state.mouseDown && this.state.sprayImg!=''){ | |
this.dragArray.push({ | |
x: event.clientX - this.rectWASM.left, | |
y: event.clientY - this.rectWASM.top | |
}) | |
this.mouseDown() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment