javascript - Get untransformed coordinate from mouse coordinate -


is possible take "display coordinate" such location of mouse on canvas , "scene coordinate", i.e. coordinate before transformations applied? instance, fill in blank in following code:

context.scale(500.0 / sizemax, 500.0 / sizemax); context.translate(-miny, -minx);  mouse_x = someval; mouse_y = someval2;  $('#xy_location').val(/* using mouse_x , mouse_y                      untransformed coordinate */); 

i'm aware of how mouse xy coordinate canvas display space (or w/e call it) using technique one. i'm not sure how take said display coordinate , "un-transform" coordinate in pre-transformed space. track transforms , manually put in opposites, i'd prefer way that's more clean that. option if show me how transformation matrix values invert on own.

is possible in html5/canvas , if so, how?


Comments