mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Fix spring-loaded folder animation offset bug
The folder close animation is offset due incorrect scaling in SpringLoaded mode. We fix the folder offset by scaling offsetX() and offsetY() by the scale of the workspace in spring loaded mode (scaleRelativeToDragLayer), and the offset of the preview icons is fixed by dividing previewItemOffsetX by initialScale rather than initialScale / scaleRelativeToDragLayer Fix: 255420905 Test: manual Change-Id: I305c1047c14c4c9f1b4c3bd0143e9bb764c71524
This commit is contained in:
@@ -168,9 +168,11 @@ public class FolderAnimationManager {
|
||||
final int paddingOffsetY = (int) (mContent.getPaddingTop() * initialScale);
|
||||
|
||||
int initialX = folderIconPos.left + mFolder.getPaddingLeft()
|
||||
+ mPreviewBackground.getOffsetX() - paddingOffsetX - previewItemOffsetX;
|
||||
+ Math.round(mPreviewBackground.getOffsetX() * scaleRelativeToDragLayer)
|
||||
- paddingOffsetX - previewItemOffsetX;
|
||||
int initialY = folderIconPos.top + mFolder.getPaddingTop()
|
||||
+ mPreviewBackground.getOffsetY() - paddingOffsetY;
|
||||
+ Math.round(mPreviewBackground.getOffsetY() * scaleRelativeToDragLayer)
|
||||
- paddingOffsetY;
|
||||
final float xDistance = initialX - lp.x;
|
||||
final float yDistance = initialY - lp.y;
|
||||
|
||||
@@ -313,7 +315,7 @@ public class FolderAnimationManager {
|
||||
addPreviewItemAnimators(a, initialScale / scaleRelativeToDragLayer,
|
||||
// Background can have a scaled radius in drag and drop mode, so we need to add the
|
||||
// difference to keep the preview items centered.
|
||||
previewItemOffsetX + radiusDiff, radiusDiff);
|
||||
(int) (previewItemOffsetX / scaleRelativeToDragLayer) + radiusDiff, radiusDiff);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user