Fix wrapWidth for channels on small screens
This commit is contained in:
parent
bb8a4d180e
commit
e19280c2c7
File diff suppressed because one or more lines are too long
@ -1,11 +1,20 @@
|
|||||||
const lineHeight = 24;
|
const lineHeight = 24;
|
||||||
|
let prevWidth;
|
||||||
|
let windowWidth;
|
||||||
|
|
||||||
export default function messageHeight(message, width, charWidth, indent = 0) {
|
export default function messageHeight(message, width, charWidth, indent = 0) {
|
||||||
let pad = (6 + (message.from ? message.from.length + 1 : 0)) * charWidth;
|
let pad = (6 + (message.from ? message.from.length + 1 : 0)) * charWidth;
|
||||||
let height = lineHeight + 4;
|
let height = lineHeight + 4;
|
||||||
|
|
||||||
if (message.channel) {
|
if (message.channel) {
|
||||||
width -= 200;
|
if (width !== prevWidth) {
|
||||||
|
prevWidth = width;
|
||||||
|
windowWidth = window.innerWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (windowWidth > 600) {
|
||||||
|
width -= 200;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pad + (message.message.length * charWidth) < width) {
|
if (pad + (message.message.length * charWidth) < width) {
|
||||||
|
Loading…
Reference in New Issue
Block a user