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