Skip redundant scroll adjustment

d56011b60f4ce35e0faa996c2cf643ec6b6504e3

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -3Ignore whitespace
public/script.js+4 -3
@@ -2136,11 +2136,12 @@ export function appendMediaToMessage(mes, messageElement, scrollBehavior = SCROL
2136 chatElement.scrollTop(scrollPosition);2136 chatElement.scrollTop(scrollPosition);
2137 return;2137 return;
2138 }2138 }
2139 const newChatHeight = chatElement.prop('scrollHeight');2139 const newScrollPosition = chatElement.scrollTop();
2140 const diff = newChatHeight - chatHeight;2140 if (newScrollPosition > scrollPosition) {
2141 if (Math.abs(diff) < 1) {
2142 return;2141 return;
2143 }2142 }
2143 const newChatHeight = chatElement.prop('scrollHeight');
2144 const diff = newChatHeight - chatHeight;
2144 chatElement.scrollTop(scrollPosition + diff);2145 chatElement.scrollTop(scrollPosition + diff);
2145 };2146 };
21462147