Skip to content

Commit e59230e

Browse files
committed
feat: added leftClosedDrawerAllowDraging and other to disable drag to open
1 parent b59d075 commit e59230e

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

src/index.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ export class Drawer extends GridLayout {
109109
public rightOpenedDrawerAllowDraging = true;
110110
public bottomOpenedDrawerAllowDraging = true;
111111
public topOpenedDrawerAllowDraging = true;
112+
public leftClosedDrawerAllowDraging = true;
113+
public rightClosedDrawerAllowDraging = true;
114+
public bottomClosedDrawerAllowDraging = true;
115+
public topClosedDrawerAllowDraging = true;
112116
public panGestureHandler: PanGestureHandler;
113117
public gestureEnabled = true;
114118

@@ -198,18 +202,21 @@ export class Drawer extends GridLayout {
198202
}
199203
}
200204
return this.backDrop.opacity !== 0;
201-
} else if (this.leftDrawer && data.x <= this.leftSwipeDistance) {
202-
this.needToSetSide = 'left';
203-
return true;
204-
} else if (this.rightDrawer && data.x >= width - this.rightSwipeDistance) {
205-
this.needToSetSide = 'right';
206-
return true;
207-
} else if (this.bottomDrawer && data.y >= height - this.bottomSwipeDistance) {
208-
this.needToSetSide = 'bottom';
209-
return true;
210-
} else if (this.topDrawer && data.y <= this.topSwipeDistance) {
211-
this.needToSetSide = 'top';
212-
return true;
205+
} else {
206+
let needToSetSide;
207+
if (this.leftDrawer && data.x <= this.leftSwipeDistance) {
208+
needToSetSide = 'left';
209+
} else if (this.rightDrawer && data.x >= width - this.rightSwipeDistance) {
210+
needToSetSide = 'right';
211+
} else if (this.bottomDrawer && data.y >= height - this.bottomSwipeDistance) {
212+
needToSetSide = 'bottom';
213+
} else if (this.topDrawer && data.y <= this.topSwipeDistance) {
214+
needToSetSide = 'top';
215+
}
216+
if (needToSetSide && this[needToSetSide + 'ClosedDrawerAllowDraging']) {
217+
this.needToSetSide = needToSetSide;
218+
return true;
219+
}
213220
}
214221
return false;
215222
}

0 commit comments

Comments
 (0)