[Editor] Fix Label editor appearance
This commit is contained in:
@@ -3,8 +3,12 @@ package com.bartlomiejpluta.base.editor.common.view
|
||||
import javafx.beans.property.SimpleStringProperty
|
||||
import tornadofx.*
|
||||
|
||||
class StringInputFragment : Fragment("Enter value") {
|
||||
val valueProperty = SimpleStringProperty()
|
||||
class StringInputFragment : Fragment("Define value") {
|
||||
val initialValue by param("")
|
||||
val fieldsetLabel by param(title)
|
||||
val label by param("Value: ")
|
||||
|
||||
val valueProperty = SimpleStringProperty(initialValue)
|
||||
var value by valueProperty
|
||||
|
||||
private var onCompleteConsumer: ((String) -> Unit)? = null
|
||||
@@ -13,13 +17,16 @@ class StringInputFragment : Fragment("Enter value") {
|
||||
this.onCompleteConsumer = consumer
|
||||
}
|
||||
|
||||
|
||||
override val root = borderpane {
|
||||
center = textfield(valueProperty) {
|
||||
whenDocked { requestFocus() }
|
||||
override val root = form {
|
||||
fieldset(fieldsetLabel) {
|
||||
field(label) {
|
||||
textfield(valueProperty) {
|
||||
whenDocked { requestFocus() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bottom = buttonbar {
|
||||
buttonbar {
|
||||
button("Apply") {
|
||||
action {
|
||||
onCompleteConsumer?.let { it(value) }
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.bartlomiejpluta.base.editor.common.viewmodel
|
||||
|
||||
import tornadofx.*
|
||||
|
||||
class StringVM(value: String = "") : ViewModel() {
|
||||
val valueProperty = value.toProperty()
|
||||
val value by valueProperty
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.bartlomiejpluta.base.editor.map.canvas
|
||||
|
||||
import com.bartlomiejpluta.base.editor.common.view.StringInputFragment
|
||||
import com.bartlomiejpluta.base.editor.common.viewmodel.StringVM
|
||||
import com.bartlomiejpluta.base.editor.map.model.brush.BrushMode
|
||||
import com.bartlomiejpluta.base.editor.map.model.layer.ObjectLayer
|
||||
import com.bartlomiejpluta.base.editor.map.model.obj.MapLabel
|
||||
@@ -14,7 +13,6 @@ import javafx.collections.ObservableList
|
||||
import javafx.scene.input.MouseButton
|
||||
import tornadofx.Scope
|
||||
import tornadofx.find
|
||||
import tornadofx.setInScope
|
||||
|
||||
class LabelPaintingTrace(
|
||||
private val projectContext: ProjectContext,
|
||||
@@ -57,13 +55,14 @@ class LabelPaintingTrace(
|
||||
|
||||
private fun showCodeDialog(initialContent: String): String? {
|
||||
val scope = Scope()
|
||||
val vm = StringVM(initialContent)
|
||||
setInScope(vm, scope)
|
||||
|
||||
var content: String? = null
|
||||
|
||||
find<StringInputFragment>(scope).apply {
|
||||
title = "Set label"
|
||||
find<StringInputFragment>(scope,
|
||||
StringInputFragment::initialValue to initialContent,
|
||||
StringInputFragment::fieldsetLabel to "Define label",
|
||||
StringInputFragment::label to "Label: ").apply {
|
||||
title = "Label"
|
||||
|
||||
onComplete {
|
||||
content = it
|
||||
|
||||
Reference in New Issue
Block a user