mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
refactor(SlideEdgeGesture#_checkEdge): use switch statement
This commit is contained in:
@ -28,13 +28,12 @@ export class SlideEdgeGesture extends SlideGesture {
|
||||
}
|
||||
|
||||
_checkEdge(edge, pos) {
|
||||
if ((edge === 'left' && pos.x > this._containerRect.left + this.threshold) ||
|
||||
(edge === 'right' && pos.x < this._containerRect.width - this.threshold) ||
|
||||
(edge === 'top' && pos.y > this._containerRect.top + this.threshold) ||
|
||||
(edge === 'bottom' && pos.y < this._containerRect.height - this.threshold)) {
|
||||
return false;
|
||||
switch(edge) {
|
||||
case 'left': return pos.x <= this._containerRect.left + this.threshold;
|
||||
case 'right': return pos.x >= this._containerRect.width - this.threshold;
|
||||
case 'top': return pos.y <= this._containerRect.top + this.threshold;
|
||||
case 'bottom': return pos.y >= this._containerRect.height - this.threshold;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user