mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added a couple of reduced/expanded methods to Rectangle.
This commit is contained in:
parent
aea20ee144
commit
bddebf3433
5 changed files with 24 additions and 4 deletions
|
|
@ -567,7 +567,7 @@ IntrojucerLookAndFeel::IntrojucerLookAndFeel()
|
|||
Rectangle<int> IntrojucerLookAndFeel::getPropertyComponentContentPosition (PropertyComponent& component)
|
||||
{
|
||||
if (component.findParentComponentOfClass<AppearanceEditor::EditorPanel>() != nullptr)
|
||||
return component.getLocalBounds().reduced (1, 1).removeFromRight (component.getWidth() / 2);
|
||||
return component.getLocalBounds().reduced (1).removeFromRight (component.getWidth() / 2);
|
||||
|
||||
return LookAndFeel::getPropertyComponentContentPosition (component);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ public:
|
|||
const Colour colour (getColour());
|
||||
|
||||
g.fillAll (Colours::grey);
|
||||
g.fillCheckerBoard (getLocalBounds().reduced (2, 2),
|
||||
g.fillCheckerBoard (getLocalBounds().reduced (2),
|
||||
10, 10,
|
||||
Colour (0xffdddddd).overlaidWith (colour),
|
||||
Colour (0xffffffff).overlaidWith (colour));
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
if (thumbnail.getTotalLength() > 0)
|
||||
{
|
||||
thumbnail.drawChannels (g, getLocalBounds().reduced (2, 2),
|
||||
thumbnail.drawChannels (g, getLocalBounds().reduced (2),
|
||||
startTime, endTime, 1.0f);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -940,7 +940,7 @@ public:
|
|||
|
||||
g.setColour (Colours::green);
|
||||
g.fillPath (p, RectanglePlacement (RectanglePlacement::centred)
|
||||
.getTransformToFit (p.getBounds(), getLocalBounds().reduced (2, 2).toFloat()));
|
||||
.getTransformToFit (p.getBounds(), getLocalBounds().reduced (2).toFloat()));
|
||||
}
|
||||
|
||||
void mouseDown (const MouseEvent&)
|
||||
|
|
|
|||
|
|
@ -319,6 +319,16 @@ public:
|
|||
return Rectangle (pos.x - deltaX, pos.y - deltaY, nw, nh);
|
||||
}
|
||||
|
||||
/** Returns a rectangle that is larger than this one by a given amount.
|
||||
|
||||
Effectively, the rectangle returned is (x - delta, y - delta, w + delta * 2, h + delta * 2).
|
||||
@see expand, reduce, reduced
|
||||
*/
|
||||
Rectangle expanded (const ValueType delta) const noexcept
|
||||
{
|
||||
return expanded (delta, delta);
|
||||
}
|
||||
|
||||
/** Shrinks the rectangle by a given amount.
|
||||
|
||||
Effectively, its new size is (x + deltaX, y + deltaY, w - deltaX * 2, h - deltaY * 2).
|
||||
|
|
@ -341,6 +351,16 @@ public:
|
|||
return expanded (-deltaX, -deltaY);
|
||||
}
|
||||
|
||||
/** Returns a rectangle that is smaller than this one by a given amount.
|
||||
|
||||
Effectively, the rectangle returned is (x + delta, y + delta, w - delta * 2, h - delta * 2).
|
||||
@see reduce, expand, expanded
|
||||
*/
|
||||
Rectangle reduced (const ValueType delta) const noexcept
|
||||
{
|
||||
return reduced (delta, delta);
|
||||
}
|
||||
|
||||
/** Removes a strip from the top of this rectangle, reducing this rectangle
|
||||
by the specified amount and returning the section that was removed.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue