[Kstars-devel] KDE/kdeedu/kstars/kstars

James Bowlin bowlin at mindspring.com
Thu Aug 16 21:33:25 CEST 2007


SVN commit 700920 by jbowlin:

Am now drawing a filled rectangle behind all transient labels instead
of just the stars.  The old way is sometimes more esthetically appealing
but the new way ensures that the transient labels are always legible.

Also decreased zoomed-out maxrad from 12.5 degrees to 5.0 degrees when
finding the object closest to a mouse-clicked point.  This made little
difference before the index but now we save time by keeping that area
smaller.  Five degrees seems like plenty.  If this causes misses when
we zoom in then I can change it so maxrad maxes out at 5.0.

CCMAIL: kstars-devel at kde.org


 M  +1 -1      skymapevents.cpp  
 M  +8 -0      skyobject.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skymapevents.cpp #700919:700920
@@ -656,7 +656,7 @@
 		setClickedPoint( mousePoint() );
 
 		//Find object nearest to clickedPoint()
-		double maxrad = 2500.0/Options::zoomFactor();
+		double maxrad = 1000.0/Options::zoomFactor();
 		setClickedObject( data->skyComposite()->objectNearest( clickedPoint(), maxrad ) );
 
 		if ( clickedObject() ) {
--- trunk/KDE/kdeedu/kstars/kstars/skyobject.cpp #700919:700920
@@ -24,6 +24,7 @@
 #include <QPainter>
 #include <QTextStream>
 #include <QFile>
+#include <QFontMetricsF>
 
 #include "starobject.h" //needed in saveUserLog()
 #include "ksnumbers.h"
@@ -426,6 +427,13 @@
 	QFont stdFont( psky.font() );
     SkyLabeler::SetZoomFont( psky );
 	double offset = labelOffset( scale );
+
+	QFontMetricsF fm = SkyLabeler::Instance()->fontMetrics();
+	qreal width = fm.width( translatedName() );
+	qreal height = fm.height();
+	QColor color( KStarsData::Instance()->colorScheme()->colorNamed( "SkyColor" ) );
+	psky.fillRect( QRectF( x+offset, y+offset - height * 0.7, width, height ), QBrush( color ) );
+
 	if ( Options::useAntialias() )
 		psky.drawText( QPointF(x+offset, y+offset), translatedName() );
 	else


More information about the Kstars-devel mailing list