Browse Source

Added new methods Rectangle::withRightX() and withBottomY()

tags/2021-05-28
jules 8 years ago
parent
commit
a15d79d4fe
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      modules/juce_graphics/geometry/juce_Rectangle.h

+ 6
- 0
modules/juce_graphics/geometry/juce_Rectangle.h View File

@@ -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); }


Loading…
Cancel
Save