Skip to content

Commit 2f428cb

Browse files
author
Jens Claes
committed
Small improvement
1 parent 6621e83 commit 2f428cb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

library/src/main/java/com/alamkanak/weekview/WeekView.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,6 @@ public boolean onScaleBegin(ScaleGestureDetector detector) {
390390
@Override
391391
public boolean onScale(ScaleGestureDetector detector) {
392392
mNewHourHeight = Math.round(mHourHeight * detector.getScaleFactor());
393-
if(mNewHourHeight < mEffectiveMinHourHeight)
394-
mNewHourHeight = mEffectiveMinHourHeight;
395-
else if(mNewHourHeight > mMaxHourHeight)
396-
mNewHourHeight = mMaxHourHeight;
397393
invalidate();
398394
return true;
399395
}
@@ -474,6 +470,11 @@ private void drawHeaderRowAndEvents(Canvas canvas) {
474470

475471
//Calculate the new height due to the zooming.
476472
if (mNewHourHeight > 0){
473+
if(mNewHourHeight < mEffectiveMinHourHeight)
474+
mNewHourHeight = mEffectiveMinHourHeight;
475+
else if(mNewHourHeight > mMaxHourHeight)
476+
mNewHourHeight = mMaxHourHeight;
477+
477478
mCurrentOrigin.y = (mCurrentOrigin.y/mHourHeight)*mNewHourHeight;
478479
mHourHeight = mNewHourHeight;
479480
mNewHourHeight = -1;
@@ -1175,7 +1176,7 @@ public int getHourHeight() {
11751176
}
11761177

11771178
public void setHourHeight(int hourHeight) {
1178-
mHourHeight = hourHeight;
1179+
mNewHourHeight = hourHeight;
11791180
invalidate();
11801181
}
11811182

0 commit comments

Comments
 (0)