Is anyone willing to help me figure out how to mak...
# tornadofx
h
Is anyone willing to help me figure out how to make svgs fluidly draggable? i've been struggling with it for hours with little success. I'd be extremely appreciative, however, I'm probably just gonna go back to basics with javafx documentation
m
Unless SVG not being "fluidly draggable" is a well known problem with tornadofx (or JavaFX), you should probably describe your problem more precisely.
👍 1
h
Yeah, I believe I'm just not very good at torndafx/javafx. I have a grid of squares on a stackpane, and I wan't to be able to drag all of them around the screen. My hope was that I could relocate the group akin to how I can resize all the squares by resizing the group. No luck. Here's my largely stripped down code for context:
Copy code
private lateinit var mousePosition: Point

    override val root = stackpane {
        val g = group { // all dem squares }

        setOnMousePressed {
            mousePosition = it.point
        }

        setOnMouseDragged {
            val d = it.point - mousePosition
            g.relocate(d.x, d.y)
            mousePosition = it.point
        }
    }
holy fuck. i figured it out
I can get the grid to move around in relation to another object in the group, but I'd like it to move around the screen instead.
m
"Around the screen"? As in like if they were out of a window? You'll need something more than that. In any GUI toolkit, for that matter.
h
yeah, as if you could drag it off the screen
m
You'll have to create a borderless window with transparent background and copy the items there, and then move the window. Assuming that's something you can do in JavaFX at all. You can do it in many native windowing systems.
h
Hmm. Thanks for the advice
m
Some windowing systems support drag and drop with a custom graphical representation of the content that is being dragged. I suspect JavaFX won't support that, but you'll have to investigate.
h
The fact that you can zoom into different parts of it to mimic panning it around, I wonder why there aren't simple methods to do what I'm asking
m
Window managers are very complex. Things may not be as simple as they look like. A better approach is learning a bit of how they work (windowing system, GUI toolkits), so that your imagination doesn't get frustrated by the technicalities but can work together with them. This is true for all kind of design.
Also, window managers are very different and a multiplatform GUI toolkit as JavaFX has to work with a common subset of their features.
When they work. My experience with JavaFX on Ubuntu (Linux , X-Window) is not very positive.
That and some work.
h
thank you so much for your help. I'll let you know if I get it working