Format
This commit is contained in:
parent
3ed7c47c8a
commit
1880d0a270
2 changed files with 24 additions and 12 deletions
|
|
@ -482,7 +482,11 @@ impl App {
|
||||||
if let Some(items) = self.tab.items_opt() {
|
if let Some(items) = self.tab.items_opt() {
|
||||||
for item in items.iter() {
|
for item in items.iter() {
|
||||||
if item.location_opt.as_ref() == Some(location) {
|
if item.location_opt.as_ref() == Some(location) {
|
||||||
children.push(item.preview_view(None, self.tab.config.icon_sizes, military_time));
|
children.push(item.preview_view(
|
||||||
|
None,
|
||||||
|
self.tab.config.icon_sizes,
|
||||||
|
military_time,
|
||||||
|
));
|
||||||
// Only show one property view to avoid issues like hangs when generating
|
// Only show one property view to avoid issues like hangs when generating
|
||||||
// preview images on thousands of files
|
// preview images on thousands of files
|
||||||
break;
|
break;
|
||||||
|
|
@ -494,7 +498,11 @@ impl App {
|
||||||
if let Some(items) = self.tab.items_opt() {
|
if let Some(items) = self.tab.items_opt() {
|
||||||
for item in items.iter() {
|
for item in items.iter() {
|
||||||
if item.selected {
|
if item.selected {
|
||||||
children.push(item.preview_view(None, self.tab.config.icon_sizes, military_time));
|
children.push(item.preview_view(
|
||||||
|
None,
|
||||||
|
self.tab.config.icon_sizes,
|
||||||
|
military_time,
|
||||||
|
));
|
||||||
// Only show one property view to avoid issues like hangs when generating
|
// Only show one property view to avoid issues like hangs when generating
|
||||||
// preview images on thousands of files
|
// preview images on thousands of files
|
||||||
break;
|
break;
|
||||||
|
|
@ -502,7 +510,11 @@ impl App {
|
||||||
}
|
}
|
||||||
if children.is_empty() {
|
if children.is_empty() {
|
||||||
if let Some(item) = &self.tab.parent_item_opt {
|
if let Some(item) = &self.tab.parent_item_opt {
|
||||||
children.push(item.preview_view(None, self.tab.config.icon_sizes, military_time));
|
children.push(item.preview_view(
|
||||||
|
None,
|
||||||
|
self.tab.config.icon_sizes,
|
||||||
|
military_time,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
|
use crate::tab::DOUBLE_CLICK_DURATION;
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
iced_core::{
|
iced_core::{
|
||||||
border::Border,
|
border::Border,
|
||||||
|
|
@ -23,7 +24,6 @@ use cosmic::{
|
||||||
widget::Id,
|
widget::Id,
|
||||||
Element, Renderer, Theme,
|
Element, Renderer, Theme,
|
||||||
};
|
};
|
||||||
use crate::tab::DOUBLE_CLICK_DURATION;
|
|
||||||
|
|
||||||
/// Emit messages on mouse events.
|
/// Emit messages on mouse events.
|
||||||
#[allow(missing_debug_implementations)]
|
#[allow(missing_debug_implementations)]
|
||||||
|
|
@ -49,7 +49,7 @@ pub struct MouseArea<'a, Message> {
|
||||||
on_enter: Option<Box<dyn OnEnterExit<'a, Message>>>,
|
on_enter: Option<Box<dyn OnEnterExit<'a, Message>>>,
|
||||||
on_exit: Option<Box<dyn OnEnterExit<'a, Message>>>,
|
on_exit: Option<Box<dyn OnEnterExit<'a, Message>>>,
|
||||||
show_drag_rect: bool,
|
show_drag_rect: bool,
|
||||||
cursor_offset: Option<Point>
|
cursor_offset: Option<Point>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Message> MouseArea<'a, Message> {
|
impl<'a, Message> MouseArea<'a, Message> {
|
||||||
|
|
@ -300,7 +300,7 @@ impl<'a, Message> MouseArea<'a, Message> {
|
||||||
on_exit: None,
|
on_exit: None,
|
||||||
on_scroll: None,
|
on_scroll: None,
|
||||||
show_drag_rect: false,
|
show_drag_rect: false,
|
||||||
cursor_offset: None
|
cursor_offset: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -503,7 +503,7 @@ fn update<Message: Clone>(
|
||||||
cursor: mouse::Cursor,
|
cursor: mouse::Cursor,
|
||||||
shell: &mut Shell<'_, Message>,
|
shell: &mut Shell<'_, Message>,
|
||||||
state: &mut State,
|
state: &mut State,
|
||||||
viewport: &Rectangle
|
viewport: &Rectangle,
|
||||||
) -> event::Status {
|
) -> event::Status {
|
||||||
let layout_bounds = layout.bounds();
|
let layout_bounds = layout.bounds();
|
||||||
|
|
||||||
|
|
@ -524,13 +524,13 @@ fn update<Message: Clone>(
|
||||||
state.last_cursor_offset = Some(cursor_offset);
|
state.last_cursor_offset = Some(cursor_offset);
|
||||||
need_to_recalculate = true;
|
need_to_recalculate = true;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
// we've started moving out of bounds
|
// we've started moving out of bounds
|
||||||
(None, Some(cursor_offset)) => {
|
(None, Some(cursor_offset)) => {
|
||||||
state.last_cursor_offset = Some(cursor_offset);
|
state.last_cursor_offset = Some(cursor_offset);
|
||||||
need_to_recalculate = true;
|
need_to_recalculate = true;
|
||||||
},
|
}
|
||||||
|
|
||||||
// we've moved inbounds
|
// we've moved inbounds
|
||||||
(Some(_), None) => {
|
(Some(_), None) => {
|
||||||
|
|
@ -547,7 +547,7 @@ fn update<Message: Clone>(
|
||||||
if let Some(in_bounds_pos) = state.last_in_bounds_position {
|
if let Some(in_bounds_pos) = state.last_in_bounds_position {
|
||||||
let mut new_virtual_pos = Point {
|
let mut new_virtual_pos = Point {
|
||||||
x: in_bounds_pos.x + offset.x,
|
x: in_bounds_pos.x + offset.x,
|
||||||
y: in_bounds_pos.y + offset.y
|
y: in_bounds_pos.y + offset.y,
|
||||||
};
|
};
|
||||||
|
|
||||||
// clamp to the viewport
|
// clamp to the viewport
|
||||||
|
|
@ -559,7 +559,8 @@ fn update<Message: Clone>(
|
||||||
new_virtual_pos.x
|
new_virtual_pos.x
|
||||||
};
|
};
|
||||||
|
|
||||||
new_virtual_pos.y = if new_virtual_pos.y > (layout_bounds.height + layout_bounds.y) {
|
new_virtual_pos.y = if new_virtual_pos.y > (layout_bounds.height + layout_bounds.y)
|
||||||
|
{
|
||||||
layout_bounds.height + layout_bounds.y
|
layout_bounds.height + layout_bounds.y
|
||||||
} else if new_virtual_pos.y < 0.0 {
|
} else if new_virtual_pos.y < 0.0 {
|
||||||
0.0
|
0.0
|
||||||
|
|
@ -572,7 +573,6 @@ fn update<Message: Clone>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if let Event::Mouse(mouse::Event::CursorMoved { .. }) = event {
|
if let Event::Mouse(mouse::Event::CursorMoved { .. }) = event {
|
||||||
let position_in = cursor.position_in(layout_bounds);
|
let position_in = cursor.position_in(layout_bounds);
|
||||||
match (position_in, state.last_position) {
|
match (position_in, state.last_position) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue