Size and coordinates of a drawing window

Explorer ,
Oct 11, 2020

Copy link to clipboard

Copied

Hello,
In Animate HTML5 canvas, I draw a graphic with the mouse (var ctx = canvas.getContext("2d") ;...) and I wish that the drawing can not be done outside a frame whose dimensions and coordinates are defined. Is it possible to specify the coordinates and size of this frame? I can't find an answer.

Thank you for any help.

Views

79

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Oct 11, 2020

Copy link to clipboard

Copied

I don't understand what the problem is. Your code is already retrieving the mouse coordinates and using them to plot pixels on a canvas element, so... just check the coordinate values?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
mp63178988 AUTHOR LATEST
Explorer ,
Oct 11, 2020

Copy link to clipboard

Copied

It's perfect, thank you very much. I hadn't thought about it. I have one last question please: is it possible to scroll indefinitely the created design to the left or to the right?
Thank you for your answer.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more