From d997b01a24456cbeaa98db9fc0315e2d7ea33141 Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Mon, 11 Feb 2019 21:22:50 -0800 Subject: [PATCH] FIX: Scale down swipe in detection to 20px from edge of the screen ...and slightly increase velocity required for menu actions --- .../javascripts/discourse/components/site-header.js.es6 | 2 +- app/assets/javascripts/discourse/mixins/pan-events.js.es6 | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/components/site-header.js.es6 b/app/assets/javascripts/discourse/components/site-header.js.es6 index 8d126c202be..28627bff785 100644 --- a/app/assets/javascripts/discourse/components/site-header.js.es6 +++ b/app/assets/javascripts/discourse/components/site-header.js.es6 @@ -15,7 +15,7 @@ function addFlagProperty(prop) { const PANEL_BODY_MARGIN = 30; //android supports pulling in from the screen edges -const SCREEN_EDGE_MARGIN = 30; +const SCREEN_EDGE_MARGIN = 20; const SCREEN_OFFSET = 300; const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, { diff --git a/app/assets/javascripts/discourse/mixins/pan-events.js.es6 b/app/assets/javascripts/discourse/mixins/pan-events.js.es6 index 840a6aa31d8..423fb1c8a55 100644 --- a/app/assets/javascripts/discourse/mixins/pan-events.js.es6 +++ b/app/assets/javascripts/discourse/mixins/pan-events.js.es6 @@ -4,7 +4,8 @@ **/ export const SWIPE_VELOCITY = 40; export const SWIPE_DISTANCE_THRESHOLD = 50; -export const SWIPE_VELOCITY_THRESHOLD = 0.1; +export const SWIPE_VELOCITY_THRESHOLD = 0.12; +export const MINIMUM_SWIPE_DISTANCE = 5; export default Ember.Mixin.create({ //velocity is pixels per ms @@ -120,7 +121,7 @@ export default Ember.Mixin.create({ } const previousState = this.get("_panState"); const newState = this._calculateNewPanState(previousState, e); - if (previousState.start && newState.distance < 5) { + if (previousState.start && newState.distance < MINIMUM_SWIPE_DISTANCE) { return; } this.set("_panState", newState);