Created
July 3, 2015 00:36
-
-
Save dzava/39423bc9cc0439c83834 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
function getSquare(canvas, evt) { | |
var rect = canvas.getBoundingClientRect(); | |
var values = this.scroller.getValues(); | |
return { | |
x: Math.ceil((((evt.clientY - rect.top + values.top) / values.zoom) - ((evt.clientY - rect.top + values.top)/values.zoom) % cellHeight) / cellHeight), | |
y: Math.ceil((((evt.clientX - rect.left + values.left) / values.zoom) - ((evt.clientX - rect.left + values.left)/values.zoom) % cellWidth) / cellWidth) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment