changeset 1273:61418c112281

Adjust y-coord of text labels to accommodate larger scaled fonts
author Chris Cannam
date Tue, 24 Apr 2018 10:15:54 +0100
parents 0ded54e94332
children 97d977091d4e
files layer/TimeInstantLayer.cpp view/View.cpp view/ViewManager.cpp
diffstat 3 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/layer/TimeInstantLayer.cpp	Mon Apr 23 16:06:27 2018 +0100
+++ b/layer/TimeInstantLayer.cpp	Tue Apr 24 10:15:54 2018 +0100
@@ -458,8 +458,10 @@
             }
 
             if (good) {
-                PaintAssistant::drawVisibleText(v, paint, x + iw + 2, textY, p.label, PaintAssistant::OutlinedText);
-//                paint.drawText(x + iw + 2, textY, p.label);
+                PaintAssistant::drawVisibleText(v, paint,
+                                                x + iw + 2, textY,
+                                                p.label,
+                                                PaintAssistant::OutlinedText);
             }
         }
 
--- a/view/View.cpp	Mon Apr 23 16:06:27 2018 +0100
+++ b/view/View.cpp	Tue Apr 24 10:15:54 2018 +0100
@@ -236,11 +236,11 @@
         }
     }
 
-    int y = 15 + paint.fontMetrics().ascent();
+    int y = ViewManager::scalePixelSize(15) + paint.fontMetrics().ascent();
 
     for (std::map<int, Layer *>::const_iterator i = sortedLayers.begin();
          i != sortedLayers.end(); ++i) {
-        if (i->second == layer) return y;
+        if (i->second == layer) break;
         y += paint.fontMetrics().height();
     }
 
--- a/view/ViewManager.cpp	Mon Apr 23 16:06:27 2018 +0100
+++ b/view/ViewManager.cpp	Tue Apr 24 10:15:54 2018 +0100
@@ -810,7 +810,7 @@
     }
 
     int scaled = int(pixels * ratio + 0.5);
-//    cerr << "scaledSize: " << pixels << " -> " << scaled << " at ratio " << ratio << endl;
+//    SVDEBUG << "scaledSize: " << pixels << " -> " << scaled << " at ratio " << ratio << endl;
     if (pixels != 0 && scaled == 0) scaled = 1;
     return scaled;
 }