From a2bffd3840eb61440072313d1e6c8f42db9d1eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Przemys=C5=82aw=20Pluta?= Date: Sun, 7 Feb 2021 10:58:01 +0100 Subject: [PATCH] [Editor] Replace brush range buttons with slider --- .../base/editor/view/map/MapToolbarView.kt | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/view/map/MapToolbarView.kt b/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/view/map/MapToolbarView.kt index 4e0c5138..318e8158 100755 --- a/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/view/map/MapToolbarView.kt +++ b/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/view/map/MapToolbarView.kt @@ -20,7 +20,6 @@ class MapToolbarView : View() { private val tool = ToggleGroup() - override val root = toolbar { button(graphic = FontIcon("fa-undo")) { shortcut("Ctrl+Z") @@ -78,20 +77,22 @@ class MapToolbarView : View() { graphic = FontIcon("fa-eraser") } - this += FontIcon("fa-paint-brush") + this += FontIcon("fa-paint-brush").apply { iconSize = 10 } - button(graphic = FontIcon("fa-plus")) { - enableWhen(brushVM.brushRangeProperty.lessThan(5)) - action { - brushVM.item = brushVM.withBrushRange(brushVM.brushRange + 1) + slider(1..5) { + majorTickUnit = 1.0 + isSnapToTicks = true + minorTickCount = 0 + + valueProperty().addListener { _, _, newValue -> + brushVM.item = brushVM.withBrushRange(newValue.toInt()) + } + + brushVM.brushRangeProperty.addListener { _, _, newValue -> + value = newValue.toDouble() } } - button(graphic = FontIcon("fa-minus")) { - enableWhen(brushVM.brushRangeProperty.greaterThan(1)) - action { - brushVM.item = brushVM.withBrushRange(brushVM.brushRange - 1) - } - } + this += FontIcon("fa-paint-brush").apply { iconSize = 15 } } } \ No newline at end of file