]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Scale tooltip font by display DPI. 50/4550/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 21 Oct 2020 08:46:08 +0000 (11:46 +0300)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 21 Oct 2020 08:46:08 +0000 (11:46 +0300)
Dragging or moving pointer out of view clears hover objects.

gitlab #142

Change-Id: I68e8f1da87ad9c2a979792bfc14911cc474f6ead

org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/awt/vtkCameraAndSelectorAction.java
org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/utils/vtkToolTip.java

index 0ce1acd2b69de2f631ce20f1a77d253795ed5102..eef4e2478fa545ed611fbb4e0bcdc2381fed2bcc 100644 (file)
@@ -196,6 +196,10 @@ public class vtkCameraAndSelectorAction extends vtkAwtAction implements ISelecti
                                resetCameraClippingRange();
                        }
                }
+               if (hoverActor.size() > 0) {
+                       hoverActor.clear();
+                       fireHoverChanged();
+               }
                lastX = x;
                lastY = y;
                panel.Render();
@@ -295,6 +299,14 @@ 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
index e5625746997581b87ab77ba8603be596846ccb2c..bb03d3b085ae947fe9d53ebe0d001268228d98c1 100644 (file)
@@ -18,6 +18,7 @@ public class vtkToolTip<T> implements RenderListener{
        double backgroundOpacity = 0.8;
        double color[] = new double[] {0.0,0.0,0.0};
        double frameColor[] = new double[] {0.0,0.0,0.0};
+       int fontSize = 12;
        
        T obj = null;
        Point3d pos3d;
@@ -80,6 +81,10 @@ public class vtkToolTip<T> implements RenderListener{
                this.frameColor = frameColor;
        }
        
+       public void setFontSize(int fontSize) {
+               this.fontSize = fontSize;
+       }
+       
        /**
         * Removes/hides current tooltip.
         */
@@ -190,6 +195,7 @@ public class vtkToolTip<T> implements RenderListener{
                        } else {
                                prop.SetFrame(0);
                        }
+                       prop.SetFontSize(view.upscale(fontSize));
                        
                        prop.Delete();
                        view.addDeletable(textActor);