This commit is contained in:
Emilia Allison 2023-06-08 11:14:50 -04:00
parent c8e51e2440
commit af5bbd466c
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
4 changed files with 10 additions and 6 deletions

View File

@ -12,7 +12,7 @@ use crate::data::transfer_region::Region;
use crate::components::plates::util::Palettes; use crate::components::plates::util::Palettes;
const PALETTE: super::util::ColorPalette = Palettes::RAINBOW; const PALETTE: super::util::ColorPalette = Palettes::RAINBOW;
use super::super::transfer_menu::{RegionDisplay, num_to_letters}; use super::super::transfer_menu::{num_to_letters, RegionDisplay};
#[derive(Properties, PartialEq)] #[derive(Properties, PartialEq)]
pub struct DestinationPlateProps { pub struct DestinationPlateProps {

View File

@ -12,7 +12,7 @@ use crate::data::transfer_region::Region;
use crate::components::plates::util::Palettes; use crate::components::plates::util::Palettes;
const PALETTE: super::util::ColorPalette = Palettes::RAINBOW; const PALETTE: super::util::ColorPalette = Palettes::RAINBOW;
use super::super::transfer_menu::{RegionDisplay, num_to_letters}; use super::super::transfer_menu::{num_to_letters, RegionDisplay};
#[derive(PartialEq, Properties)] #[derive(PartialEq, Properties)]
pub struct SourcePlateProps { pub struct SourcePlateProps {

View File

@ -26,7 +26,9 @@ impl ColorPalette {
pub fn get_u8(&self, t: u8, n: u8) -> [f64; 3] { pub fn get_u8(&self, t: u8, n: u8) -> [f64; 3] {
assert!(t > 0, "t must be greater than zero!"); assert!(t > 0, "t must be greater than zero!");
assert!(n > 0, "There cannot be zero points!"); assert!(n > 0, "There cannot be zero points!");
if n == 1 {return self.get(0.5f64)} if n == 1 {
return self.get(0.5f64);
}
self.get((t - 1) as f64 / (n - 1) as f64) self.get((t - 1) as f64 / (n - 1) as f64)
} }
} }

View File

@ -25,7 +25,9 @@ pub fn TransferMenu() -> Html {
let target: Option<EventTarget> = e.target(); let target: Option<EventTarget> = e.target();
let input = target.and_then(|t| t.dyn_into::<HtmlInputElement>().ok()); let input = target.and_then(|t| t.dyn_into::<HtmlInputElement>().ok());
if let Some(input) = input { if let Some(input) = input {
if input.value() == "" {return ()} // We do not want empty inputs! if input.value() == "" {
return ();
} // We do not want empty inputs!
ct_dispatch.reduce_mut(|state| { ct_dispatch.reduce_mut(|state| {
state.transfer.name = input.value().clone(); state.transfer.name = input.value().clone();
}); });