JGraphX: How can I get a vertex by mouse coordinates? (mouseMoved method) -
i have mousemoved(mouseevent e) method coordinates e.getx() , e.gety(). want check if mouse on vertex. there way this?
i don't want check if cell (vertex) selected, want check if mouse on 1 vertex.
mgraph = new mxgraph(); // create vertexes ... mgraphcomponent = new mxgraphcomponent(mgraph); //mgraphcomponent.getgraphcontrol().addmousemotionlistener(new mouseadapter() { mgraphcomponent.getgraphcontrol().addmousemotionlistener(new mxmouseadapter() { @override public void mousemoved(mouseevent e) { system.out.println(integer.tostring(e.getx()) + " " + integer.tostring(e.gety())); // here want check if mouse position on cell // want check if mouse on 1 (or more?) cells } } ); mpanel.add(mgraphcomponent);
you can so:
object cell = mgraphcomponent.getcellat(e.getx(), e.gety(), false);
cell should mxcell
, can use model.isvertex()
or model.isedge()
.
Comments
Post a Comment