summaryrefslogtreecommitdiff
path: root/src/ui/widget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r--src/ui/widget.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c
index 1b90378a..1ac4326a 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -1430,9 +1430,19 @@ void drawLayerEffects_Widget(const iWidget *d) {
1430 init_Paint(&p); 1430 init_Paint(&p);
1431 p.alpha = 0x50; 1431 p.alpha = 0x50;
1432 if (flags_Widget(d) & (visualOffset_WidgetFlag | dragged_WidgetFlag)) { 1432 if (flags_Widget(d) & (visualOffset_WidgetFlag | dragged_WidgetFlag)) {
1433 const float area = d->rect.size.x * d->rect.size.y; 1433 const float area = d->rect.size.x * d->rect.size.y;
1434 const float rootArea = area_Rect(rect_Root(d->root));
1434 const float visibleArea = area_Rect(intersect_Rect(bounds_Widget(d), rect_Root(d->root))); 1435 const float visibleArea = area_Rect(intersect_Rect(bounds_Widget(d), rect_Root(d->root)));
1435 p.alpha *= (area > 0 ? visibleArea / area : 0.0f); 1436 if (isPortraitPhone_App() && !cmp_String(&d->id, "sidebar")) {
1437 p.alpha *= iClamp(visibleArea / rootArea * 2, 0.0f, 1.0f);
1438 }
1439 else if (area > 0) {
1440 p.alpha *= visibleArea / area;
1441 }
1442 else {
1443 p.alpha = 0;
1444 }
1445 //printf("area:%f visarea:%f alpha:%d\n", rootArea, visibleArea, p.alpha);
1436 } 1446 }
1437 SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND); 1447 SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND);
1438 fillRect_Paint(&p, rect_Root(d->root), backgroundFadeColor_Widget()); 1448 fillRect_Paint(&p, rect_Root(d->root), backgroundFadeColor_Widget());