mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Rotation can now zoom in x and y directions separatly; text can be scaled stretched/compressed horizontally.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@520 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -56,6 +56,16 @@ TextStyle::TextStyle(const TextFieldP& field)
|
||||
, direction(LEFT_TO_RIGHT)
|
||||
{}
|
||||
|
||||
double TextStyle::getStretch() const {
|
||||
if (content_width > 0 && ((alignment() & ALIGN_STRETCH) || (alignment() & ALIGN_STRETCH_OVERFLOW))) {
|
||||
double factor = (width - padding_left - padding_right) / content_width;
|
||||
if (alignment() == ALIGN_STRETCH || factor < 1.0) {
|
||||
return factor;
|
||||
}
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
bool TextStyle::update(Context& ctx) {
|
||||
return Style ::update(ctx)
|
||||
| font .update(ctx)
|
||||
|
||||
@@ -80,8 +80,14 @@ class TextStyle : public Style {
|
||||
|
||||
/// The rotation to use when drawing
|
||||
inline Rotation getRotation() const {
|
||||
return Rotation(angle, getRect(), 1.0, getStretch());
|
||||
}
|
||||
/// The rotation to use when determining content layout, does not include the stretch factor
|
||||
inline Rotation getRotationNoStretch() const {
|
||||
return Rotation(angle, getRect());
|
||||
}
|
||||
/// Stretch factor to use
|
||||
double getStretch() const;
|
||||
|
||||
private:
|
||||
DECLARE_REFLECTION();
|
||||
|
||||
Reference in New Issue
Block a user