Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"googlemaps" dragging with html5 canvas

I have a large html5 canvas (much larger than the screen), and I want to implement a "google-maps" dragging. I want the canvas to be dragable by mouse, and I want it to render only the part we can see on the screen each time I drag it. Does someone have a good idea?

like image 530
Amit Avatar asked Apr 24 '11 08:04

Amit


1 Answers

I solved this problem by using the jQuery UI draggable component on the canvas element. I enclosed it in a div - with overflow set to hidden, and made the canvas as large as I need it to be. Works a charm

http://jqueryui.com/demos/draggable/

like image 73
SystemicPlural Avatar answered Oct 27 '22 16:10

SystemicPlural