From d7eb8a7ec52c91d9942d34fd12439a8bca6abd1a Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 28 Aug 2023 23:57:15 +0200 Subject: [PATCH] Update raygui.h --- src/raygui.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/raygui.h b/src/raygui.h index b00ec8b..19f635e 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -2827,11 +2827,14 @@ int GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight, guiSliderDragging = true; guiSliderActive = bounds; // Store bounds as an identifier when dragging starts - // Get equivalent value and slider position from mousePoint.x - *value = ((maxValue - minValue)*(mousePoint.x - (float)(bounds.x + sliderWidth/2)))/(float)(bounds.width - sliderWidth) + minValue; + if (!CheckCollisionPointRec(mousePoint, slider)) + { + // Get equivalent value and slider position from mousePoint.x + *value = ((maxValue - minValue)*(mousePoint.x - (float)(bounds.x + sliderWidth/2)))/(float)(bounds.width - sliderWidth) + minValue; - if (sliderWidth > 0) slider.x = mousePoint.x - slider.width/2; // Slider - else if (sliderWidth == 0) slider.width = (float)sliderValue; // SliderBar + if (sliderWidth > 0) slider.x = mousePoint.x - slider.width/2; // Slider + else if (sliderWidth == 0) slider.width = (float)sliderValue; // SliderBar + } } else state = STATE_FOCUSED; }