Add setMinSize() and setMaxSize() methods#39
Closed
zhuxiaojt wants to merge 2 commits into
Closed
Conversation
Member
|
@zhuxiaojt could you fix the merge conflict? |
Lawtro37
reviewed
Jun 19, 2026
Lawtro37
left a comment
Contributor
There was a problem hiding this comment.
If you change
dpi::{LogicalPosition, LogicalSize, PhysicalSize, Size},to
dpi::{LogicalPosition, PhysicalPosition, LogicalSize, PhysicalSize, Size},that should fix the merge conflict.
Contributor
Author
|
I noticed that these features have already been implemented in commit cf8cc47. Should I close this PR, or is there any further work needed on my side? Commit diff snippet for cf8cc47: + /// Set minimum inner size. Pass `null` / `undefined` for both to remove the
+ /// constraint.
+ #[napi]
+ pub fn set_min_size(&self, width: Option<f64>, height: Option<f64>) {
+ let size: Option<winit::dpi::Size> = match (width, height) {
+ (Some(w), Some(h)) => Some(LogicalSize::new(w, h).into()),
+ _ => None,
+ };
+ self.window.set_min_inner_size(size);
+ }
+
+ /// Set maximum inner size. Pass `null` / `undefined` for both to remove the
+ /// constraint.
+ #[napi]
+ pub fn set_max_size(&self, width: Option<f64>, height: Option<f64>) {
+ let size: Option<winit::dpi::Size> = match (width, height) {
+ (Some(w), Some(h)) => Some(LogicalSize::new(w, h).into()),
+ _ => None,
+ };
+ self.window.set_max_inner_size(size);
+ } |
Member
|
I think this can be closed |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@twlite
Adds
setMinSizeandsetMaxSizeAPIs to control window size constraints, aligned with thelogicalparameter pattern from #38. Pass(0, 0)to clear the constraint.