Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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 |
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
private fun d(e : MouseEvent) { | |
val m = w.sceneToLocal( e.sceneX, e.sceneY ) | |
val tN = e.target as Node | |
val tT = tN.findParentOfType(Tile::class) | |
if (::i.isInitialized && dnd) { | |
if (tT is Tile && w.contains(mousePt) && | |
i.t.toIntOrNull() == null) { | |
p(m.x, m.y) |
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
class DragAndDrop : View() { | |
/***** Global Variables *****/ | |
private val tileBuilderController: TileBuilderController by inject() | |
val workbenchController: WorkbenchController by inject() | |
private val controller: TileGUIController by inject() | |
var workArea: GridPane by singleAssign() | |
var moduleBoxItems = mutableListOf<Node>() | |
lateinit var gridInfo: GridInfo |
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
/** | |
* Grabs a tile and its properties to prepare for the animateDrag | |
* and drop events. | |
* | |
* @property MouseEvent evt | |
*/ | |
private fun startDrag(evt : MouseEvent) { | |
val targetNode = evt.target as Node | |
val tileTarget = targetNode.findParentOfType(Tile::class) |
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 |
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
public class Person { | |
// instance variables | |
String firstName; | |
String lastName; | |
int age; | |
// constructor | |
public Person(String firstName, String lastName, int age) { |
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
setOnDragOver { event -> | |
if (event.dragboard.hasFiles()) event.acceptTransferModes(TransferMode.COPY) | |
event.consume() | |
} |
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
package com.example.demo.view | |
import javafx.geometry.Pos | |
import javafx.scene.layout.StackPane | |
import tornadofx.* | |
import java.util.* | |
class NeighborhoodView: View() { | |
// set up neighborhood |
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
class GridPaneExample { | |
/** | |
* @param args the command line arguments | |
*/ | |
public static void main(String[] args) { | |
Application.launch(args); | |
} | |
@Override | |
public void start(Stage primaryStage) { |
OlderNewer