positioning: Calculate sizes instead of storing, move position out of widgets
Sizes of widgets can be derived, so storing them was only for C compatibility. Similar with storing position inside of widgets. Some layout margin and scaling changes could be introduced, meaning a possibility of visual differences.
This commit is contained in:
12
src/util.rs
12
src/util.rs
@ -2,6 +2,8 @@
|
||||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
|
||||
use ::float_ord::FloatOrd;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::hash::{ Hash, Hasher };
|
||||
use std::iter::FromIterator;
|
||||
@ -142,6 +144,16 @@ pub fn hash_map_map<K, V, F, K1, V1>(map: HashMap<K, V>, mut f: F)
|
||||
)
|
||||
}
|
||||
|
||||
pub fn find_max_double<T, I, F>(iterator: I, get: F)
|
||||
-> f64
|
||||
where I: Iterator<Item=T>,
|
||||
F: Fn(&T) -> f64
|
||||
{
|
||||
iterator.map(|value| FloatOrd(get(&value)))
|
||||
.max().unwrap_or(FloatOrd(0f64))
|
||||
.0
|
||||
}
|
||||
|
||||
/// Compares pointers but not internal values of Rc
|
||||
pub struct Pointer<T>(pub Rc<T>);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user