chore: reduce component overhead (#3)

Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
2026-11-09 10:09:56 +00:00
parent 6815585528
commit 1c091db699
44 changed files with 1376 additions and 1241 deletions
+14 -6
View File
@@ -10,11 +10,11 @@ use gpui::{
SharedString, StatefulInteractiveElement as _, Styled as _, Window, canvas, deferred, div,
fill, point, px,
};
use gpui_native_theme::{ActiveTheme as _, Size};
use gpui_native_theme::{ActiveTheme as _, RESIZE_KEYBOARD_STEP, Size};
use gpui_native_utils::{focus_handle, focus_ring};
/// How far one keyboard arrow step moves the seam.
const KEYBOARD_STEP: f32 = 32.0;
const KEYBOARD_STEP: Pixels = RESIZE_KEYBOARD_STEP;
type ResizeHandler = Rc<dyn Fn(Pixels, &mut Window, &mut App)>;
type ResetHandler = Rc<dyn Fn(&mut Window, &mut App)>;
@@ -180,10 +180,10 @@ impl RenderOnce for ResizeHandle {
let on_resize = self.on_resize.clone();
move |event: &KeyDownEvent, window, cx| {
let delta = match (axis, event.keystroke.key.as_str()) {
(Axis::Horizontal, "left") => Some(px(-KEYBOARD_STEP)),
(Axis::Horizontal, "right") => Some(px(KEYBOARD_STEP)),
(Axis::Vertical, "up") => Some(px(-KEYBOARD_STEP)),
(Axis::Vertical, "down") => Some(px(KEYBOARD_STEP)),
(Axis::Horizontal, "left") => Some(-KEYBOARD_STEP),
(Axis::Horizontal, "right") => Some(KEYBOARD_STEP),
(Axis::Vertical, "up") => Some(-KEYBOARD_STEP),
(Axis::Vertical, "down") => Some(KEYBOARD_STEP),
_ => None,
};
if let Some(delta) = delta {
@@ -255,6 +255,14 @@ impl RenderOnce for ResizeHandle {
return;
}
if event.pressed_button != Some(MouseButton::Left) {
drag.update(cx, |drag, cx| {
drag.dragging = false;
cx.notify();
});
return;
}
let delta = match axis {
Axis::Horizontal => event.position.x - last.x,
Axis::Vertical => event.position.y - last.y,