pinchAndZoom not working

Welcome! Forums Unity Plugins In-App Web Browser pinchAndZoom not working

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1125
    elliTek
    Participant
    if (!InAppBrowser.IsInAppBrowserOpened())
    {
         InAppBrowser.DisplayOptions displayOptions = new InAppBrowser.DisplayOptions
         {
              browserBackgroundColor = "#00000000",
              hidesDefaultSpinner = true,
              hidesHistoryButtons = true,
              pinchAndZoomEnabled = true,
              shouldStickToLandscape = true,
              hidesTopBar = true
         };
         InAppBrowser.ClearCache();
         InAppBrowser.OpenURL(url, displayOptions);
    }

    when the page opens, I cannot zoom 🙁

    (Also setting the background to transparent does not work :(, I really need it to work)

    • This topic was modified 3 years, 4 months ago by elliTek.
    #1127
    PiotrPiotr
    Keymaster

    What platform is that? iOS or Android? Transparent background wont work indeed.

    #1128
    elliTek
    Participant

    I have been working on Android.

    and another question, can I set the InAppBrowser to take up only a portion of the screen, not the whole thing?

    #1131
    elliTek
    Participant

    I figured out how to make the bg transparent (give it no bg color)

    have you made any progress on the zoom issue?!?

    #1134
    PiotrPiotr
    Keymaster

    As mentioned in docs this is iOS-only option. On Android you have to tinker with your CSS/HTML.

    #1135
    elliTek
    Participant

    ok, guess ill try and figure that out… but your documentation does not say iOS only… you may wanna add that.
    it only says “On iOS it will cause the page to fit the screen…”, never that it wont work on android…
    and it only says that at the bottom after describing the default value.

    thanks

    #1145
    PiotrPiotr
    Keymaster

    Ok I’ve rechecked it and it seems I was wrong.
    On Android it turns on this option:
    https://developer.android.com/reference/android/webkit/WebSettings.html#setBuiltInZoomControls(boolean)

    Sets whether the WebView should use its built-in zoom mechanisms. The built-in zoom mechanisms comprise on-screen zoom controls, which are displayed over the WebView’s content, and the use of a pinch gesture to control zooming. Whether or not these on-screen controls are displayed can be set with setDisplayZoomControls(boolean). The default is false.

    The built-in mechanisms are the only currently supported zoom mechanisms, so it is recommended that this setting is always enabled.

    If it does not cause any effect might it’s conneted to your website – e.g. <meta name='viewport' /> is missing?

    #1148
    xian9118
    Participant

    So…How i use?

    #1149
    elliTek
    Participant

    I ended up using Hammer.js to add touch functionality to my site.
    If you get the setBuiltInZoomControls incorporated in the InAppBrowser.DisplayOptions, that would be most helpful for future developers.

    #1150
    xian9118
    Participant

    I’m going to upload general sites, not mine…

    #1151
    PiotrPiotr
    Keymaster

    It’s already incorporated. If you pass true in pinchAndZoomEnabled it will set this option.

    #1152
    xian9118
    Participant

    Thank you. But it doesn’t work with smartphones.

    ————————————————–

    options.mixedContentCompatibilityMode = true;
    options.shouldUseWideViewPort = true;
    options.pinchAndZoomEnabled = true;
    options.setLoadWithOverviewMode = true;

    ————————————————–

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.