Why do my group nodes jump to the scene root's origin?

The code for my project is too large to post, so I'll try to explain the problem I'm experiencing. I'm creating a graph layout tool as part of larger visualization tool we are building.
The problem I'm having is a group I have positioned using layoutX, layoutY is jumping to the origin whenever we do the graph layout.
Here is the basic flow of the program:
We create a JUNG graph of Circle(vertex) and Lines(edge)
We use JUNG's layout classes to generate a layout for the graph. The layout generates an x, y position for each vertex in the graph within a defined area. Say a 400 by 400 box.
We use the generated positions to set the centerX, centerY of the circles. The lines are bound to the centres of the nodes they go between, so they update automatically.
This is all done to present the initial graph layout. The user is able to select nodes and choose them to be laid out in a new way. This creates a sublayout on the canvas. When the circles are selected we move them to a group position in the exact spot where they were selected. The groups are made draggable and can be moved around the canvas. The lines update, and the circles do not move relative to their parent group's coordinate system. Only their container is moved around inside sceneRoot.
The scengraph looks like:
VBox
Group:sceneRoot
Circles and Lines making up the original graph
Group: sublayout
The selected Circles and Lines
The problem comes when we try to do the layout of the selected nodes. We generate a JUNG subgraph. Then we do the graph layout with the subgraph to give the circles it contains new positions. We ask the layout to generate a layout the size of sublayout group. This works. JUNG generates new values for the positions of the Circles. When we set the centers of the circles, the group jumps to the upper left hand corner - the sceneRoot's origin. In my understanding, the group shouldn't move at all. It's layoutX,layoutY have been set and the circles are being positioned relative to sublayout's origin. I can't figure out why the group is jumping to the origin. It should be staying in place.

I figured it out!
The problem was using a group as the root of the canvas. A Group's bounds are the sum of its children's bounds. This means that a group's bounds will change depending on what is in it. When the VBox laid it out, it would move because of the new bounding box. The fix was to use a Pane. A Pane resizes according to the pref/min/max rules and does not shrink to be the sum of its children. It is a more "solid" container.

