add offset / scrolling + clipboard support
This commit is contained in:
@@ -131,7 +131,9 @@ impl<'a> PainterCtx<'a> {
|
||||
if active.region == region {
|
||||
return;
|
||||
} else if active.region.size() == region.size() {
|
||||
self.mov(id, region);
|
||||
// TODO: epsilon?
|
||||
let from = active.region;
|
||||
self.mov(id, from, region);
|
||||
return;
|
||||
}
|
||||
let active = self.remove(id).unwrap();
|
||||
@@ -185,22 +187,21 @@ impl<'a> PainterCtx<'a> {
|
||||
self.active.insert(id, instance);
|
||||
}
|
||||
|
||||
fn mov(&mut self, id: Id, to: UiRegion) {
|
||||
fn mov(&mut self, id: Id, from: UiRegion, to: UiRegion) {
|
||||
let active = self.active.get_mut(&id).unwrap();
|
||||
// children will not be changed, so this technically should not be needed
|
||||
// probably need unsafe
|
||||
let from = active.region;
|
||||
for h in &active.primitives {
|
||||
let region = self.layers[h.layer].primitives.region_mut(h);
|
||||
*region = region.outside(&from).within(&to);
|
||||
}
|
||||
active.region = to;
|
||||
active.region = active.region.outside(&from).within(&to);
|
||||
for m in self.modules.iter_mut() {
|
||||
m.on_move(active);
|
||||
}
|
||||
let children = active.children.clone();
|
||||
for child in children {
|
||||
self.mov(child, to);
|
||||
self.mov(child, from, to);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user