Commit 8f53bd3a by Kim Peace

Fixed scroll to bottom timing in message room when the new picture received from socket

parent 7bc455df
......@@ -47,8 +47,10 @@ CHAT_SOCKET.handleMessage = function (message, roomName, socketKey, collaboratio
if (typeof ChatRoom !== "undefined") {
// 画像、動画の描画を待ってからスクロール
setTimeout(function () {
ChatRoom.scrollToBottom();
}, 300);
let jQueryMessages = $("#messages");
ChatRoom.waitForLoadingImage(jQueryMessages, ChatRoom.scrollToBottom);
ChatRoom.waitForLoadingVideo(jQueryMessages, ChatRoom.scrollToBottom);
}, 0);
} else {
Common.dismissLoadingIndicator();
}
......
......@@ -10,10 +10,10 @@ window.onscroll = function () {
return;
}
beforeScroll = window.scrollY;
ChatRoom.prependMessageWhenScrollIfNeeded();
ChatRoom.appendMessageWhenScrollIfNeeded();
};
ChatRoom.prependMessageWhenScrollIfNeeded = function () {
ChatRoom.appendMessageWhenScrollIfNeeded = function () {
const beforeHeight = $(".room_container").height();
messageCount = $(".chat_message").length;
if ($(this).scrollTop() === 0 && messageCount >= PagingSize.MESSAGE) {
......@@ -27,7 +27,7 @@ ChatRoom.prependMessageWhenScrollIfNeeded = function () {
}
ChatRoom.loadNewMessage().then((messages) => {
// prepend message
ChatRoom.prependMessage(messages);
ChatRoom.appendMessage(messages);
// hide loading indicator
if (typeof loader !== "undefined") {
loader.remove();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment