drawImage placement problem

138 views
Skip to first unread message

donuts

unread,
Aug 20, 2010, 6:28:05 PM8/20/10
to google-excanvas
I am working on a game which uses the canvas element to, among other
things, move images around. Everything is fine on other browsers, but
excanvas seems to systematically misplace images. Specifically, it
appears to multiply the x and y coordinates by about 1.1 on all
images. If a transformation has been applied, however, it places the
images correctly. For example,

context.drawImage(theImage,100,100);

draws the image at around 110,110, while

context.scale(1.000001,1.000001);
context.drawImage(theImage,50,50);

puts it in the right place. Even this small transform screws up the
image quality and slows the script down to the point where the game
sometimes breaks, so I don't consider this a solution. I see that the
excanvas implementation uses different methods to place images with
and without transforms, but I'm not sure what the problem could be
when there is no transform. From debugging I know that excanvas
calculates the right coordinate, but then the image somehow winds up
in the wrong place.

The full script is at http://www.stanford.edu/~wclay/mao/mao_beta.html.
Reply all
Reply to author
Forward
0 new messages