Evil bug preventing volumes from adding
This commit is contained in:
parent
36d075b49a
commit
844bd14b4f
|
|
@ -178,42 +178,46 @@ fn calculate_shading_for_wells(
|
||||||
};
|
};
|
||||||
if let Some(wells) = cache_result {
|
if let Some(wells) = cache_result {
|
||||||
for well in wells.iter().filter(|x| x.row <= rows && x.col <= columns) {
|
for well in wells.iter().filter(|x| x.row <= rows && x.col <= columns) {
|
||||||
|
|
||||||
let volume = match &transfer.volume {
|
let volume = match &transfer.volume {
|
||||||
plate_tool_lib::transfer_volume::TransferVolume::Single(x) => *x,
|
plate_tool_lib::transfer_volume::TransferVolume::Single(x) => *x,
|
||||||
plate_tool_lib::transfer_volume::TransferVolume::WellMap(wm) => {
|
plate_tool_lib::transfer_volume::TransferVolume::WellMap(wm) => {
|
||||||
match plate_type {
|
match plate_type {
|
||||||
plate_tool_lib::plate::PlateType::Source => wm.source_only[well],
|
plate_tool_lib::plate::PlateType::Source => wm.source_only[well],
|
||||||
plate_tool_lib::plate::PlateType::Destination => wm.destination_only[well],
|
plate_tool_lib::plate::PlateType::Destination => {
|
||||||
|
wm.destination_only[well]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => 0.0,
|
_ => 0.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(Some(mut x)) = well_infos.get_mut(
|
if let Some(well_info_slot) = well_infos.get_mut(
|
||||||
(well.row - 1) as usize * columns as usize + (well.col - 1) as usize,
|
(well.row - 1) as usize * columns as usize + (well.col - 1) as usize,
|
||||||
) {
|
) {
|
||||||
// Well info already existed.
|
if let Some(ref mut x) = well_info_slot {
|
||||||
x.volume += volume;
|
// Well info already existed.
|
||||||
|
x.volume += volume;
|
||||||
|
|
||||||
x.color = if display_options.show_volume_heatmap {
|
x.color = if display_options.show_volume_heatmap {
|
||||||
PALETTE.get_linear(volume.into(), max_volume.into())
|
PALETTE.get_linear(x.volume.into(), max_volume.into())
|
||||||
|
} else {
|
||||||
|
PALETTE.get_ordered(transfer.id, ordered_ids)
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
PALETTE.get_ordered(transfer.id, ordered_ids)
|
// Well info does not already exist, we need to make it.
|
||||||
};
|
if let Some(mut wi) = well_infos.get_mut(
|
||||||
} else {
|
(well.row - 1) as usize * columns as usize
|
||||||
// Well info does not already exist, we need to make it.
|
+ (well.col - 1) as usize,
|
||||||
if let Some(mut wi) = well_infos.get_mut(
|
) {
|
||||||
(well.row - 1) as usize * columns as usize + (well.col - 1) as usize,
|
*wi = Some(WellInfo::new(
|
||||||
) {
|
volume,
|
||||||
*wi = Some(WellInfo::new(
|
if display_options.show_volume_heatmap {
|
||||||
volume,
|
PALETTE.get_linear(volume.into(), max_volume.into())
|
||||||
if display_options.show_volume_heatmap {
|
} else {
|
||||||
PALETTE.get_linear(volume.into(), max_volume.into())
|
PALETTE.get_ordered(transfer.id, ordered_ids)
|
||||||
} else {
|
},
|
||||||
PALETTE.get_ordered(transfer.id, ordered_ids)
|
));
|
||||||
},
|
}
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -363,17 +367,13 @@ fn add_plate_sub(
|
||||||
if let Some(mut well_info) =
|
if let Some(mut well_info) =
|
||||||
well_infos.get_mut((w.0 - 1) * columns as usize + (w.1 - 1))
|
well_infos.get_mut((w.0 - 1) * columns as usize + (w.1 - 1))
|
||||||
{
|
{
|
||||||
let volume = well_info.map(|x| x.volume).unwrap_or(0.0)
|
let volume = well_info.map(|x| x.volume).unwrap_or(0.0);
|
||||||
+ current_transfer_state
|
|
||||||
.and_then(|x| x.lock().ok())
|
|
||||||
.map(|x| x.volume)
|
|
||||||
.unwrap_or(0.0);
|
|
||||||
let color = well_info.map(|x| x.color).unwrap_or([255.0, 255.0, 255.0]);
|
let color = well_info.map(|x| x.color).unwrap_or([255.0, 255.0, 255.0]);
|
||||||
let fill = well_info.map(|x| x.color).is_some();
|
let fill = well_info.map(|x| x.color).is_some();
|
||||||
|
|
||||||
*well_info = Some(WellInfo {
|
*well_info = Some(WellInfo {
|
||||||
color,
|
color,
|
||||||
volume: 1.0,
|
volume: volume,
|
||||||
fill,
|
fill,
|
||||||
highlight: true,
|
highlight: true,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,7 @@ impl CurrentTransferStateInterior {
|
||||||
if let Some(transfer) = transfer {
|
if let Some(transfer) = transfer {
|
||||||
let volume: f32 = match transfer.volume {
|
let volume: f32 = match transfer.volume {
|
||||||
plate_tool_lib::transfer_volume::TransferVolume::Single(x) => x,
|
plate_tool_lib::transfer_volume::TransferVolume::Single(x) => x,
|
||||||
plate_tool_lib::transfer_volume::TransferVolume::WellMap(_) => {
|
plate_tool_lib::transfer_volume::TransferVolume::WellMap(_) => f32::NAN,
|
||||||
f32::NAN
|
|
||||||
}
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
return Some(Self {
|
return Some(Self {
|
||||||
|
|
@ -321,6 +319,13 @@ pub fn transfer_menu(
|
||||||
{
|
{
|
||||||
transfer.transfer_region = state.generate_transfer_region();
|
transfer.transfer_region = state.generate_transfer_region();
|
||||||
transfer.name = state.transfer_name.clone();
|
transfer.name = state.transfer_name.clone();
|
||||||
|
if matches!(
|
||||||
|
transfer.volume,
|
||||||
|
plate_tool_lib::transfer_volume::TransferVolume::Single(_)
|
||||||
|
) {
|
||||||
|
transfer.volume =
|
||||||
|
plate_tool_lib::transfer_volume::TransferVolume::Single(state.volume);
|
||||||
|
}
|
||||||
main_state.transfer_region_cache.invalidate(&transfer);
|
main_state.transfer_region_cache.invalidate(&transfer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue