mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 17:56:01 +03:00
add comments for thumbHeight
This commit is contained in:
parent
7884c13d0d
commit
1125c62505
1 changed files with 15 additions and 0 deletions
|
@ -17,6 +17,21 @@ limitations under the License.
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
* Returns the actual height that an image of dimensions (fullWidth, fullHeight)
|
||||
* will occupy if resized to fit inside a thumbnail bounding box of size
|
||||
* (thumbWidth, thumbHeight).
|
||||
*
|
||||
* If the aspect ratio of the source image is taller than the aspect ratio of
|
||||
* the thumbnail bounding box, then we return the thumbHeight parameter unchanged.
|
||||
* Otherwise we return the thumbHeight parameter scaled down appropriately to
|
||||
* reflect the actual height the scaled thumbnail occupies.
|
||||
*
|
||||
* This is very useful for calculating how much height a thumbnail will actually
|
||||
* consume in the timeline, when performing scroll offset calcuations
|
||||
* (e.g. scroll locking)
|
||||
*/
|
||||
thumbHeight: function(fullWidth, fullHeight, thumbWidth, thumbHeight) {
|
||||
if (!fullWidth || !fullHeight) {
|
||||
// Cannot calculate thumbnail height for image: missing w/h in metadata. We can't even
|
||||
|
|
Loading…
Reference in a new issue