Closed fschutt closed 6 years ago
I think your talking about that padding between the button's text widget and the button's rect widget? Currently there is no way to change this easily, it's hard coded in both ToggleButton and PushButton new
methods.
@bytebuddha Yes, but I copied those files, I have access to the ToggleButtonBuilder::new()
because I simply copied the source from limn/src/widgets/button.rs
. It doesn't work, even if I set the min_size()
to something else:
impl MyCustomToggleButtonBuilder {
pub fn new() -> Self {
let mut widget = WidgetBuilder::new("toggle_button");
widget
.set_draw_state_with_style(RectState::new(), STYLE_BUTTON.clone())
.add_handler_fn(button_handle_mouse_down)
.enable_hover()
.add_handler_fn(toggle_button_handle_mouse);
widget.layout().add(constraints![
min_size(Size::new(0.0, 0.0)), // <------ doesn't work!
shrink(),
]);
MyCustomToggleButtonBuilder { widget: widget }
}
}
Oh I'm sorry it appears i mispoke. As it turns out the text padding is set inset_text
when text is added. I think i was able to get to your desired effect by removing the min_size()
call in new
and by removing the padding()
calls in set_text
.
@bytebuddha Yes, thanks, that was it, thank you.
However, the font-size issue remains (i.e. if I set the font size to 8.0, I get a 4 pixel font, and so on). I'll open a seperate issue for that.
I tried making the button padding smaller, but there doesn't seem to be a way (for the default button). So I copied the code from the
button.rs
and tried removing the corners, which worked fine. But aRectStyle
does not have a padding field and I don't know how I should decrease the size of the button. Maybe it has to do with theline_height
on theTextStyle
? But there's no way to set the line height!I tried setting the strength of the padding to
STRONG
, didn't help either:No matter what I try, I can't decrease the (horizontal or vertical) padding of the button:
I want no padding between the text and the border of the surrounding button? Is this possible and if yes, how?
There is another bug, the font size seems to be cut in half: If I specify:
... I get a font that's 8 pixels tall, instead of 16 pixels.