Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,19 @@ void updateViewWithPercent(View child, float percent) {
float newX = targetX == UNSPECIFIED_INT ? 0 : (targetX - mStartX) * percent;
float newY = targetY == UNSPECIFIED_INT ? 0 : (targetY - mStartY) * percent;

// set scale
if (targetWidth != UNSPECIFIED_INT || targetHeight != UNSPECIFIED_INT) {
// set width scale
if (targetWidth != UNSPECIFIED_INT) {
float newWidth = mStartWidth + ((targetWidth - mStartWidth) * percent);
float newHeight = mStartHeight + ((targetHeight - mStartHeight) * percent);

child.setScaleX(newWidth / mStartWidth);
child.setScaleY(newHeight / mStartHeight);
// make up position for scale change
newX -= (mStartWidth - newWidth) / 2;
}

// set height scale
if (targetHeight != UNSPECIFIED_INT) {
float newHeight = mStartHeight + ((targetHeight - mStartHeight) * percent);
child.setScaleY(newHeight / mStartHeight);
// make up position for scale change
newY -= (mStartHeight - newHeight) / 2;
}

Expand Down