fix: not switching on plate type
Gitea Scan/plate-tool/pipeline/head This commit looks good Details

me when i migrate correctly the first time and have no lingering bugs
This commit is contained in:
Emilia Allison 2024-02-13 22:06:55 -05:00
parent 72d81439c1
commit 6cfa686b55
Signed by: emilia
GPG Key ID: 05D5D1107E5100A1
2 changed files with 7 additions and 2 deletions

View File

@ -83,7 +83,7 @@ pub fn Plate(props: &PlateProps) -> Html {
let mouseup_callback = { let mouseup_callback = {
let m_start_handle = m_start_handle.clone(); let m_start_handle = m_start_handle.clone();
let m_end_handle = m_end_handle.clone(); let m_end_handle = m_end_handle.clone();
plate_callbacks::mouseup_callback(m_start_handle, m_end_handle, m_stat_handle, ct_dispatch) plate_callbacks::mouseup_callback(m_start_handle, m_end_handle, m_stat_handle, ct_dispatch, props.ptype)
}; };
let mouseleave_callback = Callback::clone(&mouseup_callback); let mouseleave_callback = Callback::clone(&mouseup_callback);

View File

@ -3,6 +3,7 @@ use yewdux::prelude::*;
use crate::components::states::CurrentTransfer; use crate::components::states::CurrentTransfer;
use plate_tool_lib::transfer_region::Region; use plate_tool_lib::transfer_region::Region;
use plate_tool_lib::plate::PlateType;
// Color Palette for the Source Plates, can be changed here // Color Palette for the Source Plates, can be changed here
@ -34,6 +35,7 @@ pub fn mouseup_callback(
m_end_handle: MEndHandle, m_end_handle: MEndHandle,
m_stat_handle: MStatHandle, m_stat_handle: MStatHandle,
ct_dispatch: Dispatch<CurrentTransfer>, ct_dispatch: Dispatch<CurrentTransfer>,
ptype: PlateType,
) -> Callback<MouseEvent> { ) -> Callback<MouseEvent> {
Callback::from(move |_: MouseEvent| { Callback::from(move |_: MouseEvent| {
m_stat_handle.set(false); m_stat_handle.set(false);
@ -41,7 +43,10 @@ pub fn mouseup_callback(
if let Some(br) = *m_end_handle { if let Some(br) = *m_end_handle {
if let Ok(rd) = RegionDisplay::try_from((ul.0, ul.1, br.0, br.1)) { if let Ok(rd) = RegionDisplay::try_from((ul.0, ul.1, br.0, br.1)) {
ct_dispatch.reduce_mut(|state| { ct_dispatch.reduce_mut(|state| {
state.transfer.transfer_region.source_region = Region::from(&rd); match ptype {
PlateType::Source => state.transfer.transfer_region.source_region = Region::from(&rd),
PlateType::Destination => state.transfer.transfer_region.dest_region = Region::from(&rd)
};
}); });
} }
} }