Menu
Sites
Language
I want my canvas to be drag within the screen of device

Hi,

I have developed an application in which i want my canvas to drag only within the screen.My canvas move ouside the screen.How can i resolve this problem.

 

 

Please help me

Thanks and regards

Mohit Kumar

Edited on 31 08, 2015

Responses

4 Replies
Alex Dem

Hi ,
What do you mean: if you canvas is outside of screen - then just reduce canvas size, or what?
Alexey.

colin Rao

seems the canvas can't be embded into another canvas. why not to use a div. 

Possible, you need to know the first canvas position, width & height, then try to register touchmove event on canvas 2&3, in the event callback to check the positon of canvas 2/3, compare with the first canvas position info, if it's out of the first canvas then set to 0 or any else.

similar topic https://developer.tizen.org/forums/web-application-development/i-have-use-drag-event-it-drag-only-left-right-and-right-left

 Palitsyna

Hello,

Try to use jCanvas plugin: http://projects.calebevans.me/jcanvas/ Probably it is something you are looking for.

Seoghyun Kang

Hello,

 

I checked the jCanvas that Palitsyna mentioned.

When I run the jCanvas, it is powerful and easy. That's why I also think it will be helpful to you.