mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +00:00
Merge pull request #434 from Koerty/ninepatch-origin
NinePatch now position correctly when origin is different from 0 0
This commit is contained in:
commit
ffe591e239
|
@ -144,7 +144,6 @@ void GridTileComponent::resize()
|
||||||
|
|
||||||
mImage->setMaxSize(currentProperties.mSize - currentProperties.mPadding);
|
mImage->setMaxSize(currentProperties.mSize - currentProperties.mPadding);
|
||||||
mBackground.fitTo(currentProperties.mSize - Vector2f(32.0f, 32.0f)); // (32f, 32f) the NinePatchComponent natural padding
|
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
|
const GridTileProperties& GridTileComponent::getCurrentProperties() const
|
||||||
|
|
|
@ -160,7 +160,8 @@ void NinePatchComponent::fitTo(Vector2f size, Vector3f position, Vector2f paddin
|
||||||
position[1] -= padding.y() / 2;
|
position[1] -= padding.y() / 2;
|
||||||
|
|
||||||
setSize(size + mCornerSize * 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)
|
void NinePatchComponent::setImagePath(const std::string& path)
|
||||||
|
|
Loading…
Reference in a new issue