summaryrefslogtreecommitdiffstats
path: root/lazy/src/responsive.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-02-22 14:10:49 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-02-23 21:31:54 +0700
commit1313c94e3bb206f064462bc521f78dbffc2a6cd6 (patch)
treea586436e4a1076543a3205ebc895a8463d9f7ffe /lazy/src/responsive.rs
parent9fe50801537e8fbfd2914f5139b5a609929e25db (diff)
downloadiced-1313c94e3bb206f064462bc521f78dbffc2a6cd6.tar.gz
iced-1313c94e3bb206f064462bc521f78dbffc2a6cd6.tar.bz2
iced-1313c94e3bb206f064462bc521f78dbffc2a6cd6.zip
Remove `hash_layout` method from `Widget` trait
Diffstat (limited to '')
-rw-r--r--lazy/src/responsive.rs45
1 files changed, 8 insertions, 37 deletions
diff --git a/lazy/src/responsive.rs b/lazy/src/responsive.rs
index d01cfd68..20a80dac 100644
--- a/lazy/src/responsive.rs
+++ b/lazy/src/responsive.rs
@@ -8,11 +8,10 @@ use iced_native::overlay;
use iced_native::renderer;
use iced_native::window;
use iced_native::{
- Clipboard, Element, Hasher, Length, Point, Rectangle, Shell, Size, Widget,
+ Clipboard, Element, Length, Point, Rectangle, Shell, Size, Widget,
};
use std::cell::RefCell;
-use std::hash::{Hash, Hasher as _};
use std::ops::Deref;
/// The state of a [`Responsive`] widget.
@@ -20,7 +19,6 @@ use std::ops::Deref;
pub struct State {
last_size: Option<Size>,
last_layout: layout::Node,
- last_layout_hash: u64,
}
impl State {
@@ -76,8 +74,6 @@ where
Length::Fill
}
- fn hash_layout(&self, _hasher: &mut Hasher) {}
-
fn layout(
&self,
_renderer: &Renderer,
@@ -270,26 +266,13 @@ where
let element =
view.take().unwrap()(state.last_size.unwrap_or(Size::ZERO));
- let new_layout_hash = {
- let mut hasher = Hasher::default();
- element.hash_layout(&mut hasher);
-
- hasher.finish()
- };
-
- if state.last_size != Some(state.last_layout.size())
- || new_layout_hash != state.last_layout_hash
- {
- state.last_layout = element.layout(
- renderer.deref(),
- &layout::Limits::new(
- Size::ZERO,
- state.last_size.unwrap_or(Size::ZERO),
- ),
- );
-
- state.last_layout_hash = new_layout_hash;
- }
+ state.last_layout = element.layout(
+ renderer.deref(),
+ &layout::Limits::new(
+ Size::ZERO,
+ state.last_size.unwrap_or(Size::ZERO),
+ ),
+ );
*self = Content::Ready(Some(
CacheBuilder {
@@ -400,18 +383,6 @@ where
.unwrap_or_default()
}
- fn hash_layout(&self, state: &mut Hasher, position: Point) {
- struct Marker;
- std::any::TypeId::of::<Marker>().hash(state);
-
- (position.x as u32).hash(state);
- (position.y as u32).hash(state);
-
- self.with_overlay_maybe(|overlay| {
- overlay.hash_layout(state);
- });
- }
-
fn on_event(
&mut self,
event: iced_native::Event,