Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41be2fc7 authored by Tony Wickham's avatar Tony Wickham
Browse files

Fix workspace scale calculation

- Based on workspace page instead of workspace (takes padding into
  account)
- Checks that width != 0 so we don't divide by 0

Bug: 79526164
Change-Id: I25d92a04550aa34abab7e9e1f93c93dbccd61752
parent 5d1873a8
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -50,8 +50,11 @@ public class OverviewState extends LauncherState {
    public float[] getWorkspaceScaleAndTranslation(Launcher launcher) {
        RecentsView recentsView = launcher.getOverviewPanel();
        Workspace workspace = launcher.getWorkspace();
        View workspacePage = workspace.getPageAt(workspace.getCurrentPage());
        float workspacePageWidth = workspacePage != null && workspacePage.getWidth() != 0
                ? workspacePage.getWidth() : launcher.getDeviceProfile().availableWidthPx;
        recentsView.getTaskSize(sTempRect);
        float scale = (float) sTempRect.width() / workspace.getWidth();
        float scale = (float) sTempRect.width() / workspacePageWidth;
        float parallaxFactor = 0.4f;
        return new float[]{scale, 0, -getDefaultSwipeHeight(launcher) * parallaxFactor};
    }