From: terencehill Date: Tue, 1 Sep 2015 20:51:31 +0000 (+0200) Subject: Don't display any tooltip while a list is scrolling X-Git-Tag: xonotic-v0.8.2~1808^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=041a8c54a7be1ef65a1546cec85dfed78c9f3fb5;p=xonotic%2Fxonotic-data.pk3dir.git Don't display any tooltip while a list is scrolling --- diff --git a/qcsrc/menu/item/listbox.qc b/qcsrc/menu/item/listbox.qc index 5713403ac..6aead0a87 100644 --- a/qcsrc/menu/item/listbox.qc +++ b/qcsrc/menu/item/listbox.qc @@ -22,6 +22,7 @@ CLASS(ListBox, Item) ATTRIB(ListBox, origin, vector, '0 0 0') ATTRIB(ListBox, scrollPos, float, 0) // measured in window heights, fixed when needed ATTRIB(ListBox, scrollPosTarget, float, 0) + METHOD(ListBox, isScrolling, bool(entity)); ATTRIB(ListBox, needScrollToItem, float, -1) METHOD(ListBox, scrollToItem, void(entity, int)); ATTRIB(ListBox, previousValue, float, 0) @@ -86,6 +87,11 @@ ENDCLASS(ListBox) #endif #ifdef IMPLEMENTATION +bool ListBox_isScrolling(entity me) +{ + return (me.scrollPos != me.scrollPosTarget); +} + void ListBox_scrollToItem(entity me, int i) { // scroll doesn't work properly until itemHeight is set to the correct value diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index db5551a5a..ecadb75bb 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -560,6 +560,9 @@ void m_tooltip(vector pos) { it = m_findtooltipitem(main, pos); + if(it.instanceOfListBox && it.isScrolling(it)) + it = world; + if(it && prev_tooltip != it.tooltip) { // fade out if tooltip of a certain item has changed