Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic make a newly created node selected (Read 2751 times)
hans
Junior Member
**
Offline


I Love MindFusion!

Posts: 81
Location: Netherlands
Joined: Mar 17th, 2012
make a newly created node selected
Dec 16th, 2012 at 10:12am
Print Post  
When I create a shapenode by this javascript, the newly creatred node doesn't get selected.
Instead the created link is always selected.
Is there a way to get around?
I also tried: destNode.setSelected(true), but without success.

function onLinkCreated(diagram, args) {
    // get info about the DiagramLink just created
    var link = args.getLink();
    var points = link.getControlPoints();
    var destPoint = points.get(points.size() - 1);
    var orgNode = link.getOrigin();
    var dest = link.getDestination();
    var destNode;
    if (!dest.getClass().toString().match("ShapeNode")) {
        // create a new ShapeNode
        destNode = diagram1.getFactory().createShapeNode(destPoint.getX(), destPoint.getY(), 50, 6);
    }

    diagram1.getSelection().clear();
    diagram1.getSelection().addItem(destNode);
}
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: make a newly created node selected
Reply #1 - Dec 17th, 2012 at 7:20am
Print Post  
Are you using the JDiagram's Java applet? In such case, try disabling the SelectAfterCreate property, or otherwise the applet will automatically select newly created items after raising their created event. At this time items are not automatically selected in our JavaScript diagramming library.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
hans
Junior Member
**
Offline


I Love MindFusion!

Posts: 81
Location: Netherlands
Joined: Mar 17th, 2012
Re: make a newly created node selected
Reply #2 - Dec 18th, 2012 at 9:19am
Print Post  
Thanks Stoyan,
This helped.
Hans
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint