TUI rendering mostly working

This commit is contained in:
Evan Almloff committed 2023-02-01 14:36:56 -06:00
1 parent 39a3db68bd
commit 71a0bdf71d
8 files changed
+20 -44

No files matched your search

+2 -3
View File
@@ -246,8 +246,7 @@ impl FocusState {
if !node.get::<Focus>().unwrap().level.focusable() {
panic!()
}
let focused = node.get_mut::<Focused>().unwrap();
focused.0 = true;
node.insert(Focused(true));
if let Some(old) = self.last_focused_id.replace(id) {
let mut old = rdom.get_mut_raw(old).unwrap();
let focused = old.get_mut::<Focused>().unwrap();
@@ -304,7 +303,7 @@ impl FocusState {
node.get_mut::<Focused>().unwrap().0 = false;
}
let mut node = rdom.get_mut_raw(id).unwrap();
node.get_mut::<Focused>().unwrap().0 = true;
node.insert(Focused(true));
self.focus_level = node.get::<Focus>().unwrap().level;
// reset the position to the currently focused element
while self.focus_iter.next(rdom).id() != id {}
+2 -1
View File
@@ -688,7 +688,8 @@ impl RinkInputHandler {
for (event, datas) in hm {
for node in dom.get_listening_sorted(event) {
for data in &datas {
if node.get::<Focused>().unwrap().0 {
let focused = node.get::<Focused>();
if focused.is_some() && focused.unwrap().0 {
if let Some(id) = node.mounted_id() {
resolved_events.push(Event {
name: event,
-3
View File
@@ -91,9 +91,6 @@ impl Pass for TaffyLayout {
attribute, value, ..
} in attributes
{
assert!(SORTED_LAYOUT_ATTRS
.binary_search(&attribute.name.as_ref())
.is_ok());
if let Some(text) = value.as_text() {
apply_layout_attributes_cfg(
&attribute.name,
+2 -1
View File
@@ -272,7 +272,8 @@ impl RinkWidget for NodeRef<'_> {
if let Some(c) = self.get::<StyleModifier>().unwrap().core.bg {
new_cell.bg = c;
}
if self.get::<Focused>().unwrap().0 {
let focused = self.get::<Focused>();
if focused.is_some() && focused.unwrap().0 {
new_cell.bg.alpha = 100;
new_cell.bg.color = new_cell.bg.blend(Color::White);
}