Created
February 28, 2018 04:55
-
-
Save ahinchman1/86b406dd140650bd34ef891ef0bdacb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Compare selected dragging tile with the location of the drop | |
* and render the module tile accordingly | |
* | |
* @property MouseEvent evt | |
*/ | |
private fun drop(evt : MouseEvent) { | |
val mousePt = workArea.sceneToLocal( evt.sceneX, evt.sceneY ) | |
val targetNode = evt.target as Node | |
val tileTarget = targetNode.findParentOfType(Tile::class) | |
// if "Return to Workbench" is clicked, buttonTarget is assigned | |
val buttonTarget = targetNode.findParentOfType(Button::class) | |
if (::inFlightTileProperties.isInitialized && isDragAndDrop) { | |
if (tileTarget is Tile && workArea.contains(mousePt) && | |
inFlightTileProperties.title.toIntOrNull() == null) { | |
pickGridTile(mousePt.x, mousePt.y) | |
root.children[1].getChildList()!!.remove(inFlightTile) | |
inFlightTileProperties.width = 100.0 | |
inFlightTileProperties.height = 100.0 | |
isDragAndDrop = false | |
} | |
} | |
if (buttonTarget is Button && buttonTarget.textProperty().value == "Return to Workbench") { | |
workbenchController.returnToWorkbench(this@TileGUI) | |
} | |
evt.consume() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment