override fun onDragStarted()

in code/scenes/src/main/kotlin/org/fbme/scenes/controllers/diagram/ConnectionsFacility.kt [258:295]


        override fun onDragStarted(event: DragEvent) {
            if (!diagramController.isDiagramEditable) {
                return
            }
            val x = event.awt.x
            val y = event.awt.y
            for (connection in connections.values) {
                val controller = connection.controller
                var pathTransformation = controller.getEdgeTransformation(connection.modelPath, x, y)
                if (pathTransformation != null) {
                    event.consume(ConnectionPathChangeDragEventHandler(x, y, pathTransformation, connection))
                    return
                }
                if (controller.isSourceTransformableAt(connection.modelPath, x, y)) {
                    pathTransformation = controller.getSourceTransformation(connection.modelPath)
                    if (pathTransformation != null) {
                        event.consume(ConnectionSourceChangeDragEventHandler(x, y, pathTransformation, connection))
                        return
                    }
                }
                if (controller.isTargetTransformableAt(connection.modelPath, x, y)) {
                    pathTransformation = controller.getTargetTransformation(connection.modelPath)
                    if (pathTransformation != null) {
                        event.consume(ConnectionTargetChangeDragEventHandler(x, y, pathTransformation, connection))
                        return
                    }
                }
            }
            val port = diagramController.findPort(x, y)
            if (port != null) {
                val setting = diagramController.getPortController(port)
                if (setting.canBeSourcedAt(x, y)) {
                    event.consume(NewConnectionFromSourceDragEventHandler(port))
                } else if (setting.canBeTargetedAt(x, y)) {
                    event.consume(NewConnectionFromTargetDragEventHandler(port))
                }
            }
        }