Skip to content

Instantly share code, notes, and snippets.

@ahinchman1
Last active February 7, 2018 01:14
Show Gist options
  • Save ahinchman1/3986bb0220b7ef6cf8e46208e0b75d5b to your computer and use it in GitHub Desktop.
Save ahinchman1/3986bb0220b7ef6cf8e46208e0b75d5b to your computer and use it in GitHub Desktop.
Naming conventions, descriptive vs oversimplified
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 (::inFlightTileProperties.isInitialized && isDragAndDrop) {
if (tileTarget is Tile && workArea.contains(mousePt) &&
inFlightTileProperties.title.toIntOrNull() == null) {
// find the grid tile the dragging tile drops on
pickGridTile(mousePt.x, mousePt.y)
root.children[1].getChildList()!!.remove(inFlightTile)
inFlightTileProperties.width = 100.0
inFlightTileProperties.height = 100.0
isDragAndDrop = false
}
}
e.consume()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment