Skip to main content
Inspiring
March 29, 2020
Answered

animate html canvas how to set Screen zoom with Javascript

  • March 29, 2020
  • 1 reply
  • 1541 views

I have made an AnimateCC HTML Canvas with input Elements. On Smartphone by clicking inside an input Element the Document is zoomed in. How can I zoom out with Javascript to see the complete canvas Element on the screen of the smartphone? In other words how can I scale the canas Element with Javascript. I put the Javascript in the first Frame.

This topic has been closed for replies.
Correct answer ClayUUID

Browser zoom is a user agent setting and therefore cannot be changed with JavaScript.

 

What you can do is add a viewport meta tag to prevent the browser from scaling the page.

https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag

 

1 reply

Legend
March 29, 2020

Your question is confusingly phrased. Do you want to zoom in then zoom back out, or do you want to not zoom at all?

Inspiring
March 30, 2020

Excuse my bad english.

Take a look at this example on a smartphone I hope this will show the problem

https://www.on-design.de/test/franz/win7.html

There are input Fields, when you play the game. The smartphones zooms in as soon as the focus is in the input field. Even though I have put a big font-size for the input field. A big font-size is the normal procedure for stopping that zooming. But this does not work  for Animate CC (Jquery) input components.

So thats the problem. So As I cant stop this automatic zooming. I am looking for a command to zoom out after the user has put some text in the input field, or after he has clicked a button.

ClayUUIDCorrect answer
Legend
March 30, 2020

Browser zoom is a user agent setting and therefore cannot be changed with JavaScript.

 

What you can do is add a viewport meta tag to prevent the browser from scaling the page.

https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag