Skip to content

[BUG] Horizontal Autoscale + Exclude Sidebar does not work scale correctly #150

@GSBicalho

Description

@GSBicalho

Setup

  • OS: Windows 10
  • Browser: Chrome, Foundry App
  • Module version: 2.0.2
  • Foundry version: 13.351
  • Gaming system & version: Gumshoe 9.10
  • Any other modules enabled: yes (libwrapper)

Describe the bug
Horizontal Fit and Automatic Fit (Outside) when the horizontal dimension is larger, both make the scene too big when Exclude Sidebar is set to true, hiding part of the scene behind the sidebar

To replicate, as Gamemaster:

  • On User Configuration, check "Enable", "Viewbox" and "Control" for Gamemaster
  • Create a scene with width large enough that it does not fit on your screen by more than the height (such that Automatic Fit (Outside) would leave it with empty space above and below). My monitor is 3840x2160, so I used 4000x2000 to demonstrate the issue, though increasing the width even further would make it more obvious
  • In the Lockview configurations of the scene, set:
  • Sidebar > On Scene Load > Expand
  • Sidebar > Exclude Sidebar > Checked
  • Autoscale > Horizontal Fit
  • Force Initial View > Checked
  • Save Changes

You should see that some of the scene is hidden behind the sidebar, as shown below.

Screenshots
With Horizontal Fit

Image

With AutomaticFit (Outside)
Image

Note how the scene expands below the sidebar

Additional context
This is caused not by Lockview itself, but by the fact that Foundry canvas.pan function has a constraint on how zoomed out a scene can be (defined in canvas.dimensions.scale.min). In order to have a scene that fills the screen horizontally and has space for the sidebar, Lockview tells foundry to scale it to the correct amount, but that is smaller than that minimum value, so it gets overridden. Setting canvas.dimensions.scale.min to 0 does appear to solve the issue:

getAutoscale(mode, scene = canvas.scene) {
        canvas.dimensions.scale.min = 0.0;

        let windowWidth = window.innerWidth;
        ...
    }

After making this change it scales correctly, except that then on first load the scene is slightly offset to the right:

Image

Though for some reason then changing between autoscale options shifts it to the correct offset (at least until scene reload), which is where I stopped investigating the issue.

In something only tangentially related I discovered when trying to understand the bug (and which I thought was originally the source of the issue), the getAutoscale function calculates the horizontal scale for 'horizontal' and the autos differently, using window.innerWidth instead of windowWidth, which I believe is incorrect, so the behavior between them differs slightly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions