bod
07/15/2024, 2:12 PMSwitch
). For mobile, they need to be big enough to be tapped with a finger - but on Desktop it's odd. And (at least in the example of Switch) these sizes are hardcoded.bod
07/15/2024, 2:14 PMbod
07/15/2024, 2:17 PMbod
07/15/2024, 2:17 PMChrimaeon
07/15/2024, 2:29 PMbod
07/15/2024, 2:38 PMChrimaeon
07/15/2024, 2:40 PMbod
07/15/2024, 2:40 PMbod
07/15/2024, 2:42 PMChrimaeon
07/15/2024, 2:43 PMbod
07/15/2024, 2:44 PMChrimaeon
07/15/2024, 2:45 PMLocalDensity.current
if they make sense.bod
07/15/2024, 2:45 PMbod
07/15/2024, 2:46 PMArjan van Wieringen
07/15/2024, 3:38 PMChrimaeon
07/15/2024, 3:40 PMAlexander Maryanovsky
07/15/2024, 3:40 PMephemient
07/15/2024, 3:45 PMephemient
07/15/2024, 3:46 PMbod
07/15/2024, 3:57 PMI would say you need the larger touch targets in some casesI kind of agree, however I think a guiding principle should be that the sizes of the widgets should probably be similar to the OS's ones. I trust Apple/Microsoft to do studies etc. to have the correct sizes.
ephemient
07/15/2024, 3:58 PMephemient
07/15/2024, 3:58 PMbod
07/15/2024, 3:59 PMMichael Paus
07/15/2024, 4:07 PMephemient
07/15/2024, 4:09 PMthe sizes of the widgets should probably be similar to the OS's onesI don't think that's a principle at all. iOS HIG has touch target size 44x44, and Material doesn't change for that even if it could.
bod
07/15/2024, 4:10 PMephemient
07/15/2024, 4:10 PMephemient
07/15/2024, 4:10 PMbod
07/15/2024, 4:10 PMI don't think that's a principle at all.but shouldn't it?
ephemient
07/15/2024, 4:11 PMbod
07/15/2024, 4:12 PMbod
07/15/2024, 4:13 PMephemient
07/15/2024, 4:14 PMephemient
07/15/2024, 4:14 PMbod
07/15/2024, 4:15 PMbod
07/15/2024, 4:15 PMephemient
07/15/2024, 4:15 PMephemient
07/15/2024, 4:16 PMbod
07/15/2024, 4:17 PMbod
07/15/2024, 4:18 PMephemient
07/15/2024, 4:20 PMMichael Paus
07/15/2024, 4:51 PMCompositionLocalProvider(LocalMinimumInteractiveComponentEnforcement provides isTouchDevice) {
Your GUI code here
}
where isTouchDevice is a Boolean defined by user input. This makes the GUI look and behave a little bit more desktop like.ephemient
07/15/2024, 4:53 PMLocalMinimumInteractiveComponentSize
which is allows for finer control, but either way, we don't have the APIs to know if there's a touch digitizer attached or not…Michael Paus
07/15/2024, 5:32 PMArjan van Wieringen
07/15/2024, 5:35 PMbod
07/15/2024, 5:35 PMI have this as a user preference in my apps. Only the user can say which input device he/she primarily wants to use. This cannot be automatically detected because the sole presence of such a device does not mean that I actually want to use it.
Interesting. I never interacted with in a desktop with touchscreen system before... I'm wondering how they usually behave.
Chrimaeon
07/15/2024, 5:38 PMArjan van Wieringen
07/15/2024, 5:40 PMephemient
07/15/2024, 5:42 PMephemient
07/15/2024, 5:43 PMephemient
07/15/2024, 5:45 PMPau Marzo
07/16/2024, 12:30 PMephemient
07/16/2024, 3:23 PMCompositionLocalProvider(LocalDensity provides Density(density, fontScale)) {
// ...
}
changes it for everything inside the blockPau Marzo
07/16/2024, 3:34 PMChris Sinco [G]
07/17/2024, 3:19 AMMichael Paus
07/17/2024, 5:10 AMPau Marzo
07/17/2024, 11:39 AMbod
07/17/2024, 12:29 PM2
, and a value of 1.5
looks good to me.
So currently my code does LocalDensity.current.density / 4f * 3f
.
The Switch looks more reasonably sized (actually still a bit big to be honest but don't want everything else to be too small either).Marcin Wisniowski
10/13/2024, 2:55 PMLocalDensity
seems to not affect the scale for window sizing, see this example. The DpSize(200.dp, 200.dp)
passed to the Window
is at 1.0
density instead of 2.0
that it should be. Do you know what's the issue here?Marcin Wisniowski
10/13/2024, 2:56 PMChrimaeon
10/13/2024, 2:59 PMMarcin Wisniowski
10/13/2024, 3:00 PMMarcin Wisniowski
10/13/2024, 3:00 PMChrimaeon
10/13/2024, 3:03 PMChrimaeon
10/13/2024, 3:11 PMMarcin Wisniowski
10/13/2024, 3:14 PMDpSize
does consider density, but it's always the "natural" density and is not affected by setting LocalDensity
.Chrimaeon
10/13/2024, 3:15 PMWindow
sets the LocalDensity
and overrides your value.Marcin Wisniowski
10/13/2024, 3:15 PM