Swap children's depth - html5-canvas

I am using canvas and createjs. I have a container that has an eventListener attached to it so that any child in that container can be selected. When a child is selected I can drag it around on the stage but it is relative to its index so it is above some children and below others. I would like to move the above child to the top index. In flash I was able to swap the depth of that child and I was wondering if there is something similar in Javascript?
Thx.

All you gotta do is:
yourContainer.addChild(selectedChild);
this will pull your object to the top of your display list.

Related

SWT resize dynamically scroll of composite

I have created a composite which has three children - Composite 1, 2 and 3. The children try to recreate the functionality of expand items in an expandbar. I want to make my parent composite scrollable vertically, so that all children are visible when expanded. I also want the size of the scroll to be changed dynamically as the composite gets bigger because it is possible to expand only one item, or two, or all three of them (see pictures for demonstration). How can I achieve that? Thanks in advance.

How to render only visible nodes inside a ScrollPane?

I'm using JavaFX to show thousands of nodes inside a ScrollPane. It gets laggy on nodes more than about 50. I'm adding each node by pane.getChilderen.add(myNewNode); and then move them to a specific position on the pane. How to make a pane to only render visible items to optimize the performance? Thanks.

Collapsing item in JavaFX Tree View leaves some items improperly rendered

My JavaFX application uses Tree View and tree items are added dynamically added at different points while the program is running. The tree view does not render some tree items after expanding and collapsing items. The following images will make my point clearer.
The first picturing shows the tree after expanding and the second picture show the same tree after collapsing. As you can see the item Plate does not get properly rendered.
Is this a JavaFX bug or have I done something wrong? Also is there a correct way to get it rendered correctly or a workaround if this happens to be a bug?

Layout horizontally and multiple lines

I'd like to layout a bunch of child Views horizontally. If children fill a row, they should allocate more space and continue the render process in the next row. This process should continue, as long as children are left to get rendered.
May I use this using Xamarin.Forms views?
There are no wrapping layouts currently in Xamarin.Forms, but you can achieve this quid easily with a RelativeLayout, as it allows to have constraint for childs relative to its parent.

Showing nested figures in GEF on mouse hover

There's no problem in showing nested figures in GEF on mouse hover. On mouseHover(MouseEvent me), I add(IFigure), and on mouseExited(MouseEvent me) I remove the figure.
But as soon as I add a Button(Draw2d), or I add a figure which has a MouseListener() attached to it, now when I hover over the newly added figure(inside the parent), it disappears.
I figured the problem is that the first figure calls its mouseExited(MouseEvent me) method.
So, I did this in the parent figure's mouseExited(MouseEvent me):
Point exitLocation = me.getLocation();
if (containsPoint(exitLocation.x, exitLocation.y) == false) {
remove(childFigure);
}
I see on mouse exit, if it still is in the bounds of the parent figure, it doesn't remove the child figure.
But this works most of the time. Sometimes my mouse is out of the parent figure completely, yet the child figure isn't removed from the parent figure. I have no idea what is happening.
Is this a bug? Or is there a better way to do this?
I would suggest to try using a different strategy in hiding/showing figures:
On parent creation always add the child and mark it as not visible, child.setVisible(false)
Replace all add() and remove() invocation respectively with setVisible(false) and setVisible(true)

Resources