-
-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Images in messages with different max height #4315
Conversation
I rebased that to PR #4313 for easier testing - just a proposal to avoid too small images in message list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say it looks better now most of the time. But perhaps 800px is a bit too much, because on common monitors such images don't fit on screen unless you have Delta Chat maximized. Maybe max-height: calc(min(60vh, 800px))
would work better.
And super small images look funny. IDK if we call it a bug or a feature:
But they're impossible to click on. Maybe min-height
or min-width
would help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just discovered that the new height also applies to stickers. I suppose it shouldn't be the case.
May I propose a different solution? If I understand the issue correctly. deltachat-desktop/packages/frontend/src/components/attachment/messageAttachment.tsx Line 77 in 7e56aba
We have here dimensionWidth and dimensionHeight as part of message object. We can do something like this to both handle max height and layout jumping when messages load (and maybe also add a minimum height): const dimensionsHeight = Math.min(message.dimensionsHeight, 200)
const dimensionsWidth = message.dimensionsWidth * dimensionsHeight / message.dimensionsHeight
return (
<button
onClick={onClickAttachment}
className={classNames(
'message-attachment-media',
withCaption ? 'content-below' : null,
withContentAbove ? 'content-above' : null
)}
>
<img
className='attachment-content'
width={dimensionsWidth}
height={dimensionsHeight}
src={runtime.transformBlobURL(message.file)}
/>
</button>
) |
a6b5740
to
9218f5b
Compare
I would suggest to merge this now, since it improves many situations. There might be a better solution, by applying various calculations but that should not be part of this PR... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit reluctant to approve this since firstly this doesn't actually fix the issue of reactions overflowing narrow image-messages, and secondly this can introduce unexpected consequences (as with stickers).
But the next release is far away, and if we're up for a bit of trial and error, then let's do it.
(FYI a changelog entry is missing)
@maxphilippov Yes, layout jumping needs to be fixed, but I'd say it can be tackled separately. Also for that I'd suggest to still utilize CSS instead of JS, and pass these JS-provided values as CSS variables. |
9218f5b
to
c9fc40b
Compare
Because of `max-width: 80%`, which refers to 80% of the wrapper square, and not the chat section (the later was apparently the intention). This has been introduced in #4315, which has later been sort of reverted, but not completely, in #4407. So, let's remove the residuals, especially that stickers also have fixed `height: 200px`, so `max-height` doesn't make sense.
Because of `max-width: 80%`, which refers to 80% of the wrapper square, and not the chat section (the later was apparently the intention). This has been introduced in #4315, which has later been sort of reverted, but not completely, in #4407. So, let's remove the residuals, especially that stickers also have fixed `height: 200px`, so `max-height` doesn't make sense.
Because of `max-width: 80%`, which refers to 80% of the wrapper square, and not the chat section (the later was apparently the intention). This has been introduced in #4315, which has later been sort of reverted, but not completely, in #4407. So, let's remove the residuals, especially that stickers also have fixed `height: 200px`, so `max-height` doesn't make sense.
Because of `max-width: 80%`, which refers to 80% of the wrapper square, and not the chat section (the later was apparently the intention). This has been introduced in #4315, which has later been sort of reverted, but not completely, in #4407. So, let's remove the residuals, especially that stickers also have fixed `height: 200px`, so `max-height` doesn't make sense.
No description provided.