mirror of https://codeberg.org/topola/topola.git
overlay: toggle selection only if clicked inside the shape
This commit is contained in:
parent
4a9322d694
commit
87f5f4e8c0
|
|
@ -2,7 +2,7 @@
|
||||||
mod geometry;
|
mod geometry;
|
||||||
pub mod compound;
|
pub mod compound;
|
||||||
pub mod primitive;
|
pub mod primitive;
|
||||||
mod shape;
|
pub mod shape;
|
||||||
pub mod with_rtree;
|
pub mod with_rtree;
|
||||||
|
|
||||||
pub use geometry::*;
|
pub use geometry::*;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,12 @@ use geo::Point;
|
||||||
use rstar::AABB;
|
use rstar::AABB;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
drawing::{graph::PrimitiveIndex, rules::RulesTrait},
|
drawing::{
|
||||||
geometry::Node,
|
graph::{MakePrimitive, PrimitiveIndex},
|
||||||
|
primitive::MakeShape,
|
||||||
|
rules::RulesTrait,
|
||||||
|
},
|
||||||
|
geometry::{shape::ShapeTrait, Node},
|
||||||
graph::GenericIndex,
|
graph::GenericIndex,
|
||||||
layout::{zone::ZoneWeight, Layout},
|
layout::{zone::ZoneWeight, Layout},
|
||||||
};
|
};
|
||||||
|
|
@ -28,7 +32,18 @@ impl Overlay {
|
||||||
[at.x(), at.y(), f64::INFINITY],
|
[at.x(), at.y(), f64::INFINITY],
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
self.toggle_selection(geom.data);
|
match geom.data {
|
||||||
|
Node::Primitive(primitive) => {
|
||||||
|
if primitive
|
||||||
|
.primitive(layout.drawing())
|
||||||
|
.shape()
|
||||||
|
.contains_point(at)
|
||||||
|
{
|
||||||
|
self.toggle_selection(geom.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Node::Compound(compound) => (), // TODO.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue