Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.

Commit

Permalink
Update dragging offset based on _firstTrigger
Browse files Browse the repository at this point in the history
This will ensure that the view associated with the trigger will be centered when the trigger occurs.
  • Loading branch information
eliperkins committed Jan 23, 2014
1 parent a59c36c commit 50d2297
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions MCSwipeTableViewCell/MCSwipeTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -520,30 +520,30 @@ - (void)slideViewWithPercentage:(CGFloat)percentage view:(UIView *)view isDraggi
position.y = CGRectGetHeight(self.bounds) / 2.0;

if (isDragging) {
if (percentage >= 0 && percentage < kMCStop1) {
position.x = [self offsetWithPercentage:(kMCStop1 / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
if (percentage >= 0 && percentage < _firstTrigger) {
position.x = [self offsetWithPercentage:(_firstTrigger / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
}

else if (percentage >= kMCStop1) {
position.x = [self offsetWithPercentage:percentage - (kMCStop1 / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
else if (percentage >= _firstTrigger) {
position.x = [self offsetWithPercentage:percentage - (_firstTrigger / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
}

else if (percentage < 0 && percentage >= -kMCStop1) {
position.x = CGRectGetWidth(self.bounds) - [self offsetWithPercentage:(kMCStop1 / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
else if (percentage < 0 && percentage >= -_firstTrigger) {
position.x = CGRectGetWidth(self.bounds) - [self offsetWithPercentage:(_firstTrigger / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
}

else if (percentage < -kMCStop1) {
position.x = CGRectGetWidth(self.bounds) + [self offsetWithPercentage:percentage + (kMCStop1 / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
else if (percentage < -_firstTrigger) {
position.x = CGRectGetWidth(self.bounds) + [self offsetWithPercentage:percentage + (_firstTrigger / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
}
}

else {
if (_direction == MCSwipeTableViewCellDirectionRight) {
position.x = [self offsetWithPercentage:(kMCStop1 / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
position.x = [self offsetWithPercentage:(_firstTrigger / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
}

else if (_direction == MCSwipeTableViewCellDirectionLeft) {
position.x = CGRectGetWidth(self.bounds) - [self offsetWithPercentage:(kMCStop1 / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
position.x = CGRectGetWidth(self.bounds) - [self offsetWithPercentage:(_firstTrigger / 2) relativeToWidth:CGRectGetWidth(self.bounds)];
}

else {
Expand Down

0 comments on commit 50d2297

Please sign in to comment.