Skip to content
Snippets Groups Projects
Commit 84107cab authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Highlight player zone on settings selection

parent 620dbd87
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,10 @@ class ContentPlayerViewController extends NVC { ...@@ -26,8 +26,10 @@ class ContentPlayerViewController extends NVC {
setLayoutX(playerInstance.x) setLayoutX(playerInstance.x)
setLayoutY(playerInstance.y) setLayoutY(playerInstance.y)
setWidth(playerInstance.width) setMinWidth(playerInstance.width)
setHeight(playerInstance.height) setMaxWidth(playerInstance.width)
setMinHeight(playerInstance.height)
setMaxHeight(playerInstance.height)
def addActivePad(padIndex: PadIndex): Unit = activePlayers.addOne(padIndex) def addActivePad(padIndex: PadIndex): Unit = activePlayers.addOne(padIndex)
...@@ -56,6 +58,14 @@ class ContentPlayerViewController extends NVC { ...@@ -56,6 +58,14 @@ class ContentPlayerViewController extends NVC {
} }
} }
def highlight(on: Boolean): Unit = {
if (on) {
setBackground(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY)))
} else {
setBackground(null)
}
}
override def toString: String = f"MediaPlayerStack: ${getChildren.stream().map(view => f"MediaView: ${view.getUserData}").collect(Collectors.joining(", "))}" override def toString: String = f"MediaPlayerStack: ${getChildren.stream().map(view => f"MediaView: ${view.getUserData}").collect(Collectors.joining(", "))}"
} }
...@@ -131,4 +141,8 @@ class ContentPlayerViewController extends NVC { ...@@ -131,4 +141,8 @@ class ContentPlayerViewController extends NVC {
def removeActivePadFromList(padIndex: PadIndex, zones: Seq[PlayerInstance]): Unit = mediaPlayers def removeActivePadFromList(padIndex: PadIndex, zones: Seq[PlayerInstance]): Unit = mediaPlayers
.filter(mediaPlayer => zones.contains(mediaPlayer.playerInstance)) .filter(mediaPlayer => zones.contains(mediaPlayer.playerInstance))
.foreach(mediaPlayer => mediaPlayer.removeActivePad(padIndex)) .foreach(mediaPlayer => mediaPlayer.removeActivePad(padIndex))
def highlight(zone: PlayerInstance, on: Boolean): Unit = {
mediaPlayers.filter(mediaPlayer => zone == mediaPlayer.playerInstance).head.highlight(on)
}
} }
...@@ -47,11 +47,15 @@ class PlayerInstanceSettingsViewController extends GlobalSettingsTabViewControll ...@@ -47,11 +47,15 @@ class PlayerInstanceSettingsViewController extends GlobalSettingsTabViewControll
} }
}) })
listView.getSelectionModel.selectedItemProperty().addListener((_, oldValue, newValue) => { listView.getSelectionModel.selectedItemProperty().addListener((_, oldValue, newValue) => {
val playerViewController = ContentPluginMain.playerViewController
if (oldValue != null) { if (oldValue != null) {
saveSettingsToPlayerInstance(oldValue) saveSettingsToPlayerInstance(oldValue)
playerViewController.highlight(oldValue, on = false)
} }
if (newValue != null) { if (newValue != null) {
showSettingsOfPlayerInstance(newValue) showSettingsOfPlayerInstance(newValue)
playerViewController.highlight(newValue, on = true)
} else { } else {
clearTextFields() clearTextFields()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment