• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Size and coordinates of a drawing window

Explorer ,
Oct 11, 2020 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

136

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
community guidelines
LEGEND ,
Oct 11, 2020 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?

Votes

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
community guidelines
Explorer ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

LATEST

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.

Votes

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
community guidelines