Move spring loaded scale calculation to DeviceProfile.

Fix: 229838395
Test: manual
Change-Id: I6dbbc850e88aaacceb1363e342404b06104f8c10
This commit is contained in:
Pat Manning
2022-04-22 11:29:17 +01:00
parent 3a16087bab
commit a2e1499a2f
3 changed files with 33 additions and 21 deletions

View File

@@ -52,16 +52,7 @@ public class SpringLoadedState extends LauncherState {
}
float shrunkTop = grid.getWorkspaceSpringLoadShrunkTop();
float shrunkBottom = grid.getWorkspaceSpringLoadShrunkBottom();
float scale = Math.min((shrunkBottom - shrunkTop) / ws.getNormalChildHeight(), 1f);
// Reduce scale if next pages would not be visible after scaling the workspace
float scaledWorkspaceWidth = ws.getWidth() * scale;
float maxAvailableWidth =
ws.getWidth() - (2 * grid.getWorkspaceSpringLoadedMinimumNextPageVisible());
if (scaledWorkspaceWidth > maxAvailableWidth) {
scale *= maxAvailableWidth / scaledWorkspaceWidth;
}
float scale = grid.getWorkspaceSpringLoadScale();
float halfHeight = ws.getHeight() / 2;
float myCenter = ws.getTop() + halfHeight;