I'm trying to use fabricjs!
please see this picture :
first image
I want objects positioned beside of each other, but user can drop them on each other!
second image
How can I solve this?
Related
Here's what I'm trying to achieve :
Here's where I am at :
This is my layout :
I can't figure out how to nest my components so that the ViewList fills all the remaining space ( considering that the Label takes a portion of that Pane ).
I'm asking not only for this particular case, but also in general when I want to fit multiple components in a container. Some components have fixed height/width and some have to fill the remaining space. Is there a strategy or dedicated container for that ?
Ex :
correction : Filling-remaining-space component(s)
Most of the time I just ( thanks god there is something like scene builder ) spam all the options until I figure out how things seem to work.
I also looked at Vgrow and Hgrow properties but it dosen't seem to always work ( or maybe I'm using it the wrong way ).
Thanks for your help !
Try to set vGrow for the SplitPane that contains panes:
VBox.setVgrow(centerSplitPane, Priority.ALWAYS);
How do I set z-index on the shapes that I'm adding to Kinetic.Group? My group contains rectangles and images. I want to do this:
rectangle.setZIndex(1);
image.setZIndex(2);
This gives me the following error: Uncaught TypeError: Cannot read property 'children' of undefined.
I'm using drag and drop and then grouping the objects together. I want the images to be on top of the rectangle. the moveToTop() method gives errors when I call it inside my code.
EDIT :
http://jsfiddle.net/Dcevd/ . Try this use case: drag&drop two rects, then drag the image and drop it on the first rect, then move it to the second one (when you do it inversely it works). it moves to top only on dragend.
Answer to your edit
You are calling moveToTop() on a child of the group, so it will only put the image on the op of that specific group. Once you place the second rectangle on the right stage, it gets a higher z-index then the first one your placed and will therefor be 'on top of' the first rectangle (including it's images). To solve this I've set the parent of the image (the group) to move to top on the dragstart, this fixes it for me:
cloneImg.on('dragstart', function(){
this.startX=this.x();
this.startY=this.y();
this.getParent().moveToTop();
});
See also the fiddle: http://jsfiddle.net/Dcevd/3/
PS. If you look in the KineticJS docs, you see that setZIndex is available on Kinetic images (as with all other Shapes). http://kineticjs.com/docs/Kinetic.Image.html
Is there a way to specify a layout for children of a PolylineConnection?
I want to add several Labels to a PolylineConnection at ConnectionLocator.MIDDLE without the use of a container figure for the labels.
Both PolylineConnection and Label have EditParts, and the label's model objects are children of the polyline connection's model objects.
Ideally I want to add all label children of a polyline to ConnectionLocator.MIDDLE in a ToolbarLayout...
What you are trying to do is mix two layouts: on the first hand you want to use a ConnectionLocator.MIDDLE to locate the figures, but on the other hand you want to have the figures at this location to have their own layout.
The only solution you have is to create a figure that uses a ToolbarLayout and locate it in the Polyline using the ConnectionLocator
I've found a way to achieve what I wanted:
Very generally, the first child must be added at ConnectionLocator.MIDDLE, and the rest of the children relative to the child before them with the help of RelativeLocator like this (line would be in a loop over all figure children in connection's edit part):
figure.add(childFigure,
new RelativeLocator((IFigure) figureChildren.get(currentIndex - 1),
0.5,
1.7);
I've written a blog post with more details.
I have taken the horizontal list view.I am able to display the images in list view.It is displaying all the images horizontally.But my requirement is i need to show only 4 images in a row.If there is 5th image then it should come in the second row(for each row there should me only 4 images).How can i do this.Actually i am struck up here.I think you are able to understand my problem.Thank You.
I am using JavaFX 2.x
As far as I understand, if you need to allocate only 4 images in a row, and the 5th+ images transfer on the next row, you will be able to use a GridPane :
http://docs.oracle.com/javafx/2/layout/builtin_layouts.htm
where you could obviously set position of ImageView. Seems, it works so : you determine your own ListCell, and set its graphic node to be a gridpane, and configure grid pane as you wish.
Also, take a look on a flow pane, possibly, it will help you.
If I'm wrong with a recipe, please, try to describe your trouble again (code/screenshot). I'm not comletely sure about it.
I'm having trouble creating a fluid layout with Vaadin. As I understand it, in order for a container's size to be calculated based on its contents, I have to use the setSizeUndefined() method.
This works fine, but an issue arises when I want to add components wich take up all the available space to this container with undefined size. I cannot get this to work.
Here's a simplified sample of what I'm trying to do:
VerticalLayout layout = new VerticalLayout();
layout.setSizeUndefined();
layout.setMargin(false);
layout.addComponent(createButton("A somewhat longer label"));
layout.addComponent(createButton("Short label"));
private Button createButton(String label) {
Button button = new Button(label);
button.setSizeFull();
button.setWidth("100%");
return button;
}
The buttons do not take up the entire width of the vertical layout container. I have read here and there that one is not allowed to set "100%" sizes inside containers with undefined size, but then how am I supposed to achieve what I want to achieve bearing in mind that I need that undefined size for my fluid layout?
In case someone thinks the undefined size is not necessary for my use case, I'll be happy to provide more information on that. I have a strong Flex background which may cause met to look at this problem from the wrong angle.
You are correct, you cannot use relatively sized components within a VerticalLayout that has an undefined size. The functionality you are looking for exists in an add-on called WeeLayout.