mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 02:05:45 +03:00
Corrected incorrect offset from top of window for the scrollArea
This commit is contained in:
parent
8ccb1d482a
commit
73dd05b01d
1 changed files with 4 additions and 3 deletions
|
@ -320,6 +320,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
_initAndPositionStickyHeaders: function(initialise, scrollToPosition) {
|
_initAndPositionStickyHeaders: function(initialise, scrollToPosition) {
|
||||||
var scrollArea = this._getScrollNode();
|
var scrollArea = this._getScrollNode();
|
||||||
|
var scrollAreaOffset = scrollArea.getBoundingClientRect().top;
|
||||||
var scrollAreaHeight = scrollArea.getBoundingClientRect().height;
|
var scrollAreaHeight = scrollArea.getBoundingClientRect().height;
|
||||||
|
|
||||||
if (initialise) {
|
if (initialise) {
|
||||||
|
@ -334,7 +335,7 @@ module.exports = React.createClass({
|
||||||
if (typeof stickies === "object" && stickies.length > 0) {
|
if (typeof stickies === "object" && stickies.length > 0) {
|
||||||
// Initialise the sticky headers
|
// Initialise the sticky headers
|
||||||
this.stickyWrappers = Array.prototype.map.call(stickies, function(sticky, i) {
|
this.stickyWrappers = Array.prototype.map.call(stickies, function(sticky, i) {
|
||||||
sticky.dataset.originalPosition = sticky.offsetTop - scrollArea.offsetTop;
|
sticky.dataset.originalPosition = sticky.offsetTop - scrollAreaOffset;
|
||||||
var originalHeight = sticky.getBoundingClientRect().height;
|
var originalHeight = sticky.getBoundingClientRect().height;
|
||||||
sticky.dataset.originalHeight = originalHeight;
|
sticky.dataset.originalHeight = originalHeight;
|
||||||
sticky.style.height = originalHeight;
|
sticky.style.height = originalHeight;
|
||||||
|
@ -363,7 +364,7 @@ module.exports = React.createClass({
|
||||||
// Top stickies
|
// Top stickies
|
||||||
sticky.dataset.stuck = "top";
|
sticky.dataset.stuck = "top";
|
||||||
stickyHeader.classList.add("mx_RoomSubList_fixed");
|
stickyHeader.classList.add("mx_RoomSubList_fixed");
|
||||||
stickyHeader.style.top = scrollArea.offsetTop + topStuckHeight + "px";
|
stickyHeader.style.top = scrollAreaOffset + topStuckHeight + "px";
|
||||||
// If stuck at top adjust the scroll back down to take account of all the stuck headers
|
// If stuck at top adjust the scroll back down to take account of all the stuck headers
|
||||||
if (scrollToPosition !== undefined && stickyPosition === scrollToPosition) {
|
if (scrollToPosition !== undefined && stickyPosition === scrollToPosition) {
|
||||||
scrollStuckOffset = topStuckHeight;
|
scrollStuckOffset = topStuckHeight;
|
||||||
|
@ -372,7 +373,7 @@ module.exports = React.createClass({
|
||||||
/// Bottom stickies
|
/// Bottom stickies
|
||||||
sticky.dataset.stuck = "bottom";
|
sticky.dataset.stuck = "bottom";
|
||||||
stickyHeader.classList.add("mx_RoomSubList_fixed");
|
stickyHeader.classList.add("mx_RoomSubList_fixed");
|
||||||
stickyHeader.style.top = (scrollArea.offsetTop + scrollAreaHeight) - bottomStuckHeight + "px";
|
stickyHeader.style.top = (scrollAreaOffset + scrollAreaHeight) - bottomStuckHeight + "px";
|
||||||
} else {
|
} else {
|
||||||
// Not sticky
|
// Not sticky
|
||||||
sticky.dataset.stuck = "none";
|
sticky.dataset.stuck = "none";
|
||||||
|
|
Loading…
Reference in a new issue