Nico Gründel
|
5de9a24654
|
resizable: Improve to avoid panels from improperly resizing on container resizing. (#1560)
This pull request changes the internal behavior of the resizable panel
to get rid of some weird behavior with many panels and resizing.
Previously, when having multiple panels and dragging them into each
other, panels that shouldn't be affected got improperly resized:
https://github.com/user-attachments/assets/20d280c0-8a51-4e96-9c4a-3ade3deaca02
This pull request completely fixes this behavior:
https://github.com/user-attachments/assets/7c207dd8-d0a0-47d3-8d9e-c7127f43fa73
In addition, dragging the container smaller and larger again wasn't
idempotent:
https://github.com/user-attachments/assets/ca54b039-fd79-4fa8-87cf-590c06dd2c18
This is also fixed by this pull request, replacing the behavior with
more intuitive behavior, keeping the fractional size of all panels
constant:
https://github.com/user-attachments/assets/365d0a99-fd4b-4948-bc1b-bafdd826394a
https://github.com/user-attachments/assets/b208b34f-18e7-42a4-825a-9dad421b7ad3
If desired, it would also be easy to only change the size of the panels
that don't have a default size set when the container changes size.
---------
Co-authored-by: Jason Lee <huacnlee@gmail.com>
|
2025-11-12 21:18:05 +08:00 |
|
Jason Lee
|
2727a65494
|
resizable: Simplify Resizable API. (#1459)
- Added `on_resize` callback method to `ResizabelPanelGroup`.
## Break Changes
- Remove `state` argument from `h_resizable`, `v_resizable` method.
```diff
- v_resizable("resizable-1", state)
+ v_resizable("resizable-1")
```
- Removed `group` method from `ResizabelPanelGroup`, use `child`
instead.
```diff
- v_resizable(..).group(..)
+ v_resizable(..).child(..)
```
|
2025-10-29 23:01:05 +08:00 |
|
Jason Lee
|
327d40e0e0
|
chore: Upgrade GPUI 3 (#587)
The pervious version has keep on
[gpui2](https://github.com/longbridge/gpui-component/tree/gpui2) branch,
if there need to use.
Ref https://github.com/zed-industries/zed/pull/22632
## Prepare
### Generate index.scip
```bash
rust-analyzer scip ./ > index.scip
```
### Get [refactor](https://github.com/zed-industries/refactor)
```bash
https://github.com/zed-industries/refactor.git
```
## Refactor exist code
```bash
cd refactor
cargo run -- ~/work/gpui-component
```
Then will get result if successed:
```
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/refactor /Users/jason/work/gpui-component`
Loaded 115 SCIP documents
Processing files starting with focus path: ""
Changed 90 files
```
-------------
## Changes
```diff
- View<T>
- Model<T>
+ Entity<T>
- WeakView<T>
+ WeakEntity<T>
- FocusableView
+ Focusable
- cx.bounds()
+ window.bounds()
- cx.refresh()
+ window.refresh()
- cx.focused()
+ window.focused(cx)
- cx.with_optional_element_state
- window.with_optional_element_state
```
```diff
- &mut WindowContext
+ &mut Window, &mut App
- cx: &mut WindowContext
+ window: &mut Window, cx: &mut App
- &mut ViewContext<
+ &mut Window, &mut Context<
- cx: &mut ViewContext<
+ window: &mut Window, cx: &mut Context<
```
```diff
- cx.spawn(|_, mut cx| async move {
+ cx.spawn_in(window, |_, mut cx| async move {
- cx.dispatch_action(Box::new(...))
+ window.dispatch_action(Box::new(...), cx)
```
`cx.spawn`
```diff
- cx.spawn(|view, mut cx| async move {
+ cx.spawn_in(window, |view, mut window| async move {
+ _ = view.update_in(&mut window, move |view, window, cx| {
```
|
2025-01-27 03:58:48 +08:00 |
|