I have an interface where i want to drag an element from a list of elements to a GridPane. The grid and the list are in different branches of the scene graph. Because of that, my draggable Node disapears behind the GridPane, when i want to drag it over the grid.
One possible solution would be to add the draggable node to a frontmost Pane, where it will be in front of all other nodes. Unfortunately this means i have to remove the node from its old position before i know that the drag and drop gesture will be successfull, which leads to all kinds of additional code.
Is there a way to have a node rendered in front of all other nodes without changing its position in the scene graph?
Is the "draggable Node" actually being moved around by the cursor? If so, you could create an Image from the node and drag that around?
Related
I'm implementing a login screen. It has a centred Column containing a TextField for entering an email address and a number of buttons for social sign-in. When a button is pressed, the Column is rebuilt with a CircularProgressIndicator (spinner) added at the bottom. I've wrapped the spinner in a custom widget that manages a ScaleTransition animation. That works OK, but the Column grows and shifts up to accommodate the final full size of the spinner immediately instead of moving smoothly with the animation.
I also wrapped the Column in an AnimatedSize widget using the same curve and duration as the ScaleTransition, but it hasn't helped. The root of the tree is a Consumer of the state that triggers the addition of the spinner so the animations should both be starting together. Maybe the the spinner needs to be permanent for this to work, but it doesn't seem desirable because its API doesn't provide a way to pause the animation. It would presumably constantly use some power to animate itself even when it isn't visible. I'm fussy about that sort of thing.
It looks like I might have to use an AnimatedList, but it doesn't seem semantically correct because the contents aren't really a list. So is there a more generic way to animate the size (and position) of parent widgets like Column and Center to track an animated size change of their children?
i3wm offers 4 styles for orgnizing child contaniner:
Vertical split
Horizontal split
Stacked
Tabbed
Instead of having one key shortcut for each of them, I would like to rotate through them using only one key.
Reading the documentation I found it is now possible to cycle through all available layouts:
layout toggle all
But this cycles only in one direction.
I would like to be able to cycle in both directions. It is often the case I do it very fast and I pass by the layout I want. In this case I would be able to go back with just only one keystroke instead of having to rotate all over again.
It is possible to list all the layouts explicitely and have an other command with the same layouts but in reverse order:
Example:
bindsym $mod+e layout toggle splith tabbed stacked splitv
bindsym $mod+Shift+e layout toggle splitv stacked tabbed splith
This simulates the desired behaviour, as every time the command is executed, the layout specified after the currently active one will be applied.
Reference: https://i3wm.org/docs/userguide.html#manipulating_layout
I'm using Draggabilly and Packery to build a optimized draggable layout as shown in this Codepen: https://codepen.io/rafaF/pen/MWjvjqO
I have some doubts about how to use Packery/Draggabily.
The first one is how to convert en element "no-draggable", i.e., avoid to be dragged. I've achieved this by no initializing its Draggabilly instance, but I would like also to not be sorted when dragging others elements.
In the other hand, I have not been able to set a fixed height on my Packery layout in order to limit how many elements fits in a column. My idea is that if you move an element to a column that has no free space, the most bottom element should be moved to the other column. I have not found any way to do this.
There is enabled and disable switch in Draggabilly instance that you create. So just disable it if you do not need it.
The second part has to be manually solved becuase the Packery and draggabily would try to adjust in the same layout giving you best possible fit. If you want to limit the height then you have to set and run the ShiftLayout() on pakery. Ideally I would leave it to packery to determine the best layout.
I am working on a JavaFX application in which I have a GridPane. The GridPane consists of Panes. I intend to mouse click on any Pane from the GridPane and start drawing an arrow using CubicCurve. Later, I would release mouse when the intended Pane is reached. Hence, I want to draw an arrow between given two GridPane cells/nodes using CubicCurve. My UI looks like following:
http://i.stack.imgur.com/RWgfJ.png
http://i.stack.imgur.com/RWgfJ.png
Could anyone please suggest me how I could draw a directed arrow, for instance, from cell(2,2) to cell(4,4). I am not able to find easiest way (less code) to do it.
I'm pretty new to javafx so I'm trying to learn here so please be reasonable and don't dis away my question, I really appreciate any help at all, thanks!
I would like to know how I could move an object, let's say this circle on different events, like keypress or mouseclick, mousemove, whatever.
Circle circle = new Circle();
circle.setCenterX(100.0f);
circle.setCenterY(100.0f);
circle.setRadius(50.0f);
Do I need to use that KeyFrame thing I saw on the javafx site tutorial, or how does this work?
I would not have asked this here if I weren't feeling so lost, honestly.
So to make this clear: What is the code for moving objects that I created, by using events?
EDIT: By moving it I mean, press up key and it moves up by a few pixels, transform it maybe, with another key, or click somewhere on the scene and make it move there instantly or travel there with a certain speed. I don't have to redraw it like you need to with html5 canvas, I hope, right?
I don't have to redraw it like you need to with html5 canvas, I hope, right?
Not if you are using a standard JavaFX scene graph as opposed to a JavaFX canvas.
I would like to know how I could move an object, let's say this circle on different events, like keypress or mouseclick, mousemove, whatever
There are three ways to move a Shape:
You can adjust the shape's geometry (e.g. the centerX/centerY properties of a circle).
You can adjust the shape's layout (e.g. it's layoutX/layoutY properties).
You can adjust the shape's translation (e.g. it's translateX/translateY properties).
You can think of the layout as the home position for the object; i.e. where it should normally be in the context of it's parent group. You can think of it's translation transform as a temporary position for an object (often used when the object is being animated).
If you are using a layout pane such as a VBox or TilePane, then the layout pane will handle setting the layout co-ordinates of the child node for you. If you are using a simple Group or a plain Pane or Region, then you are responsible for setting the correct layout values for the child nodes.
To listen for events, set event handlers on Nodes or Scenes.
Here is a small sample app which demonstrates the above. It places the object to be moved inside a Group and modifies the position of the object within a Group in response to various events.