Skip to content

Instantly share code, notes, and snippets.

@patientplatypus
Created October 14, 2019 18:10
Show Gist options
  • Save patientplatypus/83c7f70db61375c3901f1f21e65a1af9 to your computer and use it in GitHub Desktop.
Save patientplatypus/83c7f70db61375c3901f1f21e65a1af9 to your computer and use it in GitHub Desktop.
//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