From a15d79d4fe3ff33a9de4535a0ddb6decdd4ba7ee Mon Sep 17 00:00:00 2001 From: jules Date: Sun, 1 Jan 2017 11:56:23 +0000 Subject: [PATCH] Added new methods Rectangle::withRightX() and withBottomY() --- modules/juce_graphics/geometry/juce_Rectangle.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/juce_graphics/geometry/juce_Rectangle.h b/modules/juce_graphics/geometry/juce_Rectangle.h index d37062c6dc..bd13c30d29 100644 --- a/modules/juce_graphics/geometry/juce_Rectangle.h +++ b/modules/juce_graphics/geometry/juce_Rectangle.h @@ -202,6 +202,12 @@ public: /** Returns a rectangle which has the same size and x-position as this one, but with a different y-position. */ Rectangle withY (ValueType newY) const noexcept { return Rectangle (pos.x, newY, w, h); } + /** Returns a rectangle which has the same size and y-position as this one, but whose right-hand edge has the given position. */ + Rectangle withRightX (ValueType newRightX) const noexcept { return Rectangle (newRightX - w, pos.y, w, h); } + + /** Returns a rectangle which has the same size and x-position as this one, but whose bottom edge has the given position. */ + Rectangle withBottomY (ValueType newBottomY) const noexcept { return Rectangle (pos.x, newBottomY - h, w, h); } + /** Returns a rectangle with the same size as this one, but a new position. */ Rectangle withPosition (ValueType newX, ValueType newY) const noexcept { return Rectangle (newX, newY, w, h); }