Skip to content

Commit

Permalink
Remove unused properties from Node
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Burns <[email protected]>
  • Loading branch information
nicoburns committed Jan 20, 2025
1 parent 1579b0e commit 1893dc8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
11 changes: 1 addition & 10 deletions packages/blitz-dom/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use taffy::{
use url::Url;

use crate::layout::table::TableContext;
use blitz_traits::{BlitzMouseButtonEvent, DomEventData, EventListener, HitResult};
use blitz_traits::{BlitzMouseButtonEvent, DomEventData, HitResult};

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DisplayOuter {
Expand Down Expand Up @@ -78,15 +78,12 @@ pub struct Node {

// Taffy layout data:
pub style: Style,
pub hidden: bool,
pub is_hovered: bool,
pub has_snapshot: bool,
pub snapshot_handled: AtomicBool,
pub display_outer: DisplayOuter,
pub cache: Cache,
pub unrounded_layout: Layout,
pub final_layout: Layout,
pub listeners: Vec<EventListener>,
pub scroll_offset: kurbo::Point,

// Flags
Expand Down Expand Up @@ -121,15 +118,12 @@ impl Node {
after: None,

style: Default::default(),
hidden: false,
is_hovered: false,
has_snapshot: false,
snapshot_handled: AtomicBool::new(false),
display_outer: DisplayOuter::Block,
cache: Cache::new(),
unrounded_layout: Layout::new(),
final_layout: Layout::new(),
listeners: Default::default(),
scroll_offset: kurbo::Point::ZERO,
is_inline_root: false,
is_table_root: false,
Expand Down Expand Up @@ -204,13 +198,11 @@ impl Node {
}

pub fn hover(&mut self) {
self.is_hovered = true;
self.element_state.insert(ElementState::HOVER);
self.set_restyle_hint(RestyleHint::restyle_subtree());
}

pub fn unhover(&mut self) {
self.is_hovered = false;
self.element_state.remove(ElementState::HOVER);
self.set_restyle_hint(RestyleHint::restyle_subtree());
}
Expand Down Expand Up @@ -401,7 +393,6 @@ impl ElementNodeData {
node_specific_data: NodeSpecificData::None,
template_contents: None,
background_images: Vec::new(),
// listeners: FxHashSet::default(),
};
data.flush_is_focussable();
data
Expand Down
3 changes: 0 additions & 3 deletions packages/blitz-traits/src/events.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use bitflags::bitflags;
use keyboard_types::{Code, Key, Location, Modifiers};
use smol_str::SmolStr;
pub struct EventListener {
pub name: String,
}

#[derive(Debug, Clone)]
pub struct DomEvent {
Expand Down
4 changes: 2 additions & 2 deletions packages/blitz-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pub mod navigation;

mod events;
pub use events::{
BlitzImeEvent, BlitzKeyEvent, BlitzMouseButtonEvent, DomEvent, DomEventData, EventListener,
HitResult, KeyState, MouseEventButton, MouseEventButtons,
BlitzImeEvent, BlitzKeyEvent, BlitzMouseButtonEvent, DomEvent, DomEventData, HitResult,
KeyState, MouseEventButton, MouseEventButtons,
};

mod document;
Expand Down

0 comments on commit 1893dc8

Please sign in to comment.