1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Now in screen_rect min is the viewport position and max is the viewport size

This commit is contained in:
Konkitoman
2023-08-12 20:36:41 +03:00
parent 622814d8ed
commit 4bbdab1788
15 changed files with 48 additions and 28 deletions

View File

@@ -44,6 +44,8 @@ impl eframe::App for App {
"Current Parent Viewport Id: {}",
ctx.get_viewport_id()
));
ui.label(format!("Pos: {:?}", ctx.screen_rect().min));
ui.label(format!("Size: {:?}", ctx.screen_rect().max));
ui.label("Look at the \"Frame: \" will tell you, what viewport is rendering!");
{
let mut desktop = ctx.is_desktop();
@@ -70,6 +72,8 @@ impl eframe::App for App {
"Current Parent Viewport Id: {}",
ctx.get_viewport_id()
));
ui.label(format!("Pos: {:?}", ctx.screen_rect().min));
ui.label(format!("Size: {:?}", ctx.screen_rect().max));
ui.label(format!("Count: {state}"));
if ui.button("Add").clicked() {
*state += 1;
@@ -91,6 +95,8 @@ impl eframe::App for App {
"Current Parent Viewport Id: {}",
ctx.get_viewport_id()
));
ui.label(format!("Pos: {:?}", ctx.screen_rect().min));
ui.label(format!("Size: {:?}", ctx.screen_rect().max));
ui.label(format!("Count: {}", self.sync_viewport_state));
if ui.button("Add").clicked() {
self.sync_viewport_state += 1;
@@ -114,6 +120,8 @@ impl eframe::App for App {
"Current Parent Viewport Id: {}",
ctx.get_viewport_id()
));
ui.label(format!("Pos: {:?}", ctx.screen_rect().min));
ui.label(format!("Size: {:?}", ctx.screen_rect().max));
ui.label(format!("Count: {state}"));
if ui.button("Add").clicked() {
*state += 1;
@@ -127,8 +135,13 @@ impl eframe::App for App {
.default_embedded(false)
.show(ctx, |ui| {
ui.label(format!("Frame: {}", ui.ctx().frame_nr()));
ui.label(format!("Frame: {}", ctx.frame_nr()));
ui.label(format!("Current Viewport Id: {}", ctx.get_viewport_id()));
ui.label(format!(
"Current Parent Viewport Id: {}",
ctx.get_viewport_id()
));
ui.label(format!("Pos: {:?}", ctx.screen_rect().min));
ui.label(format!("Size: {:?}", ctx.screen_rect().max));
ui.label(format!("Count: {}", self.sync_window_state));
if ui.button("Add").clicked() {
self.sync_window_state += 1;