Skip to content

Commit

Permalink
fix(switch): inverted logic in md-switch dragging
Browse files Browse the repository at this point in the history
md-switch was being toggled when the user dragged less than half the way and didn't toggle when dragged more than half the way.
Invert this logic.

Fixes angular#4549. Closes angular#4560.
  • Loading branch information
Androguide authored and kennethcachia committed Sep 23, 2015
1 parent e4443d7 commit 1a58323
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/switch/switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function MdSwitch(mdCheckboxDirective, $mdTheming, $mdUtil, $document, $mdConsta

// We changed if there is no distance (this is a click a click),
// or if the drag distance is >50% of the total.
var isChanged = ngModel.$viewValue ? drag.translate < 0.5 : drag.translate > 0.5;
var isChanged = ngModel.$viewValue ? drag.translate > 0.5 : drag.translate < 0.5;
if (isChanged) {
applyModelValue(!ngModel.$viewValue);
}
Expand Down

0 comments on commit 1a58323

Please sign in to comment.