+25
-3
lines changedFilter options
+25
-3
lines changed Original file line number Diff line number Diff line change
@@ -23,9 +23,11 @@ import com.almasb.fxgl.input.view.KeyView
23
23
import com.almasb.fxgl.logging.Logger
24
24
import com.almasb.fxgl.scene.SceneService
25
25
import com.almasb.fxgl.scene.SubScene
26
+
import com.almasb.fxgl.ui.FXGLScrollPane
26
27
import javafx.beans.binding.Bindings
27
28
import javafx.geometry.Point2D
28
29
import javafx.scene.Group
30
+
import javafx.scene.control.ScrollPane
29
31
import javafx.scene.input.KeyCode
30
32
import javafx.scene.layout.VBox
31
33
import javafx.scene.paint.Color
@@ -35,6 +37,7 @@ import javafx.scene.text.Text
35
37
import javafx.util.Duration
36
38
import java.util.*
37
39
40
+
38
41
/**
39
42
*
40
43
* @author Almas Baimagambetov (almaslvl@gmail.com)
@@ -91,8 +94,27 @@ class DialogueScene(private val sceneService: SceneService) : SubScene() {
91
94
topText.translateX = 50.0
92
95
topText.translateY = 40.0
93
96
94
-
boxPlayerLines.translateX = 50.0
95
-
boxPlayerLines.translateYProperty().bind(sceneService.prefHeightProperty().subtract(160))
97
+
val playerLinesScroll = FXGLScrollPane(boxPlayerLines)
98
+
playerLinesScroll.hbarPolicy = ScrollPane.ScrollBarPolicy.NEVER
99
+
playerLinesScroll.vbarPolicy = ScrollPane.ScrollBarPolicy.NEVER
100
+
playerLinesScroll.prefHeight = botLine.height - 60
101
+
playerLinesScroll.translateX = 50.0
102
+
playerLinesScroll.translateYProperty().bind(sceneService.prefHeightProperty().subtract(160))
103
+
playerLinesScroll.opacityProperty().bind(boxPlayerLines.opacityProperty())
104
+
105
+
// these dummy objects help us place the scroll bar for [playerLinesScroll] on the left side
106
+
val dummyBox = VBox(5.0)
107
+
dummyBox.prefHeightProperty().bind(boxPlayerLines.heightProperty())
108
+
109
+
val dummyScroll = FXGLScrollPane(dummyBox)
110
+
dummyScroll.translateX = 0.0
111
+
dummyScroll.translateY = playerLinesScroll.translateY
112
+
dummyScroll.hbarPolicy = ScrollPane.ScrollBarPolicy.NEVER
113
+
dummyScroll.prefHeightProperty().bind(playerLinesScroll.prefHeightProperty())
114
+
dummyScroll.vmaxProperty().bind(playerLinesScroll.vmaxProperty())
115
+
dummyScroll.vminProperty().bind(playerLinesScroll.vminProperty())
116
+
dummyScroll.vvalueProperty().bindBidirectional(playerLinesScroll.vvalueProperty())
117
+
96
118
boxPlayerLines.opacity = 0.0
97
119
98
120
val keyView = KeyView(KeyCode.ENTER, Color.GREENYELLOW, 18.0)
@@ -104,7 +126,7 @@ class DialogueScene(private val sceneService: SceneService) : SubScene() {
104
126
105
127
initUserActions()
106
128
107
-
contentRoot.children.addAll(topLine, botLineGroup, topText, boxPlayerLines, keyView)
129
+
contentRoot.children.addAll(topLine, botLineGroup, topText, dummyScroll, playerLinesScroll, keyView)
108
130
}
109
131
110
132
private fun initUserActions() {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4