Disable Zooming

Just starting out? Need help? Post your questions and find answers here.
Basicoid
Posts: 12
Joined: Thu Dec 08, 2016 4:57 pm

Disable Zooming

Post 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?
falsam
Posts: 280
Joined: Mon May 05, 2014 9:49 pm
Location: France
Contact:

Re: Disable Zooming

Post 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);

➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
http://falsam.com

Sorry for my poor english
Fred
Site Admin
Posts: 1510
Joined: Mon Feb 24, 2014 10:51 am

Re: Disable Zooming

Post by Fred »

I will add this in for all mobile app, as it makes no sens to zoom/pan an app
Basicoid
Posts: 12
Joined: Thu Dec 08, 2016 4:57 pm

Re: Disable Zooming

Post 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:
Webarion
Posts: 7
Joined: Mon Mar 04, 2024 10:47 pm

Re: Disable Zooming

Post 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");
shrindic
Posts: 1
Joined: Thu Mar 21, 2024 5:40 am

Re: Disable Zooming

Post by shrindic »

Hello, also a huge request to enable scaling
Post Reply