Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit f38a8dc

Browse files
authored
Merge pull request #5374 from matrix-org/dbkr/imageutils_typescript
Typescript: ImageUtils
2 parents a0c0790 + 8b7ed7a commit f38a8dc

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

.eslintignore.errorfiles

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# autogenerated file: run scripts/generate-eslint-error-ignore-file to update.
22

3-
src/ImageUtils.js
43
src/Markdown.js
54
src/Rooms.js
65
src/Unread.js

src/ImageUtils.js renamed to src/ImageUtils.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2015, 2016 OpenMarket Ltd
2+
Copyright 2015, 2016, 2020 Copyright 2020 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
'use strict';
18-
1917
/**
2018
* Returns the actual height that an image of dimensions (fullWidth, fullHeight)
2119
* will occupy if resized to fit inside a thumbnail bounding box of size
@@ -30,11 +28,11 @@ limitations under the License.
3028
* consume in the timeline, when performing scroll offset calcuations
3129
* (e.g. scroll locking)
3230
*/
33-
export function thumbHeight(fullWidth, fullHeight, thumbWidth, thumbHeight) {
31+
export function thumbHeight(fullWidth: number, fullHeight: number, thumbWidth: number, thumbHeight: number) {
3432
if (!fullWidth || !fullHeight) {
3533
// Cannot calculate thumbnail height for image: missing w/h in metadata. We can't even
3634
// log this because it's spammy
37-
return undefined;
35+
return null;
3836
}
3937
if (fullWidth < thumbWidth && fullHeight < thumbHeight) {
4038
// no scaling needs to be applied

0 commit comments

Comments
 (0)