From 3c83383d0e837b3b0bf285ae16ca7763dba80653 Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 30 Nov 2012 14:14:17 +0000 Subject: [PATCH] Added Line::toFloat(). Fix for scrollbar edge-case. --- modules/juce_graphics/geometry/juce_Line.h | 6 ++++++ modules/juce_gui_basics/layout/juce_ScrollBar.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/juce_graphics/geometry/juce_Line.h b/modules/juce_graphics/geometry/juce_Line.h index 4d86e54512..f2292e7f9c 100644 --- a/modules/juce_graphics/geometry/juce_Line.h +++ b/modules/juce_graphics/geometry/juce_Line.h @@ -142,6 +142,12 @@ public: */ typename Point::FloatType getAngle() const noexcept { return start.getAngleToPoint (end); } + /** Casts this line to float coordinates. */ + Line toFloat() const noexcept { return Line (start.toFloat(), end.toFloat()); } + + /** Casts this line to double coordinates. */ + Line toDouble() const noexcept { return Line (start.toDouble(), end.toDouble()); } + //============================================================================== /** Compares two lines. */ bool operator== (const Line& other) const noexcept { return start == other.start && end == other.end; } diff --git a/modules/juce_gui_basics/layout/juce_ScrollBar.cpp b/modules/juce_gui_basics/layout/juce_ScrollBar.cpp index 4e4866b42b..1eb15e8707 100644 --- a/modules/juce_gui_basics/layout/juce_ScrollBar.cpp +++ b/modules/juce_gui_basics/layout/juce_ScrollBar.cpp @@ -358,7 +358,7 @@ void ScrollBar::mouseDrag (const MouseEvent& e) { const int mousePos = vertical ? e.y : e.x; - if (isDraggingThumb && lastMousePos != mousePos) + if (isDraggingThumb && lastMousePos != mousePos && thumbAreaSize > thumbSize) { const int deltaPixels = mousePos - dragStartMousePos;