Skip to content

Commit

Permalink
Merge pull request #1120 from thelounge/xpaw/scroll-perf
Browse files Browse the repository at this point in the history
Include trickery to reduce paints and improve performance
  • Loading branch information
xPaw committed Jun 20, 2017
2 parents 04c67de + 7ec0dcf commit 2091a5b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
37 changes: 12 additions & 25 deletions client/css/style.css
Expand Up @@ -140,10 +140,6 @@ kbd {
.container {
margin: 80px auto;
max-width: 480px;
overflow: hidden;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
padding: 0 30px;
}

::-moz-placeholder {
Expand Down Expand Up @@ -374,8 +370,7 @@ kbd {
}

#viewport.rt #chat .sidebar {
-webkit-transform: translate3d(180px, 0, 0);
transform: translate3d(180px, 0, 0);
right: -180px;
}

#sidebar {
Expand All @@ -389,6 +384,10 @@ kbd {
width: 220px;
}

#viewport.menu-open #sidebar {
will-change: transform;
}

#sidebar button,
#sidebar .chan,
#sidebar .sign-out {
Expand Down Expand Up @@ -764,6 +763,7 @@ kbd {
left: 0;
right: 0;
overflow: auto;
will-change: transform, scroll-position;
-webkit-overflow-scrolling: touch;
position: absolute;
}
Expand All @@ -787,9 +787,7 @@ kbd {
position: absolute;
right: 0;
width: 180px;
transition: all .4s;
-webkit-transform: translateZ(0);
transform: translateZ(0);
transition: right .4s;
}

#chat .show-more {
Expand Down Expand Up @@ -1164,6 +1162,7 @@ kbd {
bottom: 0;
overflow: auto;
overflow-x: hidden;
will-change: transform, scroll-position;
-webkit-overflow-scrolling: touch;
padding-bottom: 10px;
position: absolute;
Expand Down Expand Up @@ -1850,11 +1849,6 @@ kbd {
margin-top: 60px !important;
}

#viewport.rt #chat .sidebar {
-webkit-transform: translate3d(-180px, 0, 0);
transform: translate3d(-180px, 0, 0);
}

#sidebar,
#footer {
left: -220px;
Expand Down Expand Up @@ -1889,19 +1883,12 @@ kbd {
right: -180px;
}

#chat .title:before {
display: none;
}
}

@media (min-width: 769px) {
#viewport {
-webkit-transform: none !important;
transform: none !important;
#viewport.rt #chat .sidebar {
right: 0;
}

#viewport.menu-open {
transition: none;
#chat .title:before {
display: none;
}
}

Expand Down
6 changes: 3 additions & 3 deletions client/js/libs/slideout.js
Expand Up @@ -23,7 +23,7 @@ module.exports = function slideoutMenu(viewport, menu) {
function onTouchStart(e) {
if (e.touches.length !== 1) {
onTouchEnd();
return false;
return;
}

var touch = e.touches.item(0);
Expand All @@ -37,7 +37,7 @@ module.exports = function slideoutMenu(viewport, menu) {
touchStartTime = Date.now();

viewport.addEventListener("touchmove", onTouchMove);
viewport.addEventListener("touchend", onTouchEnd);
viewport.addEventListener("touchend", onTouchEnd, {passive: true});
}
}

Expand Down Expand Up @@ -91,7 +91,7 @@ module.exports = function slideoutMenu(viewport, menu) {
menuIsMoving = false;
}

viewport.addEventListener("touchstart", onTouchStart);
viewport.addEventListener("touchstart", onTouchStart, {passive: true});

return {
disable: disableSlideout,
Expand Down

0 comments on commit 2091a5b

Please sign in to comment.