Skip to content

Commit

Permalink
use macros to generate DPI types
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Jul 7, 2023
1 parent b2b39d3 commit c6c494e
Show file tree
Hide file tree
Showing 4 changed files with 258 additions and 523 deletions.
14 changes: 7 additions & 7 deletions examples/min_max_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

use tao::{
dpi::LogicalUnit,
dpi::LogicalPixel,
event::{ElementState, Event, KeyEvent, WindowEvent},
event_loop::{ControlFlow, EventLoop},
keyboard::Key,
Expand Down Expand Up @@ -53,22 +53,22 @@ fn main() {
} => match key_str {
"e" => {
size_constraints.min_width =
(!size_constraints.min_width.is_some()).then_some(LogicalUnit::new(min_width).into());
(!size_constraints.min_width.is_some()).then_some(LogicalPixel::new(min_width).into());
window.set_inner_size_constraints(size_constraints);
}
"f" => {
size_constraints.max_width =
(!size_constraints.max_width.is_some()).then_some(LogicalUnit::new(max_width).into());
(!size_constraints.max_width.is_some()).then_some(LogicalPixel::new(max_width).into());
window.set_inner_size_constraints(size_constraints);
}
"p" => {
size_constraints.min_height =
(!size_constraints.min_height.is_some()).then_some(LogicalUnit::new(min_height).into());
size_constraints.min_height = (!size_constraints.min_height.is_some())
.then_some(LogicalPixel::new(min_height).into());
window.set_inner_size_constraints(size_constraints);
}
"v" => {
size_constraints.max_height =
(!size_constraints.max_height.is_some()).then_some(LogicalUnit::new(max_height).into());
size_constraints.max_height = (!size_constraints.max_height.is_some())
.then_some(LogicalPixel::new(max_height).into());
window.set_inner_size_constraints(size_constraints);
}
_ => {}
Expand Down
Loading

0 comments on commit c6c494e

Please sign in to comment.