Any idea on how to universally scale up/down the w...
# compose-desktop
o
Any idea on how to universally scale up/down the whole window content without adding
* scale
in every place? Like zooming in browser, so window size becomes virtually smaller when zooming in, and then all sizing/measures/font size are multiplied to become bigger and fit the whole space?
k
Maybe override LocalDensity somewhere at the top level. It's not clear what you mean by the last part though. What does it mean to fit the whole space. Do you have a couple designs to show what you're looking for?
o
Just like Cmd-Plus/Minus in the browser 🙂 It’s important for accessibility. Yes, I was thinking about LocalDensity, but didn’t actually tried anything yet. Thought maybe it’s a solved task already by community
k
Browser is a content canvas though. Here we're mostly talking about application control surfaces with buttons, checkboxes, etc. Presumably your interface is already fitting into its window, so zooming in would require some sort of adaptive reflowing of the larger controls. Something like the office ribbon that starts hiding elements as everything grows?
a
I'd use LocalDensity. I do a similar thing in Gitnuro where I allow users to set a custom "zoom". Here is where I use it: https://github.com/JetpackDuba/Gitnuro/blob/main/src/main/kotlin/com/jetpackduba/gitnuro/App.kt#L97 I've got a property called "scale" that's stored and whenever that changes, everything gets recomposed with the new value
o
@Abdelilah El Aissaoui works like a charm, thanks!
a
You are welcome 🙂