(XMB) Do not animate offscreen items in xmb_selection_pointer_changed()

This commit is contained in:
Higor Eurípedes 2015-06-23 11:38:51 -03:00
parent f167a416f1
commit 6d726e9247
1 changed files with 27 additions and 14 deletions

View File

@ -583,7 +583,8 @@ static void xmb_update_boxart(xmb_handle_t *xmb, unsigned i)
static void xmb_selection_pointer_changed(void) static void xmb_selection_pointer_changed(void)
{ {
unsigned i, current, end, tag; unsigned i, current, end, tag, height;
int threshold = 0;
xmb_handle_t *xmb = NULL; xmb_handle_t *xmb = NULL;
menu_handle_t *menu = menu_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr();
menu_display_t *disp = menu_display_get_ptr(); menu_display_t *disp = menu_display_get_ptr();
@ -599,16 +600,18 @@ static void xmb_selection_pointer_changed(void)
if (!xmb) if (!xmb)
return; return;
current = nav->selection_ptr; current = nav->selection_ptr;
end = menu_entries_get_end(); end = menu_entries_get_end();
tag = (uintptr_t)menu_list;
threshold = xmb->icon.size*10;
tag = (uintptr_t)menu_list; video_driver_get_size(NULL, &height);
menu_animation_kill_by_tag(disp->animation, tag); menu_animation_kill_by_tag(disp->animation, tag);
for (i = 0; i < end; i++) for (i = 0; i < end; i++)
{ {
float iy; float iy, real_iy;
float ia = xmb->item.passive.alpha; float ia = xmb->item.passive.alpha;
float iz = xmb->item.passive.zoom; float iz = xmb->item.passive.zoom;
xmb_node_t *node = (xmb_node_t*)menu_list_get_userdata_at_offset( xmb_node_t *node = (xmb_node_t*)menu_list_get_userdata_at_offset(
@ -617,7 +620,8 @@ static void xmb_selection_pointer_changed(void)
if (!node) if (!node)
continue; continue;
iy = xmb_item_y(xmb, i, current); iy = xmb_item_y(xmb, i, current);
real_iy = iy + xmb->margins.screen.top;
if (i == current) if (i == current)
{ {
@ -628,14 +632,23 @@ static void xmb_selection_pointer_changed(void)
xmb_update_boxart(xmb, i); xmb_update_boxart(xmb, i);
} }
menu_animation_push(disp->animation, if (real_iy < -threshold || real_iy > height+threshold)
XMB_DELAY, ia, &node->alpha, EASING_IN_OUT_QUAD, tag, NULL); {
menu_animation_push(disp->animation, node->alpha = node->label_alpha = ia;
XMB_DELAY, ia, &node->label_alpha, EASING_IN_OUT_QUAD, tag, NULL); node->y = iy;
menu_animation_push(disp->animation, node->zoom = iz;
XMB_DELAY, iz, &node->zoom, EASING_IN_OUT_QUAD, tag, NULL); }
menu_animation_push(disp->animation, else
XMB_DELAY, iy, &node->y, EASING_IN_OUT_QUAD, tag, NULL); {
menu_animation_push(disp->animation,
XMB_DELAY, ia, &node->alpha, EASING_IN_OUT_QUAD, tag, NULL);
menu_animation_push(disp->animation,
XMB_DELAY, ia, &node->label_alpha, EASING_IN_OUT_QUAD, tag, NULL);
menu_animation_push(disp->animation,
XMB_DELAY, iz, &node->zoom, EASING_IN_OUT_QUAD, tag, NULL);
menu_animation_push(disp->animation,
XMB_DELAY, iy, &node->y, EASING_IN_OUT_QUAD, tag, NULL);
}
} }
} }