Fixed property typos, KeyCode typo. (#857)
* Fixed property typos, KeyCode typo. * cargo fmt
This commit is contained in:
		
							parent
							
								
									7628f4a64e
								
							
						
					
					
						commit
						7aac4223d0
					
				@ -171,7 +171,7 @@ pub enum KeyCode {
 | 
				
			|||||||
    NumpadAdd,
 | 
					    NumpadAdd,
 | 
				
			||||||
    Apostrophe,
 | 
					    Apostrophe,
 | 
				
			||||||
    Apps,
 | 
					    Apps,
 | 
				
			||||||
    Asterix,
 | 
					    Asterisk,
 | 
				
			||||||
    Plus,
 | 
					    Plus,
 | 
				
			||||||
    At,
 | 
					    At,
 | 
				
			||||||
    Ax,
 | 
					    Ax,
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@ use std::{any::TypeId, fmt};
 | 
				
			|||||||
pub struct PropertyTypeRegistry {
 | 
					pub struct PropertyTypeRegistry {
 | 
				
			||||||
    registrations: HashMap<String, PropertyTypeRegistration>,
 | 
					    registrations: HashMap<String, PropertyTypeRegistration>,
 | 
				
			||||||
    short_names: HashMap<String, String>,
 | 
					    short_names: HashMap<String, String>,
 | 
				
			||||||
    ambigous_names: HashSet<String>,
 | 
					    ambiguous_names: HashSet<String>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl PropertyTypeRegistry {
 | 
					impl PropertyTypeRegistry {
 | 
				
			||||||
@ -20,10 +20,11 @@ impl PropertyTypeRegistry {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    fn add_registration(&mut self, registration: PropertyTypeRegistration) {
 | 
					    fn add_registration(&mut self, registration: PropertyTypeRegistration) {
 | 
				
			||||||
        let short_name = registration.short_name.to_string();
 | 
					        let short_name = registration.short_name.to_string();
 | 
				
			||||||
        if self.short_names.contains_key(&short_name) || self.ambigous_names.contains(&short_name) {
 | 
					        if self.short_names.contains_key(&short_name) || self.ambiguous_names.contains(&short_name)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            // name is ambiguous. fall back to long names for all ambiguous types
 | 
					            // name is ambiguous. fall back to long names for all ambiguous types
 | 
				
			||||||
            self.short_names.remove(&short_name);
 | 
					            self.short_names.remove(&short_name);
 | 
				
			||||||
            self.ambigous_names.insert(short_name);
 | 
					            self.ambiguous_names.insert(short_name);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            self.short_names
 | 
					            self.short_names
 | 
				
			||||||
                .insert(short_name, registration.name.to_string());
 | 
					                .insert(short_name, registration.name.to_string());
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,7 @@ pub struct ComponentRegistry {
 | 
				
			|||||||
    pub registrations: HashMap<TypeId, ComponentRegistration>,
 | 
					    pub registrations: HashMap<TypeId, ComponentRegistration>,
 | 
				
			||||||
    pub short_names: HashMap<String, TypeId>,
 | 
					    pub short_names: HashMap<String, TypeId>,
 | 
				
			||||||
    pub full_names: HashMap<String, TypeId>,
 | 
					    pub full_names: HashMap<String, TypeId>,
 | 
				
			||||||
    pub ambigous_names: HashSet<String>,
 | 
					    pub ambiguous_names: HashSet<String>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl ComponentRegistry {
 | 
					impl ComponentRegistry {
 | 
				
			||||||
@ -35,10 +35,11 @@ impl ComponentRegistry {
 | 
				
			|||||||
        let short_name = registration.short_name.to_string();
 | 
					        let short_name = registration.short_name.to_string();
 | 
				
			||||||
        self.full_names
 | 
					        self.full_names
 | 
				
			||||||
            .insert(registration.long_name.to_string(), registration.ty);
 | 
					            .insert(registration.long_name.to_string(), registration.ty);
 | 
				
			||||||
        if self.short_names.contains_key(&short_name) || self.ambigous_names.contains(&short_name) {
 | 
					        if self.short_names.contains_key(&short_name) || self.ambiguous_names.contains(&short_name)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            // name is ambiguous. fall back to long names for all ambiguous types
 | 
					            // name is ambiguous. fall back to long names for all ambiguous types
 | 
				
			||||||
            self.short_names.remove(&short_name);
 | 
					            self.short_names.remove(&short_name);
 | 
				
			||||||
            self.ambigous_names.insert(short_name);
 | 
					            self.ambiguous_names.insert(short_name);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            self.short_names.insert(short_name, registration.ty);
 | 
					            self.short_names.insert(short_name, registration.ty);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -65,7 +66,7 @@ impl ComponentRegistry {
 | 
				
			|||||||
        let mut registration = self.get_with_short_name(type_name);
 | 
					        let mut registration = self.get_with_short_name(type_name);
 | 
				
			||||||
        if registration.is_none() {
 | 
					        if registration.is_none() {
 | 
				
			||||||
            registration = self.get_with_full_name(type_name);
 | 
					            registration = self.get_with_full_name(type_name);
 | 
				
			||||||
            if registration.is_none() && self.ambigous_names.contains(type_name) {
 | 
					            if registration.is_none() && self.ambiguous_names.contains(type_name) {
 | 
				
			||||||
                panic!("Type name is ambiguous: {}", type_name);
 | 
					                panic!("Type name is ambiguous: {}", type_name);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@ pub struct WgpuRenderer {
 | 
				
			|||||||
    pub queue: wgpu::Queue,
 | 
					    pub queue: wgpu::Queue,
 | 
				
			||||||
    pub window_resized_event_reader: EventReader<WindowResized>,
 | 
					    pub window_resized_event_reader: EventReader<WindowResized>,
 | 
				
			||||||
    pub window_created_event_reader: EventReader<WindowCreated>,
 | 
					    pub window_created_event_reader: EventReader<WindowCreated>,
 | 
				
			||||||
    pub intialized: bool,
 | 
					    pub initialized: bool,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl WgpuRenderer {
 | 
					impl WgpuRenderer {
 | 
				
			||||||
@ -59,7 +59,7 @@ impl WgpuRenderer {
 | 
				
			|||||||
            queue,
 | 
					            queue,
 | 
				
			||||||
            window_resized_event_reader: Default::default(),
 | 
					            window_resized_event_reader: Default::default(),
 | 
				
			||||||
            window_created_event_reader: Default::default(),
 | 
					            window_created_event_reader: Default::default(),
 | 
				
			||||||
            intialized: false,
 | 
					            initialized: false,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -152,7 +152,7 @@ pub fn convert_virtual_key_code(virtual_key_code: winit::event::VirtualKeyCode)
 | 
				
			|||||||
        winit::event::VirtualKeyCode::NumpadAdd => KeyCode::NumpadAdd,
 | 
					        winit::event::VirtualKeyCode::NumpadAdd => KeyCode::NumpadAdd,
 | 
				
			||||||
        winit::event::VirtualKeyCode::Apostrophe => KeyCode::Apostrophe,
 | 
					        winit::event::VirtualKeyCode::Apostrophe => KeyCode::Apostrophe,
 | 
				
			||||||
        winit::event::VirtualKeyCode::Apps => KeyCode::Apps,
 | 
					        winit::event::VirtualKeyCode::Apps => KeyCode::Apps,
 | 
				
			||||||
        winit::event::VirtualKeyCode::Asterisk => KeyCode::Asterix,
 | 
					        winit::event::VirtualKeyCode::Asterisk => KeyCode::Asterisk,
 | 
				
			||||||
        winit::event::VirtualKeyCode::Plus => KeyCode::Plus,
 | 
					        winit::event::VirtualKeyCode::Plus => KeyCode::Plus,
 | 
				
			||||||
        winit::event::VirtualKeyCode::At => KeyCode::At,
 | 
					        winit::event::VirtualKeyCode::At => KeyCode::At,
 | 
				
			||||||
        winit::event::VirtualKeyCode::Ax => KeyCode::Ax,
 | 
					        winit::event::VirtualKeyCode::Ax => KeyCode::Ax,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user