mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Welcome Screen + Prefs QA (#1362)
Set the default editor theme to automatic in defaults.txt. Added a slight delay in file watching to reduce CPU usage. Enhanced the WelcomeSurvey UI with a border for better visual feedback. Refactored zoom preference handling in Interface.kt to use lambdas for up-to-date values.
This commit is contained in:
@@ -307,3 +307,6 @@ pdex.completion.trigger = false
|
||||
pdex.suggest.imports = true
|
||||
# Set to false to disable ctrl/cmd-click jump to definition
|
||||
pdex.inspectMode.hotkey = true
|
||||
|
||||
# Set default theme to automatic based on the users system
|
||||
preferences.editor.theme=
|
||||
@@ -3,6 +3,7 @@ package processing.app
|
||||
import androidx.compose.runtime.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
import kotlinx.coroutines.flow.dropWhile
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -190,6 +191,7 @@ fun watchFile(file: File): Any? {
|
||||
if (modified.context() != path.fileName) continue
|
||||
event = modified
|
||||
}
|
||||
delay(10)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package processing.app.ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
@@ -47,6 +48,7 @@ fun SurveyInvitation() {
|
||||
.pointerHoverIcon(
|
||||
PointerIcon.Hand
|
||||
)
|
||||
.border(1.dp, MaterialTheme.colorScheme.outlineVariant, RoundedCornerShape(12.dp))
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource("bird.svg"),
|
||||
|
||||
@@ -126,8 +126,8 @@ class Interface {
|
||||
?: range.start
|
||||
)
|
||||
}
|
||||
val automatic = currentZoom == range.start
|
||||
val zoomPerc = "${currentZoom.toInt()}%"
|
||||
val automatic = { currentZoom == range.start }
|
||||
val zoomPerc = { "${currentZoom.toInt()}%" }
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
@@ -136,16 +136,14 @@ class Interface {
|
||||
.widthIn(max = 200.dp)
|
||||
) {
|
||||
Text(
|
||||
text = if (automatic) "Auto" else zoomPerc,
|
||||
text = if (automatic()) "Auto" else zoomPerc(),
|
||||
)
|
||||
Slider(
|
||||
value = currentZoom,
|
||||
onValueChange = {
|
||||
currentZoom = it
|
||||
},
|
||||
onValueChangeFinished = {
|
||||
prefs["editor.zoom.auto"] = automatic
|
||||
updatePreference(zoomPerc)
|
||||
prefs["editor.zoom.auto"] = automatic()
|
||||
updatePreference(zoomPerc())
|
||||
},
|
||||
valueRange = range,
|
||||
steps = 3
|
||||
|
||||
Reference in New Issue
Block a user