Page 1 of 1

Graph panel ingores rotate (shift + mouse drag)

PostPosted: Fri Mar 13, 2015 9:19 pm
by mordenkainen
I was working with a graph panel. There were some input, switching between modes, adding and collapsing nodes and so on. And suddenly the panel started to ignore shift + mouse drag event. Drag without shift works normally - the graph is moved. But when I try to rotate it with shift + mouse drag nothing happens. And plenty of stack traces is written to the stderr. They all are identical and complains about Null Pointer Exception.
Code: Select all
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
   at org.wandora.application.gui.topicpanels.graphpanel.mousetools.RotateMouseTool.mouseDragged(RotateMouseTool.java:73)
   at org.wandora.application.gui.topicpanels.graphpanel.MouseToolManager.dispatchEvent(MouseToolManager.java:138)
   at org.wandora.application.gui.topicpanels.graphpanel.MouseToolManager.processEvent(MouseToolManager.java:151)
   at org.wandora.application.gui.topicpanels.graphpanel.MouseToolManager.mouseDragged(MouseToolManager.java:198)
   at org.wandora.application.gui.topicpanels.graphpanel.TopicMapGraphPanel.mouseDragged(TopicMapGraphPanel.java:1215)
   at java.awt.Component.processMouseMotionEvent(Component.java:6564)
   at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3330)
   at java.awt.Component.processEvent(Component.java:6285)
   at java.awt.Container.processEvent(Container.java:2229)
   at java.awt.Component.dispatchEventImpl(Component.java:4872)
   at java.awt.Container.dispatchEventImpl(Container.java:2287)
   at java.awt.Component.dispatchEvent(Component.java:4698)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4509)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
   at java.awt.Container.dispatchEventImpl(Container.java:2273)
   at java.awt.Window.dispatchEventImpl(Window.java:2719)
   at java.awt.Component.dispatchEvent(Component.java:4698)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:740)
   at java.awt.EventQueue.access$300(EventQueue.java:103)
   at java.awt.EventQueue$3.run(EventQueue.java:699)
   at java.awt.EventQueue$3.run(EventQueue.java:697)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
   at java.awt.EventQueue$4.run(EventQueue.java:713)
   at java.awt.EventQueue$4.run(EventQueue.java:711)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:710)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)   

I could not reproduce this behabior. Newly created graph panels works normally.

Re: Graph panel ingores rotate (shift + mouse drag)

PostPosted: Sat Mar 14, 2015 12:57 am
by akivela
Thanks Mordenkainen. This was a real bug and easily reproduced. Graph rotation used the current topic as a rotation center. If the node for the current topic is closed, there is no rotation center and the rotation fails as you reported.

I have committed a bug fix to Github (https://github.com/wandora-team/wandora/commit/f6ec0ea22fb28f912aae683071e9ff01b2194298) that resolves the rotation center using three steps. First, rotation center is the node of current topic if it is available. If there is no node for the current topic the rotation center is one of the selected topics. And finally, if there is no nodes selected the rotation center is graph panel's center. After these steps, the rotation center should never be null.

Again, thanks for reporting the bug.

Kind Regards,
Aki / Wandora Team