From: terencehill Date: Wed, 28 Feb 2018 19:17:13 +0000 (+0100) Subject: Menu: don't allow customization of drag tolerance for slider and listbox in the skins... X-Git-Tag: xonotic-v0.8.5~2270 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=0d4410adb034af1a9989862211e49e442fa9b9dd;p=xonotic%2Fxonotic-data.pk3dir.git Menu: don't allow customization of drag tolerance for slider and listbox in the skins since it's not a aesthetic parameter; cursor position checks in ListBox_mouseDrag now don't look wrong (drag tolerance x-y components were inverted because listbox used slider drag tolerance values!) --- diff --git a/gfx/menu/luma/skinvalues.txt b/gfx/menu/luma/skinvalues.txt index c997fea25..cfaa1e580 100644 --- a/gfx/menu/luma/skinvalues.txt +++ b/gfx/menu/luma/skinvalues.txt @@ -205,7 +205,6 @@ COLOR_SLIDER_D '1 1 1' COLOR_SLIDER_F '1 1 1' COLOR_SLIDER_N '1 1 1' COLOR_SLIDER_S '1 1 1' -TOLERANCE_SLIDER '0.2 2 0' WIDTH_SLIDERTEXT 0.333333333333 // tooltip diff --git a/gfx/menu/luminos/skinvalues.txt b/gfx/menu/luminos/skinvalues.txt index ca0384fb5..2ffe29af0 100755 --- a/gfx/menu/luminos/skinvalues.txt +++ b/gfx/menu/luminos/skinvalues.txt @@ -252,4 +252,3 @@ COLOR_SLIDER_F '1 1 1' COLOR_SLIDER_D '1 1 1' COLOR_SLIDER_S '1 1 1' WIDTH_SLIDERTEXT 0.333333333333 -TOLERANCE_SLIDER '0.2 2 0' diff --git a/gfx/menu/wickedx/skinvalues.txt b/gfx/menu/wickedx/skinvalues.txt index b7011a0b0..0580e89eb 100644 --- a/gfx/menu/wickedx/skinvalues.txt +++ b/gfx/menu/wickedx/skinvalues.txt @@ -252,4 +252,3 @@ COLOR_SLIDER_F '0.5 0.75 1' COLOR_SLIDER_D '1 1 1' COLOR_SLIDER_S '0.25 0.25 0.25' WIDTH_SLIDERTEXT 0.333333333333 -TOLERANCE_SLIDER '0.2 2 0' diff --git a/gfx/menu/xaw/skinvalues.txt b/gfx/menu/xaw/skinvalues.txt index 5f4bbaad4..af7d8ce16 100644 --- a/gfx/menu/xaw/skinvalues.txt +++ b/gfx/menu/xaw/skinvalues.txt @@ -233,4 +233,3 @@ COLOR_SLIDER_F '1 1 1' COLOR_SLIDER_D '1 1 1' COLOR_SLIDER_S '1 1 1' WIDTH_SLIDERTEXT 0.333333333333 -TOLERANCE_SLIDER '0.2 2 0' diff --git a/qcsrc/menu/item/listbox.qc b/qcsrc/menu/item/listbox.qc index 07385e91e..97f08c981 100644 --- a/qcsrc/menu/item/listbox.qc +++ b/qcsrc/menu/item/listbox.qc @@ -182,10 +182,10 @@ if (me.pressed == 1) { hit = 1; - if (pos.x < 1 - me.controlWidth - me.tolerance.y * me.controlWidth) hit = 0; - if (pos.y < 0 - me.tolerance.x) hit = 0; - if (pos.x >= 1 + me.tolerance.y * me.controlWidth) hit = 0; - if (pos.y >= 1 + me.tolerance.x) hit = 0; + if (pos.x < 1 - me.controlWidth - me.tolerance.x * me.controlWidth) hit = 0; + if (pos.y < 0 - me.tolerance.y) hit = 0; + if (pos.x >= 1 + me.tolerance.x * me.controlWidth) hit = 0; + if (pos.y >= 1 + me.tolerance.y) hit = 0; if (hit) { // calculate new pos to v diff --git a/qcsrc/menu/item/slider.qh b/qcsrc/menu/item/slider.qh index c798aae33..b70d3880b 100644 --- a/qcsrc/menu/item/slider.qh +++ b/qcsrc/menu/item/slider.qh @@ -39,7 +39,7 @@ CLASS(Slider, Label) ATTRIB(Slider, pressed, float, 0); ATTRIB(Slider, pressOffset, float, 0); ATTRIB(Slider, previousValue, float, 0); - ATTRIB(Slider, tolerance, vector, '0 0 0'); + ATTRIB(Slider, tolerance, vector, '0 0 0'); // drag tolerance ATTRIB(Slider, disabled, float, 0); ATTRIB(Slider, color, vector, '1 1 1'); ATTRIB(Slider, color2, vector, '1 1 1'); diff --git a/qcsrc/menu/skin-customizables.inc b/qcsrc/menu/skin-customizables.inc index d5e1f82eb..3889b341b 100644 --- a/qcsrc/menu/skin-customizables.inc +++ b/qcsrc/menu/skin-customizables.inc @@ -274,5 +274,4 @@ SKINBEGIN SKINVECTOR(COLOR_SLIDER_D, '1 1 1'); SKINVECTOR(COLOR_SLIDER_S, '1 1 1'); SKINFLOAT(WIDTH_SLIDERTEXT, 0.333333333333); - SKINVECTOR(TOLERANCE_SLIDER, '0.2 2 0'); SKINEND diff --git a/qcsrc/menu/xonotic/listbox.qh b/qcsrc/menu/xonotic/listbox.qh index 14272cb19..b6ad4af10 100644 --- a/qcsrc/menu/xonotic/listbox.qh +++ b/qcsrc/menu/xonotic/listbox.qh @@ -6,7 +6,7 @@ CLASS(XonoticListBox, ListBox) ATTRIB(XonoticListBox, fontSize, float, SKINFONTSIZE_NORMAL); ATTRIB(XonoticListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR); ATTRIB(XonoticListBox, src, string, SKINGFX_SCROLLBAR); - ATTRIB(XonoticListBox, tolerance, vector, SKINTOLERANCE_SLIDER); + ATTRIB(XonoticListBox, tolerance, vector, '2 0.2 0'); ATTRIB(XonoticListBox, rowsPerItem, float, 1); METHOD(XonoticListBox, resizeNotify, void(entity, vector, vector, vector, vector)); ATTRIB(XonoticListBox, color, vector, SKINCOLOR_SCROLLBAR_N); diff --git a/qcsrc/menu/xonotic/slider.qh b/qcsrc/menu/xonotic/slider.qh index 9204c5eb3..fea357458 100644 --- a/qcsrc/menu/xonotic/slider.qh +++ b/qcsrc/menu/xonotic/slider.qh @@ -8,7 +8,7 @@ CLASS(XonoticSlider, Slider) ATTRIB(XonoticSlider, fontSize, float, SKINFONTSIZE_NORMAL); ATTRIB(XonoticSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT); ATTRIB(XonoticSlider, image, string, SKINGFX_SLIDER); - ATTRIB(XonoticSlider, tolerance, vector, SKINTOLERANCE_SLIDER); + ATTRIB(XonoticSlider, tolerance, vector, '0.2 2 0'); ATTRIB(XonoticSlider, align, float, 0.5); ATTRIB(XonoticSlider, color, vector, SKINCOLOR_SLIDER_N); ATTRIB(XonoticSlider, colorC, vector, SKINCOLOR_SLIDER_C); diff --git a/qcsrc/menu/xonotic/textslider.qh b/qcsrc/menu/xonotic/textslider.qh index 58fe8e86b..3c588ce55 100644 --- a/qcsrc/menu/xonotic/textslider.qh +++ b/qcsrc/menu/xonotic/textslider.qh @@ -9,7 +9,7 @@ CLASS(XonoticTextSlider, TextSlider) ATTRIB(XonoticTextSlider, fontSize, float, SKINFONTSIZE_NORMAL); ATTRIB(XonoticTextSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT); ATTRIB(XonoticTextSlider, image, string, SKINGFX_SLIDER); - ATTRIB(XonoticTextSlider, tolerance, vector, SKINTOLERANCE_SLIDER); + ATTRIB(XonoticTextSlider, tolerance, vector, '0.2 2 0'); ATTRIB(XonoticTextSlider, align, float, 0.5); ATTRIB(XonoticTextSlider, color, vector, SKINCOLOR_SLIDER_N); ATTRIB(XonoticTextSlider, colorC, vector, SKINCOLOR_SLIDER_C);