Javascript, CSS, jQuery - my canvas moves to where it shouldnt be -
problem in title. used on odd occasion. added jquery rotate.js plugin spin heading 360 degrees , placed right of should be. may interesting note got offset of canvas
var rect = gamecontroller.canvas.getboundingclientrect(); var offset = { x: rect.left, y: rect.top }; and still has coordinates of 0,0 in top left corner of should ( correct , how should when canvas has not moved).
#canvas { z-index: 1; position: absolute; margin-top: 52px; margin-left: 44px; background-image:url(images/background.jpg); } if position absolute, removed document , nothing make move. strange.
getboundingclientrect() returns sum of canvas , css border-boxes.
maybe check canvas getclientrects() see is.
Comments
Post a Comment