Tracker: Make drag fade rect a bit bigger and compose it

Change-Id: I2bfa9b5416cced7627f87613180c6b7c192be0d2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9013
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
John Scipione
2025-02-19 22:05:05 +00:00
committed by waddlesplash
parent c24d316399
commit 40bb2f8c9f
+23 -15
View File
@@ -135,7 +135,8 @@ enum {
kInsertAfter kInsertAfter
}; };
const BPoint kTransparentDragThreshold(256, 192); const BPoint kTransparentDragThreshold(be_control_look->ComposeIconSize(256).Width(),
be_control_look->ComposeIconSize(192).Width());
// maximum size of the transparent drag bitmap, use a drag rect // maximum size of the transparent drag bitmap, use a drag rect
// if larger in any direction // if larger in any direction
@@ -7578,6 +7579,9 @@ BPoseView::MakeDragBitmap(BRect dragRect, BPoint where, int32 poseIndex, BPoint&
inner = inner & dragRect; inner = inner & dragRect;
float fadeWidth = be_control_look->ComposeIconSize(64).Width();
// not an icon but make this bigger based on font-size
// If the selection is bigger than the specified limit, the // If the selection is bigger than the specified limit, the
// contents will fade out when they come near the borders // contents will fade out when they come near the borders
bool fadeTop = false; bool fadeTop = false;
@@ -7586,19 +7590,19 @@ BPoseView::MakeDragBitmap(BRect dragRect, BPoint where, int32 poseIndex, BPoint&
bool fadeRight = false; bool fadeRight = false;
bool fade = false; bool fade = false;
if (inner.left > dragRect.left) { if (inner.left > dragRect.left) {
inner.left = std::max(inner.left - 32, dragRect.left); inner.left = std::max(inner.left - fadeWidth, dragRect.left);
fade = fadeLeft = true; fade = fadeLeft = true;
} }
if (inner.right < dragRect.right) { if (inner.right < dragRect.right) {
inner.right = std::min(inner.right + 32, dragRect.right); inner.right = std::min(inner.right + fadeWidth, dragRect.right);
fade = fadeRight = true; fade = fadeRight = true;
} }
if (inner.top > dragRect.top) { if (inner.top > dragRect.top) {
inner.top = std::max(inner.top - 32, dragRect.top); inner.top = std::max(inner.top - fadeWidth, dragRect.top);
fade = fadeTop = true; fade = fadeTop = true;
} }
if (inner.bottom < dragRect.bottom) { if (inner.bottom < dragRect.bottom) {
inner.bottom = std::min(inner.bottom + 32, dragRect.bottom); inner.bottom = std::min(inner.bottom + fadeWidth, dragRect.bottom);
fade = fadeBottom = true; fade = fadeBottom = true;
} }
@@ -7665,20 +7669,24 @@ BPoseView::MakeDragBitmap(BRect dragRect, BPoint where, int32 poseIndex, BPoint&
uint32* bits = (uint32*)bitmap->Bits(); uint32* bits = (uint32*)bitmap->Bits();
int32 width = bitmap->BytesPerRow() / 4; int32 width = bitmap->BytesPerRow() / 4;
if (fadeLeft) if (fadeLeft) {
FadeRGBA32Horizontal(bits, width, int32(rect.bottom), 0, 64); FadeRGBA32Horizontal(bits, width, int32(rect.bottom), 0,
bitmap->Bounds().IntegerWidth());
if (fadeRight) {
FadeRGBA32Horizontal(bits, width, int32(rect.bottom),
int32(rect.right), int32(rect.right) - 64);
} }
if (fadeTop) if (fadeRight) {
FadeRGBA32Vertical(bits, width, int32(rect.bottom), 0, 64); FadeRGBA32Horizontal(bits, width, int32(rect.bottom), int32(rect.right),
int32(rect.right) - bitmap->Bounds().IntegerWidth());
}
if (fadeTop) {
FadeRGBA32Vertical(bits, width, int32(rect.bottom), 0,
bitmap->Bounds().IntegerHeight());
}
if (fadeBottom) { if (fadeBottom) {
FadeRGBA32Vertical(bits, width, int32(rect.bottom), FadeRGBA32Vertical(bits, width, int32(rect.bottom), int32(rect.bottom),
int32(rect.bottom), int32(rect.bottom) - 64); int32(rect.bottom) - bitmap->Bounds().IntegerHeight());
} }
} }