is there a way/feature where i can scale the whole...
# compose-desktop
z
is there a way/feature where i can scale the whole UI like with -Dsun.java2d.uiScale for java gui? some users report that things are too small, so that would help to have a setting like that for compose desktop
a
You can set
LocalDensity
for that
👍 1
z
wow cool. do you have this example code online
z
i meant that example from your screenrecording?
a
Not sure what you mean. It’s the settings window from an app I wrote.
z
the weblink you posted has no mention of density
can you post the kotlin code line that changes the density please?
a
It explains how to work with composition locals. LocalDensity is a composition local.
z
i have no idea what that means. is there an example i can copy and paste? to change the density?
does that i mean i have to set it on every component?
i have a setting like in your screen recording. do you have an example of the code online which changes global density according to this float values?
a
No, you just have to change the value of the
LocalDensity
z
ok. is there code sample i can copy and paste? LocalDensity has many entries
how do i do that? LocalDensity is not writeable
s
CompositionLocalProvider(LocalDensity provides ...) { YourComponentThatNeedsToBeScaled() }
z
@Sean Proctor cool that works. but it only changes on restart. how can i make it recompose when the value state changes? remeber by doesnt do it in that case
s
I'm not sure. It's probably something to do with the fact that
LocalDensity
is a
StaticProvidableCompositionLocal
. I guess you might need another way to cause the recomposition there.
m
Make the density a compose mutableState @Zoff