]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Don't display any tooltip while a list is scrolling
authorterencehill <piuntn@gmail.com>
Tue, 1 Sep 2015 20:51:31 +0000 (22:51 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 1 Sep 2015 20:51:31 +0000 (22:51 +0200)
qcsrc/menu/item/listbox.qc
qcsrc/menu/menu.qc

index 5713403ac2a1fb7476f7e0e5c54f6aa98a595935..6aead0a87641755344f9f4222faed80d28b63225 100644 (file)
@@ -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
index db5551a5a78c9d2bb1c1066e75a40faa2a67a096..ecadb75bb0738acba4a827476fd3efb6e363d8f9 100644 (file)
@@ -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