Tracker: Fixed vertical list icon position.

* Instead of drawing it at the bottom of the line, draw it in the
  middle of it.
This commit is contained in:
Axel Dörfler
2015-09-09 21:03:58 +02:00
parent bf5480299e
commit 46dd7d5077
2 changed files with 17 additions and 10 deletions
+15 -10
View File
@@ -524,11 +524,7 @@ BPose::PointInPose(BPoint loc, const BPoseView* poseView, BPoint where,
*hitWidget = NULL; *hitWidget = NULL;
// check intersection with icon // check intersection with icon
BRect rect; BRect rect = _IconRect(poseView, loc);
rect.left = loc.x + kListOffset;
rect.right = rect.left + B_MINI_ICON;
rect.bottom = loc.y + poseView->ListElemHeight();
rect.top = rect.bottom - B_MINI_ICON;
if (rect.Contains(where)) if (rect.Contains(where))
return true; return true;
@@ -572,11 +568,7 @@ BPose::Draw(BRect rect, const BRect& updateRect, BPoseView* poseView,
ModelNodeLazyOpener modelOpener(fModel); ModelNodeLazyOpener modelOpener(fModel);
if (poseView->ViewMode() == kListMode) { if (poseView->ViewMode() == kListMode) {
uint32 size = poseView->IconSizeInt(); BRect iconRect = _IconRect(poseView, rect.LeftTop());
BRect iconRect(rect);
iconRect.left += kListOffset;
iconRect.right = iconRect.left + size;
iconRect.top = iconRect.bottom - size;
if (updateRect.Intersects(iconRect)) { if (updateRect.Intersects(iconRect)) {
iconRect.OffsetBy(offset); iconRect.OffsetBy(offset);
DrawIcon(iconRect.LeftTop(), drawView, poseView->IconSize(), DrawIcon(iconRect.LeftTop(), drawView, poseView->IconSize(),
@@ -992,6 +984,19 @@ BPose::CalcRect(const BPoseView* poseView) const
} }
BRect
BPose::_IconRect(const BPoseView* poseView, BPoint location) const
{
uint32 size = poseView->IconSizeInt();
BRect rect;
rect.left = location.x + kListOffset;
rect.right = rect.left + size;
rect.top = location.y + (poseView->ListElemHeight() - size) / 2.f;
rect.bottom = rect.top + size;
return rect;
}
#if DEBUG #if DEBUG
void void
BPose::PrintToStream() BPose::PrintToStream()
+2
View File
@@ -137,6 +137,8 @@ private:
void EditPreviousNextWidgetCommon(BPoseView* poseView, bool next); void EditPreviousNextWidgetCommon(BPoseView* poseView, bool next);
void CreateWidgets(BPoseView*); void CreateWidgets(BPoseView*);
bool TestLargeIconPixel(BPoint) const; bool TestLargeIconPixel(BPoint) const;
BRect _IconRect(const BPoseView* poseView,
BPoint location) const;
Model* fModel; Model* fModel;
BObjectList<BTextWidget> fWidgetList; BObjectList<BTextWidget> fWidgetList;