Similar Messages

  • Why does my cursor suddenly jump to the bottom left of my screen?

    Using a Magic Trackpad with a Macbook 5.1 running Snow Leopard.
    Occassionally I'll click and the cursor will suddenly jump to the bottom left of the screen. (Sometimes opening the App Store or flicking to Finder!)
    Anyone got any ideas?

    I've had this problem since I bought it. I use a Mac Pro and the Magic Track Pad has become an $80 coaster. It's erratic and impossible to use for more than a few minutes. Good luck getting an answer, I've been looking for some time and then gave up.

  • Why does switching VoiceOver on jump to the top of a web page? Is there a way to stop that and just stay where you were?

    Please someone tell me why this happens and what I can do to prevent it because it is so annoying to scroll down every time. Thanks!

    You can try it with CTRL+Home to see if that improves matters.
    List of KB shortcuts here: http://www.mozilla.org/docs/end-user/moz_shortcuts.html#help

  • Grouped nodes added to Vbox - Height issue? Bug?

    Maybe you guys could try this out as well? I'm most probably doing something wrong but for demonstrative purposes, I've found an issue with a VBox incorrectly stating its height value when it consists of grouped nodes.
    Take the following for example, albeit simple and incomplete (it's more or less what I've got going on in my code):
         var goupedNodesSequence : Node[];
            for(i in [0..30]){
                //Label
                var myLabel : Label = Label{               
                    textFill: Color.WHITE
                    text: "Lable Number: {i}"
             //Rectangle
                var myRectangle : Rectangle = Rectangle{
                    width: 100
                    height: 25
                    fill: Color.BLUE
             //Grouped label and rectangle
                var nodeGroup : Group = Group{
                    content: [myLabel , myRectangle ]
                insert nodeGroup into goupedNodesSequence
                }//forloop
                //VBox
                def groupedNodesVBox : VBox = VBox {
                        content: goupedNodesSequence
                        spacing: 3       
                }My code is slightly different in that the construction of the groupedNodesSequence is done in a forloop within a function that returns the sequence. The sequence of nodes is then assigned to the VBox.content property.
    I've noticed that visually, it looks correct in that each node, within the VBox, is a rectangle with a label on top of it. This is fine. But when you want to know the height property of the VBox node, it seems to be overstated in that it appears to add the height of all nodes including spacing (approximately anyway) to the total height of the VBox.
    I've even tried to use the Stack feature to place the nodes in a stack formation and messed around with the X/Y translations and layout features but a no go.
    I wonder if this has anything to do with the "bug" some people (PhiLHo ?) have encountered with using VBoxes and Scrollbars and getting incorrect Scroller max values possibly due to this incorrect height reading of the VBox? Check out PhiLHo's response to this thread to know what I'm talking about over here
    I simply compensated the incorrect height difference in my code as it was more efficient for me, but I thought I'd bring this up for discussion and see if anyone else is having the same issue.
    Essentially, put a few nodes together and group them, then add the group node to another sequence, and place that sequence of grouped nodes into a VBox. See what kind of height you're getting for the VBox.

    For me, the VBox height comes out to 865, which I think is correct. You have 31 groups in the VBox, and each group has a rect that's 25 tall. Add to this the 30 inter-item spacings of 3 gives: 31 x 25 + 30 x 3 = 865. [Edited to avoid confusion between the arithmetic expression and forum markup.]
    But if you look at the heights of each of the nodes, it's something of a puzzle. The height of each Label is 14, the height of each rect is 25, and the height of each nodeGroup (each contains a label and a rect) is 36. Huh??? How can this be if the label overlaps the rect? (I puzzled over this for a bit as well.)
    At issue is how you're finding the height of each item. If you use boundsInLocal or boundsInParent, you get the heights I listed above. If you look at the actual boundsInParent of each label and rect, though, you'll notice something odd: the boundsInParent of Label are something like:
    BoundingBox [minX = -1.0, minY=-11.0, maxX=97.0, maxY=3.0, width=98.0, height=14.0]
    So the bounds of the Label are mostly above the origin, and the bounds of the Rectangle extends below the origin. That's why, when you throw them into a Group, the height of the Group is almost the sum of the two heights, even though visually the Label and the Rectangle overlap.
    You might ask why the bounds of the Label extend above the actual label text. Well, that might be a bug. I'll investigate it. If you look at the layoutBounds of a Label, it makes more sense.
    Meanwhile, a great explanation of the various JavaFX bounds can be found on [Amy Fowler's blog|http://weblogs.java.net/blog/2009/07/09/javafx12-understanding-bounds].
    Edited by: smarks on Jan 5, 2010 3:31 PM

  • Why does my cursor keep jumping around

    Why does my cursor keep jumping around the page when I'm in mail or searching with firefox.  Aslo, sometimes my page minimizes for no reason and new pages open. This has started since upgrading to OS X
    wl

    Post in the Microsoft Word for Mac forums. 

  • Why won't AI let me drag the selection icon into a Live Paint group?

    I routinely add paths to existing Live Paint Groups, by dragging a path that is outside the group, into the LP group. But AI won't let me drag the "selection icon" from a nested layer, into an existing LP Group. Why?
    It seems I'm requesting the same action, but AI won't allow the icon to be dragged into the group. I have to either open the layer and drag the objects directly, or drag the objects into the main layer, then into the Live Paint Group. I think this is an interface flaw. Does anyone follow me and have an observation?
    FYI… I realize I could jump into the Live Paint Group using Isolation mode, but that takes extra steps and makes the template less useful.

    Live Paint groups can't contain sublayers. When attempting to drag a layer/sub-layer into a Live Paint group you are attempting to add a sub-layer, which Live Paint does not support.
    You can drag individual objects into the Live Paint group because they are objects, not layers.
    The "Layers" panel is somewhat of a misnomer, it's actually a "Layers and Objects" panel and each will have it's own restrictions.

  • I have only recently got my iphone, and the screen won't rotate in Safari or messaging. It works fine in games (eg Doodle Jump). The screen portrait lock is off, and i have tried turning it on and off and updating it. Why wont it rotate?

    I have only recently got my iphone, and the screen won't rotate in Safari, the ipod, photos or messaging. It works fine in games (eg Doodle Jump). The screen portrait lock is off, and i have tried turning it on and off and updating it. Why wont it rotate?

    Next step is to Restore it in iTunes from your backup. If that does not work they try Restoring it as a new phone. If still no go it is a hardware failure and you will need to get it serviced.
    And you are not showing the hardware lock icon on the top right of the home screen?

  • Why does firefox jump to the front after i hide it in mac os x lion?

    Just installed Lion a week ago and ever since, when i have firefox open and i hide it to do something else, every 40 seconds or so Firefox automatically jumps to the front in finder no matter what i am doing.
    It is really annoying.
    Anyone know why this is happening and how to fix it?
    Thanks,
    Gary

    Try to run Disk Utility and repaired disk permissions.
    http://support.apple.com/kb/HT2963?viewlocale=en_US
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • I can't sent an email to a large group of people. The sending email surface on every time I turn on my computer MAC PRO. How can I delete it? Why it happens? How to prevent it to happen again? Thank you. Danielson

    I can't sent an email to a large group of people. The sending email surface on every time I turn on my computer MAC PRO. How can I delete it? Why it happens? How to prevent it to happen again? Thank you. Danielson (Danicolenira)

    What do yo mean by " The sending email surface on every time"?

  • In imovie 11, with an iMac, latest Mountain Lion, sometimes I insert a still and when I playback, the previous image freezes the last frame and holds during the duration I set for the still, skips both transitions, and jumps to the next clip. why?

    in imovie 11, with an iMac, latest Mountain Lion, sometimes I insert a still and when I playback, the previous image freezes the last frame and holds during the duration I set for the still, skips both transitions, and jumps to the next clip. why?

    in imovie 11, with an iMac, latest Mountain Lion, sometimes I insert a still and when I playback, the previous image freezes the last frame and holds during the duration I set for the still, skips both transitions, and jumps to the next clip. why?

  • Why does the cursor jump from the Name box to the password box when logging in to Gmail?

    When logging in to Gmail, I often (8/10) times find that while I am still typing the username, the cursor has jumped to the password box. The result is that part of the username is typed into the password box. I then have to click back onto the username box and re-enter the username.

    Yes, this is very annoying!
    I suspect a timing issue, that is, Google's scripts are still running for a while after the page is displayed and when the scripts see a non-blank value in the username, they moves the focus to the password ''even if you are in the midst of typing''.
    If I wait a few seconds before I start typing in the username field, there's no problem. (I haven't experimented with the amount of time.)

  • Why does the DLL function executed by call library node fail when the Vi is re-opened?

    Development System
    OS: Windows XP
    LabVIEW: version 10.0
    DLL: Custom 
    Compiler: Visual C++ 6.0
    Function Prototype: __declspec(dllexport) const char * test(void)
    We have developed a DLL for use.  The DLL compiles cleanly.  The DLL includes a function test.  The test function validates the functional capabilities of the DLL.  I have followed the examples online, and I have used the import shared library tool in LabVIEW.  The VIs created use the call library node. 
    When I create a VI calling the test function from the custom DLL using the call library node the VI executes the DLL function test flawlessly.  I close the VI.  When I re-open the VI and run it, I get an error code from the DLL.  However, if I go to the block diagram and set the path for the DLL in the configure call library node again then the VI executes the DLL function test flawlessly again. 
    I have to set the path for the DLL in the configure call library node every time I open the VI.  The examples I downloaded from the community do not require this.  What might the DLL be missing?  What am I missing? 
    Solved!
    Go to Solution.

    I think it was rather unfair of me to ask for help with my DLL issue without disclosing more detailed information.  As a corrective action, I have attached a zipped file.  The zipped file contains the entire VC++ 6.0 project for compiling the DLL, the DLL, and the VI I have been using to test it. 
    ###NOTE####
     As a prerequisite to compilation and usage of the DLL you'll need to have installed Python 26 on your system.   
    You may obtain the MSI for correct version of Python from the following location:
    http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi
    ###NOTE###
    Thank you very kindly for any assistance offered!
    Thanks,
    Bill
    Attachments:
    C_DLL_PYTHON_AND_LABVIEW2010.zip ‏1685 KB

  • Why is the head jumping around the body?

    I wrote the following code for Head which should follow the body like a spring. I added friction so the head will stop bouncing sometime but no success. The head keeps jumping near the beggining of the spring (which is the beggining of the body) and not stopping. What should I do to make the head stop at some time?
      final static int MASS = 10;
      final static int FRICTION = 100;
      private final double hardness = 3;
    public void followBody(Body body) {
    double[] coards = getCoardinatesBy(getRadius(), body.getXCoardStart(), body.getYCoardStart(), 180+body.getAngel()); // get the coordinates of the beginning of the spring (where should the head be in the end
            coards[0] -= getRadius();
            coards[1] -= getRadius();
            if (getYSpeed() < 0) {
                this.setYAcceleration((getYForce(coards[1]) + FRICTION)/MASS);
            } else if (getYSpeed() > 0) {
                this.setYAcceleration((getYForce(coards[1]) - FRICTION)/MASS);
            } else if (Math.abs(getYForce(coards[1])) < FRICTION ) { //static friction, equal to the power or less
                this.setYAcceleration(0);
            } else {
                this.setYAcceleration(getYForce(coards[1]) / MASS); // speed is zero. new the head is far away from the spring
            if (getXSpeed() < 0) {
                this.setXAcceleration((getXForce(coards[0]) + FRICTION)/MASS);
            } else if (getXSpeed() > 0) {
                this.setXAcceleration((getXForce(coards[0]) - FRICTION)/MASS);
            } else if (Math.abs(getXForce(coards[0])) < FRICTION) { // static friction, equal to the power or less
                this.setXAcceleration(0);
            } else {
                this.setXAcceleration(getXForce(coards[0]) / MASS); // speed is zero. new the head is far away from the spring
       double getYForce(double y){
            return hardness*(y-yCoardStart);
        double getXForce(double x){
            return hardness*(x-xCoardStart);
    static double[] getCoardinatesBy(double height, double startX, double startY, double angel) {
            double[] coardinates = new double[2];
            coardinates[1] = startY - (height * Math.sin((Math.toRadians(angel))));
            coardinates[0] = startX + (height * Math.cos(Math.toRadians(angel)));
            return coardinates;
      public void update() {
            xSpeed += xAcc;
            ySpeed += yAcc;
            xCoardStart += xSpeed;
            xCoardEnd += xSpeed;
            yCoardEnd += ySpeed;
            yCoardStart += ySpeed;
            angularVelocity+=angularAcc;
            this.angel += angularVelocity;
            autoSetEndXY();
    private void autoSetEndXY() {
            double[] coards = getCoardinatesBy(height, xCoardStart, yCoardStart, angel);
            yCoardEnd = coards[1];
            xCoardEnd = coards[0];
        }Edited by: Vitali.pom on May 20, 2012 6:01 AM
    Edited by: Vitali.pom on May 29, 2012 12:19 AM
    Edited by: Vitali.pom on Jun 26, 2012 12:05 PM

    Thanks for the try. That's what I tried:
    public void followBodyPart(BodyPart body) {
            double[] coards = getCoardinatesBy(getRadius(), body.getXCoardStart(), body.getYCoardStart(), 180+body.getAngel());
            coards[0] -= getRadius();
            coards[1] -= getRadius();
           if (getYSpeed() < 0) {
                this.setYAcceleration((getYForce(coards[1]) + FRICTION)/MASS);
            } else if (getYSpeed() > 0) {
                this.setYAcceleration((getYForce(coards[1]) - FRICTION)/MASS);
                System.out.println("Player moved.");
            } else if (Math.abs(getYForce(coards[1])) < FRICTION) {
                this.setYAcceleration(0);
                System.out.println("y force is 0.");
            } else {
                this.setYAcceleration((getYForce(coards[1]))/ MASS);
            if (getXSpeed() < 0) {
                this.setXAcceleration((getXForce(coards[0]) + FRICTION)/MASS);
            } else if (getXSpeed() > 0) {
                this.setXAcceleration((getXForce(coards[0]) - FRICTION)/MASS);
                System.out.println("Player moved.");
            } else if (Math.abs(getXForce(coards[0])) < FRICTION) {
                this.setXAcceleration(0);
                System.out.println("x force is 0.");
            } else {
                this.setXAcceleration((getXForce(coards[0]))/ MASS);
        }And that's what I got (repeating in the end):
    Player moved.
    y force is 0.
    y force is 0.
    Player moved.
    y force is 0.
    y force is 0.
    Player moved.
    y force is 0.
    Player moved.
    Player moved.
    Player moved.
    Player moved.
    Player moved.
    Edited by: Vitali.pom on Jun 16, 2012 3:54 AM

  • My Firefox has JUST started jumping to the BOTTOM of a web page when I hit either the Page Down key or the Down Arrow, WHY?!?

    I am running Windows Vista Home Premium, Service Pack 2. Today my Firefox started jumping to the BOTTOM of a websites page INSTEAD of going down one screen at a time like the Page Down key has been doing (on any browser I have ever used).

    You may have switched on caret browsing.
    * http://kb.mozillazine.org/accessibility.browsewithcaret
    You can press press F7 (on Mac: fn + F7) to toggle caret browsing on/off.
    * Tools > Options > Advanced : General: Accessibility: [ ] "Always use the cursor keys to navigate within pages"
    * http://kb.mozillazine.org/Scrolling_with_arrow_keys_no_longer_works
    * http://kb.mozillazine.org/Accessibility_features_of_Firefox

  • Why does my trackpad start jumping all over the place when I plug in my charger?

    It's fine when it's unplugged but becomes unresponsive and juddery sporadically during charge. If I click it just jumps across the screen! Really odd.

    A fairly well known flaw that occurs to some trackpads. See here: http://support.apple.com/kb/TS1449

Maybe you are looking for

  • InDesign CS6 Linked Word file issue

    Hi, I have a number of 100+ page InDesign files which have a large (linked) Word file that threads though multiple text boxes throughout all of the document pages. The files need to be shared amongst multiple computers within our studio. This setup w

  • Trouble viewing PDF documents on iPad

    I have transferred a lot of PDF documents to my iPad, and I am able to read most of them using iBooks. However, some of my documents contains just blank pages when I open them in iBooks after transferring them from iTunes to the iPad. Any suggestions

  • I have two birthday reminders for single contacts?

    Firstly, I apologise if this has been asked elsewhere but it was proving difficult to search through all the other threads. Ok so for some reason i've got two different birthday reminders for some contacts. I'm using Windows Live Mail and I synced al

  • Restrict Sales Order Visibility

    Hi all, We have 2 Operating Units under one Ledger. Sales order created in OU1 can be viewed across OU2. Similar case for an AR invoice as well. Is this is standard functionality (or) is there any setup to be done to have a control over that. we are

  • Problem after updating to ios 6.1

    Hi, I updated my iPhone 4 to ios 6.1 and lost all my contacts, text messages and most importantly my photos. I did the backup just before upgrading and now when I restore it back, it turns out to be like a new phone.How to get back photos and text me