Page 1 of 1

Disable Zooming

Posted: Sat Dec 10, 2016 2:18 pm
by Basicoid
I'd like to create a full screen app for an android tablet but don't want to allow zooming/panning the content, is it possible to disable that?

Re: Disable Zooming

Posted: Sat Dec 10, 2016 5:55 pm
by falsam
Start your code with

Code: Select all

;// No Zoom
! var meta = document.createElement('meta');
! meta.name = "viewport";
! meta.content = "width=device-width, user-scalable=no";
! document.getElementsByTagName('head')[0].appendChild(meta);

Re: Disable Zooming

Posted: Sun Dec 11, 2016 7:36 am
by Fred
I will add this in for all mobile app, as it makes no sens to zoom/pan an app

Re: Disable Zooming

Posted: Sun Dec 11, 2016 4:49 pm
by Basicoid
Fred wrote:I will add this in for all mobile app, as it makes no sens to zoom/pan an app
Great, thank you. ;)

Maybe you will be able to give us a hint some time, which enhancements of SpiderBasic are planned for the next year or so - this would be perfect. :roll:

Re: Disable Zooming

Posted: Wed Mar 20, 2024 1:37 pm
by Webarion
Fred wrote: Sun Dec 11, 2016 7:36 am I will add this in for all mobile app, as it makes no sens to zoom/pan an app
And now this is a big pain in applications that need scaling.
You need to make it possible to both enable scaling and disable it. Now we need to implement hacks and this does not work in the Android application on first launch. Example:

Code: Select all

OpenWindow(0, 100, 100, 320, 200, "Window", #PB_Window_Background )
ButtonGadget(0, 10, 200, 200, 60, "Multiline Button Multiline Button Multiline Button Multiline Button", #PB_Button_MultiLine)

! document.querySelector("meta[name=viewport]").setAttribute('content', 'width=device-width, initial-scale=1.0, user-scalable=1');
! $('html, head, body, .spiderwindow, .spiderwindow div:first-child, .spiderwindow-background, .spiderwindow-background div:first-child').css("touch-action", "auto");

Re: Disable Zooming

Posted: Sun Mar 24, 2024 12:09 am
by shrindic
Hello, also a huge request to enable scaling