Unexpected behaviour while implementing swipe to dash

I have implemented a simple swipe to dash mechanism but it’s really buggy. Can someone recommend a better way to do it. This is how I have done it:

update: function() {
this.physics.arcade.collide(player, platforms);

var cursors = game.vjoy.cursors; 
player.body.velocity.x = 0; 
if (cursors.left) {
    player.body.velocity.x = -200;
} else if (cursors.right) {
    player.body.velocity.x = 200;
}

ptr = game.input.activePointer;
if(ptr.justPressed() == true)
{
    startx = ptr.worldX;
    starty = ptr.worldY;
}
if(ptr.justReleased()==true)
{
    endx = ptr.worldX;
    endy = ptr.worldY;
   
    movx = endx - startx;
    movy = endy - starty; 

    //If swipe starts from right half of the screen and magnitude of swipe is greater than 10
    if(startx >= 512 && (movx>10 || movx<-10 || movy>10 || movy<-10))
        this.moveplayer(movx,movy);
}

},

moveplayer: function(velx,vely)
{
    player.body.velocity = 0;
    velx = velx * 10;
    vely = vely * 10;
    movevelocity = new Phaser.Point(velx,vely);
    player.body.velocity = movevelocity;
}, 
I even have an onTap listener which makes the player jump. For some reason the dash is really weird, after the player stops moving in the direction of the dash it start going up. You can try it for yourself here http://princewael100.000webhostapp.com/Splash/index.html Just swipe in any direction on the right side of the screen.

You should be using

function (velx, vely) {
  player.body.velocity.set(velx * 10, vely * 10);
}

justPressed() and justReleased() mean just within a certain interval, default 200ms. Try

game.input.justPressedRate = 20;
game.input.justReleasedRate = 20;

Thanks for the reply but unfortunately your solution didn’t work. The player still does a weird mid air jump after completing the dash.

Well the jump is from the tap.