fix: exclude scroll area padding from pane sizing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use gpui::prelude::FluentBuilder as _;
|
||||
use gpui::{
|
||||
Axis, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement as _,
|
||||
Pixels, Render, Styled as _, TestAppContext, VisualTestContext, Window, div, point, px,
|
||||
@@ -26,11 +27,17 @@ impl Render for Harness {
|
||||
) -> impl gpui::IntoElement {
|
||||
let deltas = self.deltas.clone();
|
||||
let resets = self.resets.clone();
|
||||
let horizontal = self.axis == Axis::Horizontal;
|
||||
div()
|
||||
.size_full()
|
||||
.flex()
|
||||
.flex_row()
|
||||
.child(div().w(px(120.)).h_full())
|
||||
.when(horizontal, |layout| layout.flex_row())
|
||||
.when(!horizontal, |layout| layout.flex_col())
|
||||
.child(if horizontal {
|
||||
div().w(px(120.)).h_full()
|
||||
} else {
|
||||
div().h(px(120.)).w_full()
|
||||
})
|
||||
.child(
|
||||
ResizeHandle::new("test-handle")
|
||||
.axis(self.axis)
|
||||
@@ -38,7 +45,11 @@ impl Render for Harness {
|
||||
.on_resize(move |delta, _, _| deltas.borrow_mut().push(delta))
|
||||
.on_reset(move |_, _| *resets.borrow_mut() += 1),
|
||||
)
|
||||
.child(div().flex_1().h_full())
|
||||
.child(if horizontal {
|
||||
div().flex_1().h_full()
|
||||
} else {
|
||||
div().flex_1().w_full()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user