This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 808
Add option to change the size of images/videos in the timeline #7017
Merged
Merged
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
aef7e59
Add support for variable image size in timeline (default/large)
turt2live 9584a58
Move `Layout` to new enums path
turt2live a335c6a
Dear Linter, here is your semicolon
turt2live e56f918
Update src/components/views/settings/ImageSizePanel.tsx
turt2live 359ebd7
Merge branch 'develop' into travis/image-size
turt2live c52ad3f
Apply changes to videos as well
turt2live 11f1d89
Apply 8px border radius
turt2live ec46fce
Merge branch 'develop' into travis/image-size
toger5 f13d1c0
fix crash when opening the appearance-settings
toger5 c72c4ef
fix rounded corners for blurhash
toger5 2512087
Make images size based on Width
toger5 4ce60ed
Always scale videos based on the requested width.
toger5 ee6fcc7
fix typo
toger5 33428cc
Merge branch 'develop' into travis/image-size
toger5 90ec75f
use $timeline-image-boarder-radius
toger5 591b63e
Merge remote-tracking branch 'origin/travis/image-size' into travis/i…
toger5 6748113
add return type to thumbScale
toger5 6975892
add space at the top of the file
toger5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ import { IBodyProps } from "./IBodyProps"; | |
| import MFileBody from "./MFileBody"; | ||
|
|
||
| import { logger } from "matrix-js-sdk/src/logger"; | ||
| import { ImageSize } from "../../../settings/enums/ImageSize"; | ||
| import { ImageSize, suggestedSize as suggestedVideoSize } from "../../../settings/enums/ImageSize"; | ||
|
|
||
| interface IState { | ||
| decryptedUrl?: string; | ||
|
|
@@ -60,20 +60,14 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState> | |
| } | ||
|
|
||
| private get suggestedDimensions(): { w: number, h: number } { | ||
| switch (SettingsStore.getValue("Images.size") as ImageSize) { | ||
| case ImageSize.Large: | ||
| return { w: 480, h: 360 }; | ||
| case ImageSize.Normal: | ||
| default: | ||
| return { w: 324, h: 220 }; | ||
| } | ||
| return suggestedVideoSize(SettingsStore.getValue("Images.size") as ImageSize); | ||
| } | ||
|
|
||
| private thumbScale( | ||
| fullWidth: number, | ||
| fullHeight: number, | ||
| thumbWidth?, | ||
| thumbHeight?, | ||
| thumbWidth?: number, | ||
| thumbHeight?: number, | ||
| ) { | ||
|
||
| if (!thumbWidth || !thumbHeight) { | ||
| const dims = this.suggestedDimensions; | ||
|
|
@@ -91,14 +85,8 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState> | |
| return 1; | ||
| } | ||
| const widthMulti = thumbWidth / fullWidth; | ||
| const heightMulti = thumbHeight / fullHeight; | ||
| if (widthMulti < heightMulti) { | ||
| // width is the dominant dimension so scaling will be fixed on that | ||
| return widthMulti; | ||
| } else { | ||
| // height is the dominant dimension so scaling will be fixed on that | ||
| return heightMulti; | ||
| } | ||
| // always scale the videos based on their width. | ||
| return widthMulti; | ||
| } | ||
|
|
||
| private getContentUrl(): string|null { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.