Repository navigation
Dock: any way to set a size range for panels? #3558
|
https://gpui-kit.com/component/dock/ https://gpui-kit.com/component/resizable/#panel-size-constraints |
Replies: 1 comment 2 replies
|
Not as a builder option in v0.7.3. Edge docks don't go through the Workaround: the component skin emits use gpui_kit::component::dock::{DockEvent, DockPlacement};
cx.subscribe_in(&dock_area, window, |_, area, event: &DockEvent, window, cx| {
if let DockEvent::LayoutChanged = event {
area.update(cx, |area, cx| {
if let Some(size) = area.dock_size(DockPlacement::Left) {
let clamped = size.clamp(px(100.), px(500.));
if clamped != size {
area.set_dock_size(DockPlacement::Left, clamped, window, cx);
}
}
});
}
})
.detach();This won't loop: |
Not as a builder option in v0.7.3. Edge docks don't go through the
Resizablepanel constraints. Their drag size is clamped byDockSizing::clamp, which only enforces a fixed floor ofPANEL_MIN_SIZE(100px) and a ceiling that leaves 100px for the center and the opposite dock. So your 100px lower bound is already the default. Only the 500px max needs work.Workaround: the component skin emits
DockEvent::LayoutChangedwhen a dock resize drag ends. Subscribe and clamp withset_dock_size: