From 041a8c54a7be1ef65a1546cec85dfed78c9f3fb5 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 1 Sep 2015 22:51:31 +0200 Subject: [PATCH] Don't display any tooltip while a list is scrolling --- qcsrc/menu/item/listbox.qc | 6 ++++++ qcsrc/menu/menu.qc | 3 +++ 2 files changed, 9 insertions(+) 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 -- 2.39.2