cycfi / elements

Elements C++ GUI library
http://cycfi.github.io/elements/
3.09k stars 238 forks source link

@klytje... Reopening, I think rounded_left is wrong: #402

Closed djowel closed 4 months ago

djowel commented 4 months ago
          @klytje... Reopening, I think rounded_left is wrong:
image

If you zoom in, the right-top and right-bottom corners are not sharp. It is fixed by using .corner_radius(10, 0, 0, 10)

Or is it intentional? Assuming the default radius when not specified? It does not seem right, no?

Originally posted by @djowel in https://github.com/cycfi/elements/issues/401#issuecomment-2124728198

djowel commented 4 months ago

Digging in, I see that this:

   template <typename Base, default_button_styler::direction Direction>
   inline float button_styler_rounded_half<Base, Direction>::get_corner_radius_top_right() const
   {
      if constexpr (Direction == direction_t::up || Direction == direction_t::right)
         return _radius;
      else
         return Base::get_corner_radius_top_right();
   }

is getting the default corner radius:

   inline float default_button_styler::get_corner_radius() const
   {
      return get_theme().button_corner_radius;
   }

Instead of just 0.0.

Is that intentional? What is the rationale for this behavior?

djowel commented 4 months ago

Ah I see that this:

   return Base::get_corner_radius_top_right();

Allows concatenation of stylers. Hmmm...

djowel commented 4 months ago

Fixed. The solution is to only call the Base if the base is non-default. Otherwise, return 0.0.