Improved detection of hover

- account for presence of fill or outline colors
- allow for a couple of pixels of slop
This commit is contained in:
Jim Evins
2015-09-08 17:53:37 -04:00
parent 81923681b3
commit b12f4a2478
7 changed files with 43 additions and 16 deletions
+9 -6
View File
@@ -905,17 +905,20 @@ namespace glabels
bool LabelModelObject::isLocatedAt( double scale, double x, double y ) const
{
QPointF p( x, y );
p -= QPointF( mX0, mY0 ); // Translate point to x0,y0
QPainterPath objectPath = mMatrix.map( path() );
if ( objectPath.contains( p ) )
/*
* Change point to object relative coordinates
*/
p -= QPointF( mX0, mY0 ); // Translate point to x0,y0
p = mMatrix.inverted().map( p );
if ( hoverPath( scale ).contains( p ) )
{
return true;
}
else if ( mOutline )
else if ( isSelected() && mOutline )
{
QPainterPath outlinePath = mMatrix.map( mOutline->path( scale ) );
if ( outlinePath.contains( p ) )
if ( mOutline->hoverPath( scale ).contains( p ) )
{
return true;
}