MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Item_ListBox_ThumbDrawPosition

Function Item_ListBox_ThumbDrawPosition

code/ui/ui_shared.cpp:7637–7674  ·  view source on GitHub ↗

================= Item_Slider_ThumbPosition ================= */

Source from the content-addressed store, hash-verified

7635=================
7636*/
7637int Item_ListBox_ThumbDrawPosition(itemDef_t *item)
7638{
7639 int min, max;
7640
7641 if (itemCapture == item)
7642 {
7643 if (item->window.flags & WINDOW_HORIZONTAL)
7644 {
7645 min = item->window.rect.x + SCROLLBAR_SIZE + 1;
7646 max = item->window.rect.x + item->window.rect.w - 2*SCROLLBAR_SIZE - 1;
7647 if (DC->cursorx >= min + SCROLLBAR_SIZE/2 && DC->cursorx <= max + SCROLLBAR_SIZE/2)
7648 {
7649 return DC->cursorx - SCROLLBAR_SIZE/2;
7650 }
7651 else
7652 {
7653 return Item_ListBox_ThumbPosition(item);
7654 }
7655 }
7656 else
7657 {
7658 min = item->window.rect.y + SCROLLBAR_SIZE + 1;
7659 max = item->window.rect.y + item->window.rect.h - 2*SCROLLBAR_SIZE - 1;
7660 if (DC->cursory >= min + SCROLLBAR_SIZE/2 && DC->cursory <= max + SCROLLBAR_SIZE/2)
7661 {
7662 return DC->cursory - SCROLLBAR_SIZE/2;
7663 }
7664 else
7665 {
7666 return Item_ListBox_ThumbPosition(item);
7667 }
7668 }
7669 }
7670 else
7671 {
7672 return Item_ListBox_ThumbPosition(item);
7673 }
7674}
7675
7676/*
7677=================

Callers 1

Item_ListBox_PaintFunction · 0.70

Calls 1

Tested by

no test coverage detected