compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Enhancement: Improve codeviewer example: No protrude splittable both side .

Open MelVouivre opened this issue 6 years ago • 8 comments

In the "vertical splitter" example currently used in codeviewer, the left side does not protrude due to the minimum size specification, but the right side has no limit and will protrude outside the window. I'd like to improve this, but I'm wondering if you have any good examples.

Sorry Im poor English end use machine translation sorry.

MelVouivre avatar Nov 28 '20 07:11 MelVouivre

If this is not appropriate here, I would be grateful if you could guide me to the right place.

MelVouivre avatar Nov 28 '20 07:11 MelVouivre

How to get parent size or splittable itself in composable function? If exist, coerceAtMost() is work it.

MelVouivre avatar Nov 29 '20 13:11 MelVouivre

You can look at this: https://github.com/JetBrains/compose-jb/commit/9e67cfc916f696220d630ceb6e5b67e9570777a3

But it is not finished. If we resize the main window then we will see a small lag (size of the panel will not be immediately changed)

igordmn avatar Nov 29 '20 13:11 igordmn

Getting size of composable itself to use onSizeChanged() and size-state is workaround? Allow to use it normally?

MelVouivre avatar Nov 29 '20 15:11 MelVouivre

Getting size of composable itself to use onSizeChanged() and size-state is workaround? Allow to use it normally?

Probably the lag when we resize the main window caused by onSizeChanged (because the panel will be resized only on the second frame).

Probably we need to constrain sizes of panels not inside onSizeChanged, but inside VerticalSplittable function

igordmn avatar Nov 29 '20 15:11 igordmn

Oh, sorry. Apart from this issue, I wanted to ask if this usage is normal. Probably because there are going to be many situations where you want to know the size of itself.

MelVouivre avatar Nov 29 '20 15:11 MelVouivre

I wanted to ask if this usage is normal

Probably in most cases we should use Layout or WithConstraints

Because we will know the size of the container immediately (in the current frame).

But in the case it is not important to know the size in the current frame, we can use onSizeChanged and size-state.

igordmn avatar Nov 29 '20 15:11 igordmn

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Jul 14 '24 17:07 okushnikov