-
I'm running into some weird behavior and I can't help but feel like I'm just doing things wrong. I want to have a egui left panel and then the main view of the app on the right. It's just a bunch of rectangles in 2d. The problem is integrating the panel with the world view, and getting the side panel to play nice with the world view. Rendering one rectangle at (pane_width, 0), the quick and dirty way I found to do it was to translate it to the right (by pane_width). This pane_width amount is in world coordinates, so I convert it to window coordinates by The rectangle shouldn't be rendering on the panel at all. Here's the code, it's essentially just the egui_glium example and the code to render a rectangle.. I guess the meat of the problem is at line 118. Any idea on how to fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The problem is that I want the panel to be exactly a certain width and it's bigger than that. Setting width to 225, using the mouse to check PhysicalSize and it reports that the panel has 360+ width. Is there extra width being added, or some confusion about what width is in the context of panel width? |
Beta Was this translation helpful? Give feedback.
-
The best way to figure out what part of the screen that egui isn't covering is to call The width you can set of a panel is the inner/content width, to which is added the frame. Not that egui uses logical "points" for all sizes and coordinates, so to get physical pixels you need to multiply with |
Beta Was this translation helpful? Give feedback.
The best way to figure out what part of the screen that egui isn't covering is to call
ctx.available_rect()
. If you want to render things only in this area you should set the viewport accordingly with whatever graphics API you are using.The width you can set of a panel is the inner/content width, to which is added the frame.
Not that egui uses logical "points" for all sizes and coordinates, so to get physical pixels you need to multiply with
pixels_per_point
.