]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/awt/vtkCameraAndSelectorAction.java
Scale tooltip font by display DPI.
[simantics/3d.git] / org.simantics.g3d.vtk / src / org / simantics / g3d / vtk / awt / vtkCameraAndSelectorAction.java
index 26d6843b19ca7725154c25929a139f6ef1159429..eef4e2478fa545ed611fbb4e0bcdc2381fed2bcc 100644 (file)
@@ -17,6 +17,8 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import javax.vecmath.Point2d;
+import javax.vecmath.Point2i;
 import javax.vecmath.Point3d;
 
 import org.eclipse.jface.viewers.ISelection;
@@ -194,6 +196,10 @@ public class vtkCameraAndSelectorAction extends vtkAwtAction implements ISelecti
                                resetCameraClippingRange();
                        }
                }
+               if (hoverActor.size() > 0) {
+                       hoverActor.clear();
+                       fireHoverChanged();
+               }
                lastX = x;
                lastY = y;
                panel.Render();
@@ -209,6 +215,8 @@ public class vtkCameraAndSelectorAction extends vtkAwtAction implements ISelecti
                                return;
                        if (e.getButton() != MouseEvent.BUTTON1)
                                return;
+                       lastX = e.getX();
+                       lastY = e.getY();
                        vtkProp spick[] = panel.pick(e.getX(), e.getY());
                        if (spick != null && spick.length > 0) {
                                for (vtkProp selectActor : spick) {
@@ -291,6 +299,30 @@ public class vtkCameraAndSelectorAction extends vtkAwtAction implements ISelecti
                        }
                }
                
+               @Override
+               public void mouseExited(MouseEvent e) {
+                       if (hoverActor.size() > 0) {
+                               hoverActor.clear();
+                               fireHoverChanged();
+                       }
+               }
+               
+               /**
+                * Returns mouse position in AWT screen coordinates. 
+                * @return
+                */
+               public Point2i getMousePositionAWT() {
+                       return new Point2i(lastX, lastY);
+               }
+               
+               /**
+                * Returns mouse position in VTK screen coordinates. 
+                * @return
+                */
+               public Point2d getMousePosition() {
+                       return new Point2d(lastX, rw.GetSize()[1]-lastY);
+               }
+               
                public List<vtkProp> getSelectActor() {
                        return selectActors;
                }