Skip to content
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

refactor: createThumbnailFromPath takes size not maxSize #37362

Merged
merged 1 commit into from Mar 9, 2023

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Feb 21, 2023

Description of Change

Closes #37340.

The maxSize parameter has been changed to size to reflect that the size passed in will be the size the thumbnail created. Previously, Windows would not scale the image up if it were smaller than maxSize, and
macOS would always set the size to maxSize. Behavior is now the same across platforms.

Checklist

Release Notes

Notes: nativeImage.createThumbnailFromPath() now takes size instead of maxSize.

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/22-x-y PR should also be added to the "22-x-y" branch. target/23-x-y PR should also be added to the "23-x-y" branch. target/24-x-y PR should also be added to the "24-x-y" branch. labels Feb 21, 2023
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Feb 21, 2023
@codebytere codebytere marked this pull request as draft February 21, 2023 13:51
@codebytere codebytere changed the title fix: createThumbnailFromPath maximum size enforcement fix: createThumbnailFromPath should allow size smaller than maxSize Feb 21, 2023
@codebytere codebytere changed the title fix: createThumbnailFromPath should allow size smaller than maxSize fix: createThumbnailFromPath maxSize enforcement Feb 21, 2023
@codebytere codebytere marked this pull request as ready for review February 21, 2023 14:34
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Feb 22, 2023
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maxSize option doesn't make sense. We should replace it with size in a breaking change.

The native APIs for both Windows and macOS take a size param -- not maxSize.

More importantly, neither has API to tell us the preferred of a thumbnail so that we can clamp it. And it makes sense for that API to be missing, because what would the preferred size of a text file thumbnail even mean?

Life will be easier for both us and our users if our API exposes fields that map directly to native API.

History: maxSize was included in the feature rollout @ #24802

@codebytere codebytere changed the title fix: createThumbnailFromPath maxSize enforcement refactor: createThumbnailFromPath takes size not maxSize Mar 1, 2023
@codebytere codebytere requested a review from a team as a code owner March 1, 2023 11:21
@codebytere codebytere added semver/major incompatible API changes and removed target/22-x-y PR should also be added to the "22-x-y" branch. target/23-x-y PR should also be added to the "23-x-y" branch. semver/patch backwards-compatible bug fixes labels Mar 1, 2023
@codebytere
Copy link
Member Author

@ckerr updated to make this a breaking change!

@codebytere codebytere requested review from zcbenz and ckerr March 1, 2023 11:23
@codebytere codebytere changed the title refactor: createThumbnailFromPath takes size not maxSize refactor: createThumbnailFromPath takes size not maxSize Mar 1, 2023
Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@jkleinsc jkleinsc merged commit 8ee58e1 into main Mar 9, 2023
3 checks passed
@jkleinsc jkleinsc deleted the fix-thumbnail-max-size branch March 9, 2023 02:48
@release-clerk
Copy link

release-clerk bot commented Mar 9, 2023

Release Notes Persisted

nativeImage.createThumbnailFromPath() now takes size instead of maxSize.

@trop
Copy link
Contributor

trop bot commented Mar 9, 2023

I was unable to backport this PR to "24-x-y" cleanly;
you will need to perform this backport manually.

@trop trop bot added needs-manual-bp/24-x-y and removed target/24-x-y PR should also be added to the "24-x-y" branch. labels Mar 9, 2023
VerteDinde added a commit that referenced this pull request Apr 2, 2023
refactor: createThumbnailFromPath takes size not maxSize
@trop
Copy link
Contributor

trop bot commented Apr 2, 2023

@VerteDinde has manually backported this PR to "24-x-y", please check out #37796

@trop trop bot added in-flight/24-x-y merged/24-x-y PR was merged to the "24-x-y" branch and removed needs-manual-bp/24-x-y in-flight/24-x-y labels Apr 2, 2023
codebytere pushed a commit that referenced this pull request Apr 3, 2023
refactor: `createThumbnailFromPath` takes `size` not `maxSize` (#37362)

refactor: createThumbnailFromPath takes size not maxSize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/approved ✅ merged/24-x-y PR was merged to the "24-x-y" branch semver/major incompatible API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: getSize() is incorrect if the nativeImage is created by createThumbnailFromPath()
5 participants