mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Drawable: Add setDrawableTransform() and use it in SVGParser
Using this new function a previous bug is avoided where transforms were applied differently to drawable paths and text elements.
This commit is contained in:
parent
6c09aa69d9
commit
a99422efee
3 changed files with 31 additions and 2 deletions
|
|
@ -140,6 +140,7 @@ void Drawable::setBoundsToEnclose (Rectangle<float> area)
|
|||
auto newBounds = area.getSmallestIntegerContainer() + parentOrigin;
|
||||
originRelativeToComponent = parentOrigin - newBounds.getPosition();
|
||||
setBounds (newBounds);
|
||||
updateTransform();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -154,6 +155,20 @@ bool Drawable::replaceColour (Colour original, Colour replacement)
|
|||
return changed;
|
||||
}
|
||||
|
||||
void Drawable::setDrawableTransform (const AffineTransform& transform)
|
||||
{
|
||||
drawableTransform = transform;
|
||||
updateTransform();
|
||||
}
|
||||
|
||||
void Drawable::updateTransform()
|
||||
{
|
||||
const auto transformationOrigin = originRelativeToComponent + getPosition();
|
||||
setTransform (AffineTransform::translation (transformationOrigin * (-1))
|
||||
.followedBy (drawableTransform)
|
||||
.followedBy (AffineTransform::translation (transformationOrigin)));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void Drawable::setOriginWithOriginalSize (Point<float> originWithinParent)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue