From: Marko Luukkainen Date: Wed, 21 Oct 2020 08:46:08 +0000 (+0300) Subject: Scale tooltip font by display DPI. X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F50%2F4550%2F1;p=simantics%2F3d.git Scale tooltip font by display DPI. Dragging or moving pointer out of view clears hover objects. gitlab #142 Change-Id: I68e8f1da87ad9c2a979792bfc14911cc474f6ead --- diff --git a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/awt/vtkCameraAndSelectorAction.java b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/awt/vtkCameraAndSelectorAction.java index 0ce1acd2..eef4e247 100644 --- a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/awt/vtkCameraAndSelectorAction.java +++ b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/awt/vtkCameraAndSelectorAction.java @@ -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 diff --git a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/utils/vtkToolTip.java b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/utils/vtkToolTip.java index e5625746..bb03d3b0 100644 --- a/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/utils/vtkToolTip.java +++ b/org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/utils/vtkToolTip.java @@ -18,6 +18,7 @@ public class vtkToolTip 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 implements RenderListener{ this.frameColor = frameColor; } + public void setFontSize(int fontSize) { + this.fontSize = fontSize; + } + /** * Removes/hides current tooltip. */ @@ -190,6 +195,7 @@ public class vtkToolTip implements RenderListener{ } else { prop.SetFrame(0); } + prop.SetFontSize(view.upscale(fontSize)); prop.Delete(); view.addDeletable(textActor);