fix: some minor alpha rendering issues
This commit is contained in:
parent
cbcf8cc2dd
commit
486c6ba95e
3 changed files with 18 additions and 9 deletions
|
@ -22,9 +22,14 @@ pub fn Options(context: type) type {
|
||||||
pub fn do_nothing(_: context, _: *State(Context)) void {}
|
pub fn do_nothing(_: context, _: *State(Context)) void {}
|
||||||
|
|
||||||
pub fn on_render_default(_: context, self: *State(Context), theme: *const Widget.Theme) bool {
|
pub fn on_render_default(_: context, self: *State(Context), theme: *const Widget.Theme) bool {
|
||||||
self.plane.set_base_style(if (self.text.items.len > 0) theme.input else theme.input_placeholder);
|
const style_base = theme.editor_widget;
|
||||||
|
const style_label = if (self.text.items.len > 0) theme.input else theme.input_placeholder;
|
||||||
|
self.plane.set_base_style(style_base);
|
||||||
self.plane.erase();
|
self.plane.erase();
|
||||||
self.plane.home();
|
self.plane.home();
|
||||||
|
self.plane.set_style(style_label);
|
||||||
|
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||||
|
self.plane.home();
|
||||||
if (self.text.items.len > 0) {
|
if (self.text.items.len > 0) {
|
||||||
_ = self.plane.print(" {s} ", .{self.text.items}) catch {};
|
_ = self.plane.print(" {s} ", .{self.text.items}) catch {};
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -26,10 +26,16 @@ pub fn Options(context: type) type {
|
||||||
pub fn do_nothing_click(_: **State(Context), _: *Button.State(*State(Context))) void {}
|
pub fn do_nothing_click(_: **State(Context), _: *Button.State(*State(Context))) void {}
|
||||||
|
|
||||||
pub fn on_render_default(_: context, button: *Button.State(*State(Context)), theme: *const Widget.Theme, selected: bool) bool {
|
pub fn on_render_default(_: context, button: *Button.State(*State(Context)), theme: *const Widget.Theme, selected: bool) bool {
|
||||||
const style_base = if (button.active) theme.editor_cursor else if (button.hover or selected) theme.editor_selection else theme.editor;
|
const style_base = theme.editor;
|
||||||
|
const style_label = if (button.active) theme.editor_cursor else if (button.hover or selected) theme.editor_selection else style_base;
|
||||||
button.plane.set_base_style(style_base);
|
button.plane.set_base_style(style_base);
|
||||||
button.plane.erase();
|
button.plane.erase();
|
||||||
button.plane.home();
|
button.plane.home();
|
||||||
|
if (button.active or button.hover or selected) {
|
||||||
|
button.plane.set_style(style_label);
|
||||||
|
_ = button.plane.fill_width(" ", .{}) catch {};
|
||||||
|
button.plane.home();
|
||||||
|
}
|
||||||
_ = button.plane.print(" {s} ", .{button.opts.label}) catch {};
|
_ = button.plane.print(" {s} ", .{button.opts.label}) catch {};
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,17 +41,15 @@ fn is_overlay_mode() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(_: *void, self: *Button.State(void), theme: *const Widget.Theme) bool {
|
pub fn render(_: *void, self: *Button.State(void), theme: *const Widget.Theme) bool {
|
||||||
const style_base = theme.statusbar_hover;
|
const style_base = theme.statusbar;
|
||||||
const style_label = if (self.active) theme.editor_cursor else if (self.hover) theme.editor_selection else style_base;
|
const style_label = if (self.active) theme.editor_cursor else if (self.hover) theme.editor_selection else theme.statusbar_hover;
|
||||||
self.plane.set_base_style(style_base);
|
self.plane.set_base_style(style_base);
|
||||||
self.plane.on_styles(style.bold);
|
|
||||||
self.plane.erase();
|
self.plane.erase();
|
||||||
self.plane.home();
|
self.plane.home();
|
||||||
self.plane.set_style(style_label);
|
self.plane.set_style(style_label);
|
||||||
if (self.active or self.hover) {
|
_ = self.plane.fill_width(" ", .{}) catch {};
|
||||||
_ = self.plane.fill_width(" ", .{}) catch {};
|
self.plane.home();
|
||||||
self.plane.home();
|
self.plane.on_styles(style.bold);
|
||||||
}
|
|
||||||
var buf: [31:0]u8 = undefined;
|
var buf: [31:0]u8 = undefined;
|
||||||
if (!is_mini_mode() and !is_overlay_mode()) {
|
if (!is_mini_mode() and !is_overlay_mode()) {
|
||||||
render_logo(self, theme, style_label);
|
render_logo(self, theme, style_label);
|
||||||
|
|
Loading…
Add table
Reference in a new issue