Skip to content

Scale the page programmatically to fit the screen #17

Description

@segicm

Hi, is there a way to scale the page to fit the device screen?
This is how I am using the Webshell now:

const Webshell = useMemo(
    () =>
      makeWebshell(
        WebView,
        new HandleHTMLDimensionsFeature(),
        new ForceResponsiveViewportFeature({
          maxScale: 1.5,
          // initScale: 0.65,
          minScale: 0.25,
        }),
        new ForceElementSizeFeature({
          target: 'body',
          heightValue: 'auto',
          widthValue: 'auto',
        }),
        new HandleVisualViewportFeature()
      ),
    []
  );

Responsive pages fit perfectly, but the ones with fixed-width elements will go out of the screen.
I need to scale those pages to fit the width of the device screen.
I have noticed that when I double-tap the content in the webview, the content gets scaled perfectly.
Is there a way to achieve this?

This is how the content looks like on the init render (Gets out of the screen):

Screenshot 2022-09-28 at 17 07 17

And this is how it looks like when I double tap(this is what I need to achieve programmatically):
Screenshot 2022-09-28 at 17 07 00

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions