-
Notifications
You must be signed in to change notification settings - Fork 984
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
Measuring the proper sizes of images in chat #15675
Conversation
Jenkins BuildsClick to see older builds (4)
|
true)] | ||
(reset! measured-width width) | ||
(reset! measured-height height))) | ||
:style (style/image {:width @measured-width |
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.
Are there any safeguards in place if actual width and actual height are greater than our viewport?
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.
Good point, Should we default to a factor of the screen dimensions ?
Like for example the max or the undefined value to be %25 width and height of the screen
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.
for small images and images with weird aspect ratios we will face scaling issues. I think better is to use object-fit css, something along the lines of this : https://stackoverflow.com/a/34713809 but then again I am not 100% sure of this solution either.
Will have to spend some time on this to get an optimal state.. @ibrkhalil
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.
There is already a safeguard, this is how the style for link-preview-loader
is defined:
(defn image
[{:keys [height width] :as dimensions}]
(merge (if (and (pos? height)
(pos? width))
(scale-dimensions dimensions)
{:height 170})
{:overflow :hidden
:border-radius 12}))
It uses the function scale-dimension
which scales the pic and takes the screen width into the consideration (see status-im2.contexts.chat.messages.link-preview.style/scale-dimensions
)
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.
Looks good to me.
93% of end-end tests have passed
Failed tests (2)Click to expandClass TestActivityCenterContactRequestMultipleDevicePR:
Class TestCommunityMultipleDeviceMerged:
Passed tests (27)Click to expandClass TestActivityCenterContactRequestMultipleDevicePR:
Class TestActivityMultipleDevicePR:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestCommunityMultipleDeviceMerged:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestCommunityOneDeviceMerged:
|
Thanks for your work @alwx! |
* Measuring the proper sizes of images * Style fix
* Measuring the proper sizes of images * Style fix
Fixes #15654
Platforms
Areas that maybe impacted
Functional
status: ready