From 5c999fe1ab307083ef224728c45e1b8f8c3ed681 Mon Sep 17 00:00:00 2001
From: Matthew Hodgson <matthew@matrix.org>
Date: Thu, 17 Dec 2015 14:56:09 +0000
Subject: [PATCH] stop the incoming call box from scrolling off the screen
---
src/components/views/rooms/RoomList.js | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js
index 9ec2bf0d45..ad749295ae 100644
--- a/src/components/views/rooms/RoomList.js
+++ b/src/components/views/rooms/RoomList.js
@@ -259,15 +259,24 @@ module.exports = React.createClass({
if (firstTime) {
// scroll to make sure the callbox is on the screen...
- if (top < 10) {
+ if (top < 10) { // 10px of vertical margin at top of screen
scroll.scrollTop = incomingCallBox.parentElement.offsetTop - 10;
}
- else if (top > scroll.clientHeight - incomingCallBox.offsetHeight) {
- scroll.scrollTop = incomingCallBox.parentElement.offsetTop - scroll.offsetHeight + incomingCallBox.offsetHeight;
+ else if (top > scroll.clientHeight - incomingCallBox.offsetHeight + 50) {
+ scroll.scrollTop = incomingCallBox.parentElement.offsetTop - scroll.offsetHeight + incomingCallBox.offsetHeight - 50;
}
// recalculate top in case we clipped it.
top = (scroll.offsetTop + incomingCallBox.parentElement.offsetTop - scroll.scrollTop);
}
+ else {
+ // stop the box from scrolling off the screen
+ if (top < 10) {
+ top = 10;
+ }
+ else if (top > scroll.clientHeight - incomingCallBox.offsetHeight + 50) {
+ top = scroll.clientHeight - incomingCallBox.offsetHeight + 50;
+ }
+ }
incomingCallBox.style.top = top + "px";
incomingCallBox.style.left = scroll.offsetLeft + scroll.offsetWidth + "px";
--
GitLab