ionic-team / ionic-ion-drawer

A side menu drawer for Ionic apps
51 stars 84 forks source link

issue on closing the panel if side=='LEFT' #26

Open De-Lac opened 8 years ago

De-Lac commented 8 years ago

inside the doDrag function there is a control like this:

          if (side == RIGHT) 
            { newX = Math.max(0, width - (clientWidth - (lastX - offsetX))); }

the control if side=='LEFT' is missing... I've not tested my new code with side=='RIGHT', but I suggest something like this:

          if ( self.opened )  
            { // I'm closing
              if (side == RIGHT) 
                { newX = Math.max(0, width - (clientWidth - (lastX - offsetX))); }
              else
                { newX = Math.min(0, width - (clientWidth - (lastX - offsetX))); }   
            }
          else
            { // I'm opening
              if (side == RIGHT) 
                { newX = Math.max(0, width - (clientWidth - (lastX - offsetX))); }
            }