-
-
Save ryanswrt/90a610ca6db2d6dbc923d77bbaf7149e to your computer and use it in GitHub Desktop.
This file contains 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
pre.addEventListener("click", event => { | |
const boundingRect = pre.getBoundingClientRect(); | |
const scaleX = 64 / boundingRect.width; | |
const scaleY = 64 / boundingRect.height; | |
const canvasLeft = (event.clientX - boundingRect.left) * scaleX; | |
const canvasTop = (event.clientY - boundingRect.top) * scaleY; | |
const row = Math.min(Math.floor(canvasTop), 64 - 1); | |
const col = Math.min(Math.floor(canvasLeft), 64 - 1); | |
contract.call( | |
wallet, | |
"toggle", | |
BigInt(0), | |
BigInt(1e7), | |
BigInt(0), | |
{ | |
type: "uint32", | |
value: row | |
}, | |
{ | |
type: "uint32", | |
value: col | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment