mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
NinePatch now position correctly when origin is different from 0 0
This commit is contained in:
parent
6469ce2cbb
commit
c080ffb2c3
|
@ -144,7 +144,6 @@ void GridTileComponent::resize()
|
|||
|
||||
mImage->setMaxSize(currentProperties.mSize - currentProperties.mPadding);
|
||||
mBackground.fitTo(currentProperties.mSize - Vector2f(32.0f, 32.0f)); // (32f, 32f) the NinePatchComponent natural padding
|
||||
mBackground.setPosition(getSize().x() / 2, getSize().y() / 2);
|
||||
}
|
||||
|
||||
const GridTileProperties& GridTileComponent::getCurrentProperties() const
|
||||
|
|
|
@ -160,7 +160,8 @@ void NinePatchComponent::fitTo(Vector2f size, Vector3f position, Vector2f paddin
|
|||
position[1] -= padding.y() / 2;
|
||||
|
||||
setSize(size + mCornerSize * 2);
|
||||
setPosition(-mCornerSize.x() + position.x(), -mCornerSize.y() + position.y());
|
||||
setPosition(position.x() + Math::lerp(-mCornerSize.x(), mCornerSize.x(), mOrigin.x()),
|
||||
position.y() + Math::lerp(-mCornerSize.y(), mCornerSize.y(), mOrigin.y()));
|
||||
}
|
||||
|
||||
void NinePatchComponent::setImagePath(const std::string& path)
|
||||
|
|
Loading…
Reference in a new issue