mirror of https://github.com/vector-im/riot-web
refactor RoomScrollStateStore to accomodate scrollmaps for file/notif panel
parent
2b6cbae4a7
commit
8cf6a8c311
|
@ -269,7 +269,7 @@ export default createReactClass({
|
||||||
// If an event ID wasn't specified, default to the one saved for this room
|
// If an event ID wasn't specified, default to the one saved for this room
|
||||||
// in the scroll state store. Assume initialEventPixelOffset should be set.
|
// in the scroll state store. Assume initialEventPixelOffset should be set.
|
||||||
if (!newState.initialEventId) {
|
if (!newState.initialEventId) {
|
||||||
const roomScrollState = RoomScrollStateStore.getScrollState(newState.roomId);
|
const roomScrollState = RoomScrollStateStore.getRoomViewScrollState(newState.roomId);
|
||||||
if (roomScrollState) {
|
if (roomScrollState) {
|
||||||
newState.initialEventId = roomScrollState.focussedEvent;
|
newState.initialEventId = roomScrollState.focussedEvent;
|
||||||
newState.initialEventPixelOffset = roomScrollState.pixelOffset;
|
newState.initialEventPixelOffset = roomScrollState.pixelOffset;
|
||||||
|
@ -470,7 +470,7 @@ export default createReactClass({
|
||||||
|
|
||||||
// update the scroll map before we get unmounted
|
// update the scroll map before we get unmounted
|
||||||
if (this.state.roomId) {
|
if (this.state.roomId) {
|
||||||
RoomScrollStateStore.setScrollState(this.state.roomId, this._getScrollState());
|
RoomScrollStateStore.setRoomViewScrollState(this.state.roomId, this._getScrollState());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.shouldPeek) {
|
if (this.state.shouldPeek) {
|
||||||
|
|
|
@ -32,15 +32,15 @@ class RoomScrollStateStore {
|
||||||
//
|
//
|
||||||
// pixelOffset: the number of pixels the window is scrolled down
|
// pixelOffset: the number of pixels the window is scrolled down
|
||||||
// from the focussedEvent.
|
// from the focussedEvent.
|
||||||
this._scrollStateMap = {};
|
this._RoomViewScrollStateMap = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
getScrollState(roomId) {
|
getRoomViewScrollState(roomId) {
|
||||||
return this._scrollStateMap[roomId];
|
return this._RoomViewScrollStateMap[roomId];
|
||||||
}
|
}
|
||||||
|
|
||||||
setScrollState(roomId, scrollState) {
|
setRoomViewScrollState(roomId, scrollState) {
|
||||||
this._scrollStateMap[roomId] = scrollState;
|
this._RoomViewScrollStateMap[roomId] = scrollState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue