-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GUI Buttons can wrap & pad text, GUI Labels full alignment #2547
GUI Buttons can wrap & pad text, GUI Labels full alignment #2547
Conversation
6960889
to
5448807
Compare
This appears to work. The I noticed that the comment of the text property is "Whether button will wrap long text", which is true but it's more than this, if this property is false the text is considered to be a single line and if this is true it will wrap long text but also take into account new line characters ( |
5448807
to
2124050
Compare
I had a suspicion that after adding wrapped text, users may also ask for extra padding to better accomodate this text on a button, in case it has a Graphic with thick edges. And we already have #1876. So, I decided to also add two more properties called TextHorizontalPadding and TextVerticalPadding. |
b5957e5
to
d006b39
Compare
Added support for full text Alignment for Labels. This seems trivial to make at this point: as the calculating and drawing code is shared with button text, and HorizontalAlignment enum constants have values equal to the matching FrameAlignment enum. I think no additional backwards compatibility fixes are necessary here for that reason. EDIT: I only had to add DeserializeConvertValue attributes to enum FrameAlignment in the AGS.Types. |
@ivan-mogilko , I think you need to update the Uhm, I am getting an error when loading a save now. I am using the Sierra Template.
|
e75a746
to
b20b1c8
Compare
Well, as far as I can tell, it all works now, pretty cool, saving and loading and setting/getting properties appear to work too. Not too much sure of what else to test now, but it looks fine for merge. There is just an additional comment I added above in the |
b20b1c8
to
a417415
Compare
Would it be better if properties were called Also, in hypothetical case we add more paddings, or replace this with a single property TextPadding which contains a struct, the new names will be easier to find. |
Yeah, that groups better for typing.
Right, let's say we have TextPaddingLeft, TextPaddingRight, TextPaddingTop, and TextPaddingBottom, setting TextPaddingHorizontal internally sets both Left and Right, and TextPaddingVertical sets both Top and Bottom. That works, but it can't be read back I think? So they wouldn't be properties if we intend to read them - or they give always say the value of left or top. I think the struct would have the same considerations as direct properties. I had an idea for a property in the editor that takes comma separated values, so perhaps if it was a single property in the editor it could be like, one number means all text padding is equal, two numbers mean horizontal and vertical and four numbers mean the 4 directions. (this is from CSS rules, it has even a case for 3 numbers!) Other approach would be something like WalkSpeed, with an additional property to set if the padding is uniform, symmetrical or "four sides" (I lack a word for the 4 dirs), and then setting this would make the proper entries appear. There may be other ways too. |
a417415
to
c6561ee
Compare
Resolves #1876
Resolves #2546
GUIButton supports this flag, and in case it is set:
Wrapping and drawing code is mostly shared with the GUILabel class (picked out as a separate commit).
Added WrapText property to a Button in the Editor.
Button placeholder text supposedly should not be affected by this.
This has to be tested more.
Possible TODOs: