Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions ecs/src/implementations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ impl Node for Entity {
ChildIterator { tree, current_node }
}

fn parent<'t>(&'t self, tree: &'t Tree) -> Option<&'t Self> {
tree.get_parent(self)
}

fn visible(&self, store: &Store) -> bool {
store.visible.get(*self).copied().unwrap_or(true)
}
Expand Down Expand Up @@ -105,14 +109,6 @@ impl Node for Entity {
store.horizontal_gap.get(*self).copied()
}

fn vertical_scroll(&self, store: &Store) -> Option<f32> {
store.vertical_scroll.get(*self).copied()
}

fn horizontal_scroll(&self, store: &Store) -> Option<f32> {
store.horizontal_scroll.get(*self).copied()
}

fn min_width(&self, store: &Store) -> Option<Units> {
store.min_width.get(*self).copied()
}
Expand All @@ -129,22 +125,6 @@ impl Node for Entity {
store.max_height.get(*self).copied()
}

fn border_left(&self, store: &Store) -> Option<Units> {
store.border_left.get(*self).copied()
}

fn border_right(&self, store: &Store) -> Option<Units> {
store.border_right.get(*self).copied()
}

fn border_top(&self, store: &Store) -> Option<Units> {
store.border_top.get(*self).copied()
}

fn border_bottom(&self, store: &Store) -> Option<Units> {
store.border_bottom.get(*self).copied()
}

fn min_horizontal_gap(&self, store: &Store) -> Option<Units> {
store.min_horizontal_gap.get(*self).copied()
}
Expand Down
20 changes: 0 additions & 20 deletions ecs/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ pub struct Store {
pub column_span: SecondaryMap<Entity, usize>,
pub row_span: SecondaryMap<Entity, usize>,

pub vertical_scroll: SecondaryMap<Entity, f32>,
pub horizontal_scroll: SecondaryMap<Entity, f32>,

pub left: SecondaryMap<Entity, Units>,
pub right: SecondaryMap<Entity, Units>,
pub top: SecondaryMap<Entity, Units>,
Expand Down Expand Up @@ -62,11 +59,6 @@ pub struct Store {
pub red: SecondaryMap<Entity, u8>,
pub green: SecondaryMap<Entity, u8>,
pub blue: SecondaryMap<Entity, u8>,

pub border_left: SecondaryMap<Entity, Units>,
pub border_right: SecondaryMap<Entity, Units>,
pub border_top: SecondaryMap<Entity, Units>,
pub border_bottom: SecondaryMap<Entity, Units>,
}

impl Store {
Expand All @@ -80,8 +72,6 @@ impl Store {
self.right.remove(entity);
self.top.remove(entity);
self.bottom.remove(entity);
self.vertical_scroll.remove(entity);
self.horizontal_scroll.remove(entity);
self.width.remove(entity);
self.height.remove(entity);
self.min_width.remove(entity);
Expand All @@ -104,10 +94,6 @@ impl Store {
self.red.remove(entity);
self.green.remove(entity);
self.blue.remove(entity);
self.border_left.remove(entity);
self.border_right.remove(entity);
self.border_top.remove(entity);
self.border_bottom.remove(entity);
}

pub fn clear(&mut self) {
Expand All @@ -120,8 +106,6 @@ impl Store {
self.right.clear();
self.top.clear();
self.bottom.clear();
self.vertical_scroll.clear();
self.horizontal_scroll.clear();
self.width.clear();
self.height.clear();
self.min_width.clear();
Expand All @@ -144,9 +128,5 @@ impl Store {
self.red.clear();
self.green.clear();
self.blue.clear();
self.border_left.clear();
self.border_right.clear();
self.border_top.clear();
self.border_bottom.clear();
}
}
17 changes: 0 additions & 17 deletions ecs/src/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,6 @@ impl World {
self.store.max_horizontal_gap.insert(entity, value);
}

/// Set the desired vertical scroll offset.
pub fn set_vertical_scroll(&mut self, entity: Entity, value: f32) {
self.store.vertical_scroll.insert(entity, value);
}

/// Set the desired horizontal scroll offset.
pub fn set_horizontal_scroll(&mut self, entity: Entity, value: f32) {
self.store.horizontal_scroll.insert(entity, value);
}

pub fn set_grid_columns(&mut self, entity: Entity, value: Vec<Units>) {
self.store.grid_columns.insert(entity, value);
}
Expand Down Expand Up @@ -255,11 +245,4 @@ impl World {
self.set_width(entity, Units::Stretch(1.0));
self.set_height(entity, Units::Stretch(1.0));
}

pub fn set_border(&mut self, entity: Entity, width: Units) {
self.store.border_left.insert(entity, width);
self.store.border_right.insert(entity, width);
self.store.border_top.insert(entity, width);
self.store.border_bottom.insert(entity, width);
}
}
30 changes: 4 additions & 26 deletions examples/advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ pub struct Widget {
min_horizontal_gap: Units,
max_vertical_gap: Units,
max_horizontal_gap: Units,
vertical_scroll: f32,
horizontal_scroll: f32,
alignment: Alignment,
layout_type: LayoutType,
position_type: PositionType,
Expand Down Expand Up @@ -79,6 +77,10 @@ impl Node for Widget {
self.child.iter()
}

fn parent<'t>(&'t self, _tree: &'t Self::Tree) -> Option<&'t Self> {
None
}
Comment on lines +80 to +82

fn key(&self) -> Self::CacheKey {
self.id
}
Expand Down Expand Up @@ -169,34 +171,10 @@ impl Node for Widget {
Some(self.horizontal_gap)
}

fn border_left(&self, _store: &Self::Store) -> Option<Units> {
Some(Units::Pixels(0.0))
}

fn border_right(&self, _store: &Self::Store) -> Option<Units> {
Some(Units::Pixels(0.0))
}

fn border_top(&self, _store: &Self::Store) -> Option<Units> {
Some(Units::Pixels(0.0))
}

fn border_bottom(&self, _store: &Self::Store) -> Option<Units> {
Some(Units::Pixels(0.0))
}

fn alignment(&self, _store: &Self::Store) -> Option<Alignment> {
Some(self.alignment)
}

fn vertical_scroll(&self, _store: &Self::Store) -> Option<f32> {
Some(self.vertical_scroll)
}

fn horizontal_scroll(&self, _store: &Self::Store) -> Option<f32> {
Some(self.horizontal_scroll)
}

fn min_vertical_gap(&self, _store: &Self::Store) -> Option<Units> {
Some(self.min_vertical_gap)
}
Expand Down
Loading
Loading