Merge pull request #836 from thelounge/xpaw/slideout-width

Calculate menu width on touch start
This commit is contained in:
Jérémie Astori 2017-01-04 01:48:38 -05:00 committed by GitHub
commit 280d145502

View file

@ -5,7 +5,7 @@ export default function slideoutMenu(viewport, menu) {
var touchStartPos = null;
var touchCurPos = null;
var touchStartTime = 0;
var menuWidth = parseFloat(window.getComputedStyle(menu).width);
var menuWidth = 0;
var menuIsOpen = false;
var menuIsMoving = false;
@ -27,6 +27,8 @@ export default function slideoutMenu(viewport, menu) {
var touch = e.touches.item(0);
viewport.classList.toggle("menu-dragging", true);
menuWidth = parseFloat(window.getComputedStyle(menu).width);
if ((!menuIsOpen && touch.screenX < 50) || (menuIsOpen && touch.screenX > menuWidth)) {
touchStartPos = touch;
touchCurPos = touch;