Highlighted

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

61

Likes

Translate

Translate

Report

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

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

62

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 11, 2020 0
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
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 11, 2020 0
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
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 11, 2020 0