ANY DOM element can be made resizable according to this page: http://jqueryui.com/demos/resizable/
However, it seems that this doesn’t work for the CANVAS element. Possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Canvas has two types of resize behavior:
Here’s a page that demonstrates the two types of “resizing”: http://xavi.co/static/so-resizable-canvas.html
If you want the first type of resizing (stretch the content) then place the canvas into a container
divand set thewidthandheightof the canvas to 100% using CSS. Here’s what that code might look like:The second type of resizing (static content) is a two step process. First you must adjust the
widthandheightattributes of the canvas element. Unfortunately, doing this clears the canvas, so you must then re-draw all its contents. Here’s bit of code that does this:Currently the code above re-draws the canvas’s content when the user stops resizing the widget. It’s possible to re-draw the canvas on resize, however resize events occur fairly often and re-draws are expensive operations — approach with caution.