actually sane sensor handling
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
ActiveSensor, ActiveSensors, SenseTrigger, SensorMap, UiRegion, WidgetId, Widgets,
|
||||
ActiveSensors, SensorMap, UiRegion, WidgetId, Widgets,
|
||||
primitive::{PrimitiveData, PrimitiveInstance, Primitives},
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ pub struct Painter<'a, Ctx: 'static> {
|
||||
nodes: &'a Widgets<Ctx>,
|
||||
ctx: &'a mut Ctx,
|
||||
sensors_map: &'a mut SensorMap<Ctx>,
|
||||
active_sensors: &'a mut ActiveSensors<Ctx>,
|
||||
active_sensors: &'a mut ActiveSensors,
|
||||
primitives: Primitives,
|
||||
pub region: UiRegion,
|
||||
}
|
||||
@@ -17,7 +17,7 @@ impl<'a, Ctx> Painter<'a, Ctx> {
|
||||
nodes: &'a Widgets<Ctx>,
|
||||
ctx: &'a mut Ctx,
|
||||
sensors_map: &'a mut SensorMap<Ctx>,
|
||||
active_sensors: &'a mut ActiveSensors<Ctx>,
|
||||
active_sensors: &'a mut ActiveSensors,
|
||||
) -> Self {
|
||||
Self {
|
||||
nodes,
|
||||
@@ -44,19 +44,8 @@ impl<'a, Ctx> Painter<'a, Ctx> {
|
||||
where
|
||||
Ctx: 'static,
|
||||
{
|
||||
if let Some(sensors) = self.sensors_map.get(&id.id) {
|
||||
self.active_sensors.push(
|
||||
sensors
|
||||
.iter()
|
||||
.map(|sensor| ActiveSensor {
|
||||
trigger: SenseTrigger {
|
||||
shape: self.region,
|
||||
sense: sensor.sense,
|
||||
},
|
||||
f: sensor.f.box_clone(),
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
if self.sensors_map.get(&id.id).is_some() {
|
||||
self.active_sensors.push((self.region, id.id.duplicate()));
|
||||
}
|
||||
self.nodes.get_dyn(id).draw(self);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user