From 8e55b59310463feb0fca6addc3e2e36a7673bc8c Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Sat, 20 Dec 2014 21:32:19 +0000 Subject: [PATCH 01/14] fixing drawer not dragginh from right --- ionic.contrib.drawer.css | 3 ++- ionic.contrib.drawer.js | 47 +++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/ionic.contrib.drawer.css b/ionic.contrib.drawer.css index bfbdef6..861183e 100644 --- a/ionic.contrib.drawer.css +++ b/ionic.contrib.drawer.css @@ -1,9 +1,10 @@ drawer { display: block; position: fixed; - width: 270px; + width: 50%; height: 100%; z-index: 100; + background-color: white; } drawer.animate { diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index 8544126..32a6fb7 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -9,7 +9,8 @@ */ angular.module('ionic.contrib.drawer', ['ionic']) -.controller('drawerCtrl', ['$element', '$attrs', '$ionicGesture', '$document', function($element, $attr, $ionicGesture, $document) { +.controller('drawerCtrl', ['$element', '$attrs', '$ionicGesture', '$timeout', '$document', function($element, $attr, $ionicGesture, $timeout, $document) { + var el = $element[0]; var dragging = false; var startX, lastX, offsetX, newX; @@ -25,7 +26,13 @@ angular.module('ionic.contrib.drawer', ['ionic']) var isTargetDrag = false; - var width = $element[0].clientWidth; + var width = 0; + + var clientWidth = document.body.clientWidth; + + $timeout(function(){ + width = $element[0].clientWidth; + }, 10); var enableAnimation = function() { $element.addClass('animate'); @@ -79,8 +86,9 @@ angular.module('ionic.contrib.drawer', ['ionic']) enableAnimation(); ionic.requestAnimationFrame(function() { - if(newX < (-width / 2)) { - el.style.transform = el.style.webkitTransform = 'translate3d(' + -width + 'px, 0, 0)'; + console.log(newX, (width / 2)) + if(newX > (width / 2)) { + el.style.transform = el.style.webkitTransform = 'translate3d('+width+'px, 0, 0)'; } else { el.style.transform = el.style.webkitTransform = 'translate3d(0px, 0, 0)'; } @@ -99,22 +107,28 @@ angular.module('ionic.contrib.drawer', ['ionic']) lastX = e.gesture.touches[0].pageX; if(!dragging) { - // Dragged 15 pixels and finger is by edge - if(Math.abs(lastX - startX) > thresholdX) { - if(isTarget(e.target)) { - startTargetDrag(e); - } else if(startX < edgeX) { - startDrag(e); - } + if(isTarget(e.target)) { + startTargetDrag(e); + } else if(Math.abs(lastX - startX) > thresholdX) { + if (side == RIGHT) { + if (startX > edgeX) { + startDrag(e); + } + } else { + if (startX < edgeX) { + startDrag(e); + } + } } } else { - console.log(lastX, offsetX, lastX - offsetX); - newX = Math.min(0, (-width + (lastX - offsetX))); + console.log(lastX - offsetX) + newX = Math.max(0, width- (clientWidth - (lastX - offsetX))); + ionic.requestAnimationFrame(function() { + console.log('drag', newX) el.style.transform = el.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)'; }); - } if(dragging) { @@ -123,7 +137,10 @@ angular.module('ionic.contrib.drawer', ['ionic']) }; side = $attr.side == 'left' ? LEFT : RIGHT; - console.log(side); + + if (side == RIGHT) { + edgeX = clientWidth - edgeX + } $ionicGesture.on('drag', function(e) { doDrag(e); From 2771686d2c03c1f622e3b3f4c158a6e35c33295a Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Sun, 28 Dec 2014 20:29:48 +0000 Subject: [PATCH 02/14] Better animation --- ionic.contrib.drawer.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic.contrib.drawer.css b/ionic.contrib.drawer.css index 861183e..3295928 100644 --- a/ionic.contrib.drawer.css +++ b/ionic.contrib.drawer.css @@ -9,7 +9,7 @@ drawer { drawer.animate { -webkit-transition: 0.4s all ease-in-out; - transition: 0.4s all ease-in-out; + transition: 200ms all ease; } drawer.left { From fd0961638c5fb7fcd0013e5395487de4d908a45b Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Sun, 28 Dec 2014 20:30:51 +0000 Subject: [PATCH 03/14] Better animation --- ionic.contrib.drawer.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic.contrib.drawer.css b/ionic.contrib.drawer.css index 3295928..879a59c 100644 --- a/ionic.contrib.drawer.css +++ b/ionic.contrib.drawer.css @@ -8,7 +8,7 @@ drawer { } drawer.animate { - -webkit-transition: 0.4s all ease-in-out; + -webkit-transition: 200ms all ease; transition: 200ms all ease; } From 95f1d6312081d6ed8b5221a80cf2d3e624e6a8d0 Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Fri, 30 Jan 2015 16:43:29 +0000 Subject: [PATCH 04/14] adding close-fn --- ionic.contrib.drawer.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index 32a6fb7..e4f3dca 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -58,6 +58,7 @@ angular.module('ionic.contrib.drawer', ['ionic']) offsetX = lastX - startX; console.log('Starting drag'); console.log('Offset:', offsetX); + $ionicBody.addClass('drawer-open'); }; var startTargetDrag = function(e) { @@ -89,8 +90,10 @@ angular.module('ionic.contrib.drawer', ['ionic']) console.log(newX, (width / 2)) if(newX > (width / 2)) { el.style.transform = el.style.webkitTransform = 'translate3d('+width+'px, 0, 0)'; + $document[0].body.classList.remove('drawer-open'); } else { el.style.transform = el.style.webkitTransform = 'translate3d(0px, 0, 0)'; + $document[0].body.classList.add('drawer-open'); } }); }; @@ -159,9 +162,13 @@ angular.module('ionic.contrib.drawer', ['ionic']) el.style.transform = el.style.webkitTransform = 'translate3d(100%, 0, 0)'; } }); + + $document[0].body.classList.remove('drawer-open'); }; this.open = function() { + $document[0].body.classList.add('drawer-open'); + enableAnimation(); ionic.requestAnimationFrame(function() { if(side === LEFT) { @@ -170,6 +177,7 @@ angular.module('ionic.contrib.drawer', ['ionic']) el.style.transform = el.style.webkitTransform = 'translate3d(0%, 0, 0)'; } }); + }; }]) @@ -179,6 +187,19 @@ angular.module('ionic.contrib.drawer', ['ionic']) controller: 'drawerCtrl', link: function($scope, $element, $attr, ctrl) { $element.addClass($attr.side); + + var opened = false; + + $scope.toggleDrawer = function() { + if (opened) { + opened = false; + $scope.closeDrawer(); + } else { + opened = true; + $scope.openDrawer(); + } + }; + $scope.openDrawer = function() { console.log('open'); ctrl.open(); From eac35c05a40a254f5f8f1ac51814db3448265018 Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Fri, 30 Jan 2015 16:43:58 +0000 Subject: [PATCH 05/14] Updating styles for right-hand-side opened drawer --- ionic.contrib.drawer.css | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ionic.contrib.drawer.css b/ionic.contrib.drawer.css index 879a59c..65d8c55 100644 --- a/ionic.contrib.drawer.css +++ b/ionic.contrib.drawer.css @@ -1,3 +1,18 @@ +.drawer-open ion-view.pane{ + opacity:0.4; +} + +.drawer-open ion-pane.pane{ + background-color: rgb(0,0,0); +} +.drawer-open view{ + background-color: rgb(0,0,0); +} + +.drawer-open .drawer-content .pane, .drawer-open .drawer-content .scroll-content { + pointer-events: none; +} + drawer { display: block; position: fixed; @@ -8,8 +23,8 @@ drawer { } drawer.animate { - -webkit-transition: 200ms all ease; - transition: 200ms all ease; + -webkit-transition: 300ms all ease; + transition: 300ms all ease; } drawer.left { From b7d974c761844acb4867a280925a76e743a394af Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Sat, 31 Jan 2015 13:52:00 +0000 Subject: [PATCH 06/14] Making toggle function globally available --- ionic.contrib.drawer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index e4f3dca..848c57b 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -190,7 +190,7 @@ angular.module('ionic.contrib.drawer', ['ionic']) var opened = false; - $scope.toggleDrawer = function() { + $rootScope.toggleDrawer = function() { if (opened) { opened = false; $scope.closeDrawer(); From 115ca2540f1a70ec9f56e262051d3565fac029a0 Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Sat, 21 Mar 2015 17:18:58 +0000 Subject: [PATCH 07/14] Fixing stuff --- ionic.contrib.drawer.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index 848c57b..39aa319 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -9,7 +9,9 @@ */ angular.module('ionic.contrib.drawer', ['ionic']) -.controller('drawerCtrl', ['$element', '$attrs', '$ionicGesture', '$timeout', '$document', function($element, $attr, $ionicGesture, $timeout, $document) { +.controller('drawerCtrl', ['$element', '$attrs', '$ionicGesture', '$ionicScrollDelegate', '$timeout', '$document', function($element, $attr, $ionicGesture, $ionicScrollDelegate, $timeout, $document) { + + var self = this; var el = $element[0]; var dragging = false; @@ -41,6 +43,8 @@ angular.module('ionic.contrib.drawer', ['ionic']) $element.removeClass('animate'); }; + self.opened = false; + // Check if this is on target or not var isTarget = function(el) { while(el) { @@ -87,13 +91,10 @@ angular.module('ionic.contrib.drawer', ['ionic']) enableAnimation(); ionic.requestAnimationFrame(function() { - console.log(newX, (width / 2)) - if(newX > (width / 2)) { - el.style.transform = el.style.webkitTransform = 'translate3d('+width+'px, 0, 0)'; - $document[0].body.classList.remove('drawer-open'); + if(newX > (width / 100 * 20)) { + self.close() } else { - el.style.transform = el.style.webkitTransform = 'translate3d(0px, 0, 0)'; - $document[0].body.classList.add('drawer-open'); + self.open() } }); }; @@ -125,11 +126,9 @@ angular.module('ionic.contrib.drawer', ['ionic']) } } } else { - console.log(lastX - offsetX) newX = Math.max(0, width- (clientWidth - (lastX - offsetX))); ionic.requestAnimationFrame(function() { - console.log('drag', newX) el.style.transform = el.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)'; }); } @@ -144,16 +143,19 @@ angular.module('ionic.contrib.drawer', ['ionic']) if (side == RIGHT) { edgeX = clientWidth - edgeX } - $ionicGesture.on('drag', function(e) { + $ionicScrollDelegate.freezeAllScrolls(true); doDrag(e); }, $document); $ionicGesture.on('dragend', function(e) { + $ionicScrollDelegate.freezeAllScrolls(false); doEndDrag(e); }, $document); this.close = function() { + self.opened = false; + enableAnimation(); ionic.requestAnimationFrame(function() { if(side === LEFT) { @@ -167,6 +169,8 @@ angular.module('ionic.contrib.drawer', ['ionic']) }; this.open = function() { + self.opened = true; + $document[0].body.classList.add('drawer-open'); enableAnimation(); @@ -188,14 +192,12 @@ angular.module('ionic.contrib.drawer', ['ionic']) link: function($scope, $element, $attr, ctrl) { $element.addClass($attr.side); - var opened = false; + ctrl.opened = false; - $rootScope.toggleDrawer = function() { - if (opened) { - opened = false; + $scope.toggleDrawer = function() { + if (ctrl.opened) { $scope.closeDrawer(); } else { - opened = true; $scope.openDrawer(); } }; From 7dd83c699dac994d33f917dd098debe452d9253a Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Sun, 22 Mar 2015 20:12:14 +0000 Subject: [PATCH 08/14] Various fixes including right-hand-side drawer fix --- ionic.contrib.drawer.css | 15 -------------- ionic.contrib.drawer.js | 42 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/ionic.contrib.drawer.css b/ionic.contrib.drawer.css index 65d8c55..e51756b 100644 --- a/ionic.contrib.drawer.css +++ b/ionic.contrib.drawer.css @@ -1,18 +1,3 @@ -.drawer-open ion-view.pane{ - opacity:0.4; -} - -.drawer-open ion-pane.pane{ - background-color: rgb(0,0,0); -} -.drawer-open view{ - background-color: rgb(0,0,0); -} - -.drawer-open .drawer-content .pane, .drawer-open .drawer-content .scroll-content { - pointer-events: none; -} - drawer { display: block; position: fixed; diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index 39aa319..9a5c028 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -3,9 +3,7 @@ 'use strict'; /** - * The ionic-contrib-frosted-glass is a fun frosted-glass effect - * that can be used in iOS apps to give an iOS 7 frosted-glass effect - * to any element. + * The ionic-contrib-drawer is fly-out panel that unlike sidemenu appears over the top of content */ angular.module('ionic.contrib.drawer', ['ionic']) @@ -28,13 +26,13 @@ angular.module('ionic.contrib.drawer', ['ionic']) var isTargetDrag = false; - var width = 0; + var width = $element[0].clientWidth; - var clientWidth = document.body.clientWidth; + var clientWidth = window.innerWidth; - $timeout(function(){ - width = $element[0].clientWidth; - }, 10); + self.init = function() { + width = $element[0].clientWidth; + } var enableAnimation = function() { $element.addClass('animate'); @@ -60,9 +58,6 @@ angular.module('ionic.contrib.drawer', ['ionic']) dragging = true; offsetX = lastX - startX; - console.log('Starting drag'); - console.log('Offset:', offsetX); - $ionicBody.addClass('drawer-open'); }; var startTargetDrag = function(e) { @@ -71,8 +66,6 @@ angular.module('ionic.contrib.drawer', ['ionic']) dragging = true; isTargetDrag = true; offsetX = lastX - startX; - console.log('Starting target drag'); - console.log('Offset:', offsetX); }; var doEndDrag = function(e) { @@ -87,11 +80,16 @@ angular.module('ionic.contrib.drawer', ['ionic']) dragging = false; - console.log('End drag'); enableAnimation(); + var condition = (newX < (-width / 2)) + + if (side == RIGHT) { + condition = (newX > (width / 100 * 20)) + } + ionic.requestAnimationFrame(function() { - if(newX > (width / 100 * 20)) { + if(condition) { self.close() } else { self.open() @@ -126,7 +124,11 @@ angular.module('ionic.contrib.drawer', ['ionic']) } } } else { - newX = Math.max(0, width- (clientWidth - (lastX - offsetX))); + newX = Math.min(0, (-width + (lastX - offsetX))); + + if (side == RIGHT) { + newX = Math.max(0, width - (clientWidth - (lastX - offsetX))); + } ionic.requestAnimationFrame(function() { el.style.transform = el.style.webkitTransform = 'translate3d(' + newX + 'px, 0, 0)'; @@ -192,22 +194,20 @@ angular.module('ionic.contrib.drawer', ['ionic']) link: function($scope, $element, $attr, ctrl) { $element.addClass($attr.side); - ctrl.opened = false; + ctrl.init(); $scope.toggleDrawer = function() { if (ctrl.opened) { - $scope.closeDrawer(); + ctrl.close(); } else { - $scope.openDrawer(); + ctrl.open(); } }; $scope.openDrawer = function() { - console.log('open'); ctrl.open(); }; $scope.closeDrawer = function() { - console.log('close'); ctrl.close(); }; } From c7f3762aaf4c45f4bf574c24ab18661a748b3aa1 Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Sun, 22 Mar 2015 20:24:01 +0000 Subject: [PATCH 09/14] Fixing merge conflict --- ionic.contrib.drawer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index fdac7d3..80d2871 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -212,7 +212,7 @@ angular.module('ionic.contrib.drawer', ['ionic']) }; } } -}]); +}]) .directive('drawerClose', ['$rootScope', function($rootScope) { return { From c1a4fe6aafa0b9fcfcd0001767c5cbe52381d4c9 Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Sun, 22 Mar 2015 20:34:30 +0000 Subject: [PATCH 10/14] drag 20% of drawer's width feels better before deciding whether to close it or open it --- ionic.contrib.drawer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index 80d2871..5d985d5 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -82,7 +82,7 @@ angular.module('ionic.contrib.drawer', ['ionic']) enableAnimation(); - var condition = (newX < (-width / 2)) + var condition = (newX < (- width / 100 * 20)) if (side == RIGHT) { condition = (newX > (width / 100 * 20)) From d06f2dcaf162cdcc41860f299b3560f06232f843 Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Mon, 23 Mar 2015 09:38:51 +0000 Subject: [PATCH 11/14] Only freeze scrolling of other elements if we are dragging drawer horizontally --- ionic.contrib.drawer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index 5d985d5..b84b560 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -55,6 +55,7 @@ angular.module('ionic.contrib.drawer', ['ionic']) var startDrag = function(e) { disableAnimation(); + $ionicScrollDelegate.freezeAllScrolls(true); dragging = true; offsetX = lastX - startX; @@ -146,7 +147,6 @@ angular.module('ionic.contrib.drawer', ['ionic']) edgeX = clientWidth - edgeX } $ionicGesture.on('drag', function(e) { - $ionicScrollDelegate.freezeAllScrolls(true); doDrag(e); }, $document); $ionicGesture.on('dragend', function(e) { From 7f849d541e63ce007d441bb250a1fb9a82710cc5 Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Mon, 23 Mar 2015 09:43:16 +0000 Subject: [PATCH 12/14] same as above --- ionic.contrib.drawer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index b84b560..bf7bd29 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -55,7 +55,6 @@ angular.module('ionic.contrib.drawer', ['ionic']) var startDrag = function(e) { disableAnimation(); - $ionicScrollDelegate.freezeAllScrolls(true); dragging = true; offsetX = lastX - startX; @@ -63,7 +62,8 @@ angular.module('ionic.contrib.drawer', ['ionic']) var startTargetDrag = function(e) { disableAnimation(); - + $ionicScrollDelegate.freezeAllScrolls(true); + dragging = true; isTargetDrag = true; offsetX = lastX - startX; @@ -109,11 +109,11 @@ angular.module('ionic.contrib.drawer', ['ionic']) lastX = e.gesture.touches[0].pageX; - if(!dragging) { + if (!dragging) { // Dragged 15 pixels and finger is by edge - if(isTarget(e.target)) { + if (isTarget(e.target)) { startTargetDrag(e); - } else if(Math.abs(lastX - startX) > thresholdX) { + } else if (Math.abs(lastX - startX) > thresholdX) { if (side == RIGHT) { if (startX > edgeX) { startDrag(e); From 4461f880759dd9145373655d2cf96505a1ed8f00 Mon Sep 17 00:00:00 2001 From: Yuri Petusko Date: Mon, 23 Mar 2015 10:12:38 +0000 Subject: [PATCH 13/14] Only freeze scroll if dragged above threshold --- ionic.contrib.drawer.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index bf7bd29..03e3a26 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -13,7 +13,7 @@ angular.module('ionic.contrib.drawer', ['ionic']) var el = $element[0]; var dragging = false; - var startX, lastX, offsetX, newX; + var startX, lastX, offsetX, newX, startDragX; var side; // How far to drag before triggering @@ -62,7 +62,6 @@ angular.module('ionic.contrib.drawer', ['ionic']) var startTargetDrag = function(e) { disableAnimation(); - $ionicScrollDelegate.freezeAllScrolls(true); dragging = true; isTargetDrag = true; @@ -104,15 +103,20 @@ angular.module('ionic.contrib.drawer', ['ionic']) } if(!lastX) { + startDragX = e.gesture.touches[0].pageX; startX = e.gesture.touches[0].pageX; } + + var position = el.getBoundingClientRect(); lastX = e.gesture.touches[0].pageX; if (!dragging) { // Dragged 15 pixels and finger is by edge if (isTarget(e.target)) { + startX = position.left; startTargetDrag(e); + } else if (Math.abs(lastX - startX) > thresholdX) { if (side == RIGHT) { if (startX > edgeX) { @@ -127,6 +131,10 @@ angular.module('ionic.contrib.drawer', ['ionic']) } else { newX = Math.min(0, (-width + (lastX - offsetX))); + if (Math.abs(startDragX - lastX) > thresholdX) { + $ionicScrollDelegate.freezeAllScrolls(true); + } + if (side == RIGHT) { newX = Math.max(0, width - (clientWidth - (lastX - offsetX))); } @@ -226,4 +234,4 @@ angular.module('ionic.contrib.drawer', ['ionic']) } }]); -})(); +})(); \ No newline at end of file From c79df6897889602e0fc60e2ba98034103622e488 Mon Sep 17 00:00:00 2001 From: Aknilam Date: Fri, 1 Apr 2016 01:12:23 +0200 Subject: [PATCH 14/14] fix drawer on left position When you click on opened drawer on left position, it `closes` automatically - moves behind left area. --- ionic.contrib.drawer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ionic.contrib.drawer.js b/ionic.contrib.drawer.js index 03e3a26..27d7b82 100644 --- a/ionic.contrib.drawer.js +++ b/ionic.contrib.drawer.js @@ -129,7 +129,7 @@ angular.module('ionic.contrib.drawer', ['ionic']) } } } else { - newX = Math.min(0, (-width + (lastX - offsetX))); + newX = Math.min(0, ((self.opened ? 0 : -width) + (lastX - offsetX))); if (Math.abs(startDragX - lastX) > thresholdX) { $ionicScrollDelegate.freezeAllScrolls(true); @@ -234,4 +234,4 @@ angular.module('ionic.contrib.drawer', ['ionic']) } }]); -})(); \ No newline at end of file +})();