diff --git a/src/contextual_menu.rs b/src/contextual_menu.rs index f85d471..2d29ff9 100644 --- a/src/contextual_menu.rs +++ b/src/contextual_menu.rs @@ -382,9 +382,10 @@ impl ContextualMenu { for (i, item) in self.items.iter().enumerate() { let y = menu_origin.y + self.get_item_offset_y(i); if item.action == MenuAction::Separator { - // Handle separators + // draw separators const SEPARATOR_HEIGHT: f32 = 1.; - draw_rectangle(menu_origin.x + ITEM_PADDING * 3., y + item_height * SEPARATOR_HEIGHT_RATIO / 2. - SEPARATOR_HEIGHT / 2. + ITEM_PADDING / 2., width - ITEM_PADDING * 6., SEPARATOR_HEIGHT, *SEPARATOR_COLOR, graphics); + const SEPARATOR_PADDING_X: f32 = ITEM_PADDING * 1.5; + draw_rectangle(menu_origin.x + SEPARATOR_PADDING_X, y + item_height * SEPARATOR_HEIGHT_RATIO / 2. - SEPARATOR_HEIGHT / 2. + ITEM_PADDING / 2., width - SEPARATOR_PADDING_X*2., SEPARATOR_HEIGHT, *SEPARATOR_COLOR, graphics); continue; } // draw highlight diff --git a/src/editor.rs b/src/editor.rs index 7c971f8..ec29bcf 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -833,7 +833,10 @@ impl Editor { path_items.push(MenuItem::new(&name, MenuAction::OpenWithInput(path))); } let path_submenu = ContextualMenu::new_with_items(self.system_font.clone(), self.event_sender.clone().unwrap(), path_items); - let mut menu_items = vec![MenuItem::new_with_submenu("Open ...", path_submenu), MenuItem::separator()]; + let mut menu_items = vec![ + MenuItem::new_with_submenu("Open ...", path_submenu), + MenuItem::separator() + ]; for (name, path) in self.get_recent_files() { menu_items.push(MenuItem::new(&name, MenuAction::Open(path))); } diff --git a/src/input.rs b/src/input.rs index f2ae99d..5f8e317 100644 --- a/src/input.rs +++ b/src/input.rs @@ -18,8 +18,8 @@ use crate::animation::EasingFunction; use crate::camera::Camera; use crate::render_helper::draw_rounded_rectangle_with_border; -pub const MIN_INPUT_WIDTH: f32 = 200.; -pub const MAX_INPUT_WIDTH: f32 = 500.; +pub const MIN_INPUT_WIDTH: f32 = 250.; +pub const MAX_INPUT_WIDTH: f32 = 600.; const ANIMATION_DURATION: f32 = 100.; @@ -122,12 +122,12 @@ impl Editable for Input { impl Input { pub fn new(menu_id: MenuId, action_fn: MenuActionFn, es: UserEventSender) -> Self { - let mut editor = Editor::new(MIN_INPUT_WIDTH, 50., Vector2::ZERO, 10.); // arbitrary + let mut editor = Editor::new(MIN_INPUT_WIDTH, 55., Vector2::ZERO, 15.); // arbitrary height editor.font.borrow_mut().change_font_size(-6); // Set font size to 10 - let offset = Vector2::new(0., (50. - editor.font.borrow().char_height) / 2. - 10.); + let offset = Vector2::new(0., (50. - editor.font.borrow().char_height) / 2. - 15.); editor.set_offset(offset); editor.set_event_sender(Some(es)); - editor.camera.safe_zone_size = 0.; + editor.camera.safe_zone_size = 30.; let blank_text_layout = editor.lines[0].formatted_text_block.clone(); Self { editor,