emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
21.66k stars 1.56k forks source link

Make Strip waste less waste by being smarter about remainder with at_most #4870

Open e00E opened 1 month ago

e00E commented 1 month ago

Consider a Strip defined with the following sizes:

  1. Size::remainder().at_most(100)
  2. Size::remainder()

Let's say the available size is 1000. In this case Strip will end up assigning space like this:

  1. 100
  2. 500

This leaves 400 wasted space. Strip takes up the extra 400 but it is not assigned to any cell. Instead I would like Strip to assign space like this:

  1. 100
  2. 900

This leaves 0 wasted space.

More generally, I would like the remainder calculation to take the upper limits into account and distribute the gained space to the other remainders.

I've looked at the implementation of Strip. I can make this change if you (maintainer) tell me you want it.

emilk commented 2 weeks ago

Sounds good!