A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.
Rust archive-managerdesktop-appdual-paneexplorer-alternativefile-browserfile-explorerfile-managerfluent-designgpu-acceleratedgpuimacosmicaproductivityquick-lookrustrust-guitabswindowswindows-11windows-explorer
Refine vertical dock control hit areas and align tooltips inward
Atharv Tamboli34567ca9bd92
diff --cc crates/rf-app/src/dock/left.rsindex c08ed32d,4b7f50c3..b4e279f8--- a/crates/rf-app/src/dock/left.rs+++ b/crates/rf-app/src/dock/left.rs@@@ -184,14 -184,14 +184,21 @@@ impl LeftIslandlet k = super::host::size_on(self.mon, cx);let [ml, mt, ..] = super::host::insets_on(self.mon, Kind::Left, cx).margins;let point = ((f32::from(at.x) - ml) / k, (f32::from(at.y) - mt) / k);-- let controls = if self.mon.is_home() {++ let vertical = super::host::vertical(cx);++ let point = if vertical { (point.1, point.0) } else { point };++ let controls = if vertical {++ let mut c = super::empty::left_controls_secondary(Search::Button);++ let start = self.wanted_length(cx) - plan::SIDE_PAD - pins_extra(self.pins_n) + PIN_START_GAP;++ c.extend((0..self.pins_n).map(|i| [start + i as f32 * (PIN + PIN_GAP), (rf_win::dock::layout::SIDE_HEIGHT - PIN) / 2.0, PIN, PIN]));++ c++ } else if self.mon.is_home() {let mut c = super::empty::left_controls();c.extend(self.pin_boxes());c} else {super::empty::left_controls_secondary(self.search)};-- if super::empty::side_is_empty(self.width(), super::host::side_height_on(self.mon, cx), &controls, point) {++ if super::empty::side_is_empty(self.wanted_length(cx), super::host::side_height_on(self.mon, cx), &controls, point) {let Some((x, _)) = rf_win::dock::panel::cursor() else { return };super::island_menu::open(super::island_menu::MenuRequest {diff --cc crates/rf-app/src/dock/right.rsindex 935ff3ce,07872d93..bc23bd2b--- a/crates/rf-app/src/dock/right.rs+++ b/crates/rf-app/src/dock/right.rs@@@ -326,11 -324,6 +326,11 @@@ impl RightIsland/// The width the content needs now (logical px). The primary monitor's: the symbols, the clock and the bell, and the tray strip's/// room; a secondary monitor's: the clock and, when there is room, the bell.fn wanted_width(&self, cx: &App) -> f32 {+ if super::host::vertical(cx) {+ let buttons = self.status_buttons(cx).len();- let status = if buttons == 0 { 0.0 } else { buttons as f32 * (plan::BUTTON + plan::RIGHT_GAP) + 2.0 * plan::RIGHT_SEP_GAP };++ let status = plan::status_block(buttons);+ return 2.0 * plan::SIDE_PAD + status + plan::CLOCK_H + self.tray_extra + if self.content.bell { plan::RIGHT_GAP + plan::BUTTON } else { 0.0 } + if self.mon.is_home() && show_desktop_on(cx) { plan::SHOW_DESKTOP_EXTRA } else { 0.0 };+ }if self.mon.is_home() {plan::right_width_for(&self.lines, self.status_buttons(cx).len()) + self.tray_extra + if show_desktop_on(cx) { plan::SHOW_DESKTOP_EXTRA } else { 0.0 }} else {@@@ -401,6 -394,6 +401,7 @@@let k = super::host::size_on(self.mon, cx);let [ml, mt, ..] = super::host::insets_on(self.mon, Kind::Right, cx).margins;let point = ((f32::from(at.x) - ml) / k, (f32::from(at.y) - mt) / k);++ let point = if super::host::vertical(cx) { (point.1, point.0) } else { point };let (width, height) = (self.wanted_width(cx), super::host::side_height_on(self.mon, cx));let controls = self.controls(cx);if super::empty::side_is_empty(width, height, &controls, point) {@@@ -425,8 -418,8 +426,9 @@@/// The boxes of the island's controls, dock units from its glass's top left corner (`empty.rs`).fn controls(&self, cx: &App) -> Vec<[f32; 4]> {++ let clock_width = if super::host::vertical(cx) { plan::CLOCK_H } else { plan::clock_width(&self.lines) };if self.mon.is_home() {-- let mut c = super::empty::right_controls(plan::clock_width(&self.lines), super::tray_strip::shape(cx), self.tray_extra, self.status_buttons(cx).len());++ let mut c = super::empty::right_controls(clock_width, super::tray_strip::shape(cx), self.tray_extra, self.status_buttons(cx).len());// the "Show desktop" strip after the bell (the last box), the island's full heightif show_desktop_on(cx)&& let Some(bell) = c.last().copied()@@@ -435,7 -428,7 +437,7 @@@}c} else {-- super::empty::right_controls_secondary(plan::clock_width(&self.lines), self.content.bell)++ super::empty::right_controls_secondary(clock_width, self.content.bell)}}@@@ -462,9 -455,9 +464,9 @@@/// Where one of the island's own controls is on the screen (device px), with its tip's text.fn own_anchor(&self, which: OwnTip, cx: &App) -> Option<super::tray_tip::Anchor> {- let glass = super::host::current_glass_rect_on(self.mon, Kind::Right, cx)?;+ let glass = rf_win::dock::layout::edge_axes(super::host::current_glass_rect_on(self.mon, Kind::Right, cx)?, super::host::dock_edge(cx));let unit = rf_win::dock::size::unit(super::host::home_work(cx)?.0, super::look::dock_size(cx));-- let clock_w = plan::clock_width(&self.lines);++ let clock_w = if super::host::vertical(cx) { plan::CLOCK_H } else { plan::clock_width(&self.lines) };let (controls, first_button) = if self.mon.is_home() {let shape = super::tray_strip::shape(cx);let cells = shape.map_or(0, |s| s.visible + usize::from(s.chevron));@@@ -499,7 -492,7 +501,10 @@@_ => return None,};let d = |v: f32| rf_win::dock::layout::px(v, unit);-- let rect = rf_win::dock::layout::Rect::from_xywh(glass.left + d(b[0]), glass.top + d(b[1]), d(b[2]), d(b[3]));++ let edge = super::host::dock_edge(cx);++ let logical = rf_win::dock::layout::edge_axes(glass, edge);++ let down = (super::host::side_height_on(self.mon, cx) - rf_win::dock::layout::SIDE_HEIGHT) / 2.0;++ let rect = rf_win::dock::layout::edge_axes(rf_win::dock::layout::Rect::from_xywh(logical.left + d(b[0]), logical.top + d(b[1] + if super::host::vertical(cx) { down } else { 0.0 }), d(b[2]), d(b[3])), edge);Some(super::tray_tip::Anchor { key: which.key(), text, rect, clear_top: glass.top.min(rect.top) })}@@@ -778,11 -771,11 +783,11 @@@ impl Render for RightIslandlet clock = v_flex().id("dock-clock")// (the gap after the separator that follows the buttons; without buttons there is no separator)- .ml(px(if buttons.is_empty() { 0.0 } else { plan::RIGHT_SEP_GAP } * k))- .w(px(plan::clock_width(&self.lines) * k))+ .when(!vertical, |d| d.ml(px(if buttons.is_empty() { 0.0 } else { plan::RIGHT_SEP_GAP } * k)).w(px(plan::clock_width(&self.lines) * k)))- .when(vertical, |d| d.mt(px(plan::RIGHT_SEP_GAP * k)).w_full())++ .when(vertical, |d| d.mt(px(if buttons.is_empty() { 0.0 } else { plan::RIGHT_SEP_GAP } * k)).w_full()).h(px(plan::CLOCK_H * k)).px(px(plan::CLOCK_PAD / 2.0 * k))- .items_end()+ .when(!vertical, |d| d.items_end()).when(vertical, |d| d.items_center()).justify_center().rounded(px(8. * k)).cursor_pointer()diff --cc crates/rf-app/src/dock/tray_tip.rsindex 864eecac,864eecac..ea83ae70--- a/crates/rf-app/src/dock/tray_tip.rs+++ b/crates/rf-app/src/dock/tray_tip.rs@@@ -252,7 -252,7 +252,11 @@@ fn show_now(key: IconKey, started: Instreturn;};let size = rules::size(&anchor.text);-- let rect = rules::rect((anchor.rect.left + anchor.rect.right) / 2, anchor.clear_top.min(anchor.rect.top), anchor.rect.bottom, size, scale, work);++ let rect = if host::vertical(cx) && let Some(glass) = host::current_glass_rect_on(host::MonId::HOME, host::Kind::Right, cx).filter(|g| g.covers(&anchor.rect)) {++ rf_win::dock::preview::beside_icon((anchor.rect.top + anchor.rect.bottom) / 2, glass.left, size, scale, host::size_on(host::MonId::HOME, cx), work)++ } else {++ rules::rect((anchor.rect.left + anchor.rect.right) / 2, anchor.clear_top.min(anchor.rect.top), anchor.rect.bottom, size, scale, work)++ };let dark = island_glass.borrow().dark();let text = anchor.text.clone();let _ = handle.update(cx, |v, _, cx| v.set_text(text, cx));