Centre the portraits if smaller as 100 x 100.
Note the vertical centering doesn't work entirely since the text height is unknown. This might be tuned later by exporting the height of the panel part.
This commit is contained in:
parent
8e57605762
commit
685e1ae040
1 changed files with 24 additions and 2 deletions
|
@ -113,6 +113,26 @@
|
|||
((image_original_height * {__GUI_IMAGE_WIDTH}) / 500))
|
||||
)#enddef
|
||||
|
||||
# The X location of the image to display, only tested on the left side.
|
||||
#define __GUI_IMAGE_DISPLAYED_X X
|
||||
(
|
||||
if(image_original_width > 100,
|
||||
{X},
|
||||
({__GUI_IMAGE_WIDTH} - image_width) / 2)
|
||||
|
||||
)#enddef
|
||||
|
||||
# The Y location of the image to display, only tested on the left side.
|
||||
# Note since we don't know the exact height of the text we can't centre
|
||||
# the image. Instead we use the centre of the reserved image space.
|
||||
#define __GUI_IMAGE_DISPLAYED_Y
|
||||
(
|
||||
if(image_original_height > 100,
|
||||
(height - image_height),
|
||||
height - (({__GUI_IMAGE_WIDTH} - image_height) / 2))
|
||||
|
||||
)#enddef
|
||||
|
||||
[window_definition]
|
||||
id = "wml_message_left"
|
||||
description = "bar"
|
||||
|
@ -132,8 +152,8 @@
|
|||
[draw]
|
||||
|
||||
[image]
|
||||
x = 0
|
||||
y = "(height - image_height)"
|
||||
x = "{__GUI_IMAGE_DISPLAYED_X X}"
|
||||
y = "{__GUI_IMAGE_DISPLAYED_Y}"
|
||||
w = "{__GUI_IMAGE_DISPLAYED_WIDTH}"
|
||||
h = "{__GUI_IMAGE_DISPLAYED_HEIGHT}"
|
||||
name = "(portrait_image)"
|
||||
|
@ -464,6 +484,8 @@
|
|||
|
||||
[/window]
|
||||
|
||||
#undef __GUI_IMAGE_DISPLAYED_Y
|
||||
#undef __GUI_IMAGE_DISPLAYED_X
|
||||
#undef __GUI_IMAGE_DISPLAYED_HEIGHT
|
||||
#undef __GUI_IMAGE_DISPLAYED_WIDTH
|
||||
#undef _GUI_IMAGE_SCALE_FACTOR
|
||||
|
|
Loading…
Add table
Reference in a new issue