Commit 806d1193 by Kim Peace

Merge branch 'bug/#44032_send_picture_scroll' into 'develop'

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

See merge request !238
parents 7bc455df 8f53bd3a
...@@ -47,8 +47,10 @@ CHAT_SOCKET.handleMessage = function (message, roomName, socketKey, collaboratio ...@@ -47,8 +47,10 @@ CHAT_SOCKET.handleMessage = function (message, roomName, socketKey, collaboratio
if (typeof ChatRoom !== "undefined") { if (typeof ChatRoom !== "undefined") {
// 画像、動画の描画を待ってからスクロール // 画像、動画の描画を待ってからスクロール
setTimeout(function () { setTimeout(function () {
ChatRoom.scrollToBottom(); let jQueryMessages = $("#messages");
}, 300); ChatRoom.waitForLoadingImage(jQueryMessages, ChatRoom.scrollToBottom);
ChatRoom.waitForLoadingVideo(jQueryMessages, ChatRoom.scrollToBottom);
}, 0);
} else { } else {
Common.dismissLoadingIndicator(); Common.dismissLoadingIndicator();
} }
......
...@@ -10,10 +10,10 @@ window.onscroll = function () { ...@@ -10,10 +10,10 @@ window.onscroll = function () {
return; return;
} }
beforeScroll = window.scrollY; beforeScroll = window.scrollY;
ChatRoom.prependMessageWhenScrollIfNeeded(); ChatRoom.appendMessageWhenScrollIfNeeded();
}; };
ChatRoom.prependMessageWhenScrollIfNeeded = function () { ChatRoom.appendMessageWhenScrollIfNeeded = function () {
const beforeHeight = $(".room_container").height(); const beforeHeight = $(".room_container").height();
messageCount = $(".chat_message").length; messageCount = $(".chat_message").length;
if ($(this).scrollTop() === 0 && messageCount >= PagingSize.MESSAGE) { if ($(this).scrollTop() === 0 && messageCount >= PagingSize.MESSAGE) {
...@@ -27,7 +27,7 @@ ChatRoom.prependMessageWhenScrollIfNeeded = function () { ...@@ -27,7 +27,7 @@ ChatRoom.prependMessageWhenScrollIfNeeded = function () {
} }
ChatRoom.loadNewMessage().then((messages) => { ChatRoom.loadNewMessage().then((messages) => {
// prepend message // prepend message
ChatRoom.prependMessage(messages); ChatRoom.appendMessage(messages);
// hide loading indicator // hide loading indicator
if (typeof loader !== "undefined") { if (typeof loader !== "undefined") {
loader.remove(); 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