This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton on-line!
See this thread for details.
Win a flower (🌹) or copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java (📚) this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
master stewards:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
garden masters:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
gardeners:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

How to move rectangle on canvas

 
pioneer
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I use canvas in my application using JavaScript. On that canvas I draw one rectangle.
I want to move rectangle with the help of mouse(e.g moving slider) how to move that
rectangle using JavaScript or J-query
 
pioneer
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

pravin rasal wrote:Hello,
I use canvas in my application using JavaScript. On that canvas I draw one rectangle.
I want to move rectangle with the help of mouse(e.g moving slider) how to move that
rectangle using JavaScript or J-query



http://html5.litten.com/how-to-drag-and-drop-on-an-html5-canvas/

made to order!
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Edit: code removed. Please read NotACodeMill]
 
pravin rasal
pioneer
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much kasiraj.

This is very help full for me . I want to ask one question that is can I move line on canvas.
 
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use canvas in my application using JavaScript. On that canvas I draw one rectangle. I want to move rectangle with the help of mouse(e.g moving slider) how to move that rectangle using JavaScript or J-query.

A Canvas is literally just a surface that you paint on and none of the things you paint are objects.

If you want to pretend they are objects (like moving around a rectangle or a line) then you need to keep track of everything and do all the hit-testing and re-painting yourself .

I wrote a gentle introduction article on getting started by making rectangles that you can select and drag around. Give that a read.
 
This tiny ad is wafer thin:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!