Tidied up TODO comments, misc tweaks to Anim Editor

This commit is contained in:
Maruno17
2023-12-03 23:47:38 +00:00
parent b4e7b765d1
commit 2f231a25bb
203 changed files with 813 additions and 852 deletions

View File

@@ -4,8 +4,8 @@
class UIControls::Button < UIControls::BaseControl
BUTTON_X = 2
BUTTON_Y = 2
BUTTON_PADDING = 10
BUTTON_HEIGHT = 28
BUTTON_PADDING = 10 # Used when @fixed_size is false
BUTTON_HEIGHT = 28 # Used when @fixed_size is false
# TODO: This will also depend on the font size.
TEXT_BASE_OFFSET_Y = 18 # Text is centred vertically in the button
@@ -20,6 +20,7 @@ class UIControls::Button < UIControls::BaseControl
end
def set_interactive_rects
@interactions&.clear
button_width = (@fixed_size) ? width - (BUTTON_X * 2) : self.bitmap.text_size(@text).width + (BUTTON_PADDING * 2)
button_height = (@fixed_size) ? height - (2 * BUTTON_Y) : BUTTON_HEIGHT
button_height = [button_height, height - (2 * BUTTON_Y)].min
@@ -29,10 +30,10 @@ class UIControls::Button < UIControls::BaseControl
}
end
# TODO: This won't change the button's size. This is probably okay.
def set_text(val)
return if @text == val
@text = val
set_interactive_rects if !@fixed_size
invalidate
end
@@ -60,12 +61,14 @@ class UIControls::Button < UIControls::BaseControl
self.bitmap.outline_rect(@button_rect.x, @button_rect.y,
@button_rect.width, @button_rect.height,
self.bitmap.font.color)
# TODO: Make buttons look more different to text boxes?
# shade = self.bitmap.font.color.clone
# shade.alpha = 96
# self.bitmap.outline_rect(@button_rect.x + 1, @button_rect.y + 1,
# @button_rect.width - 2, @button_rect.height - 2,
# shade, 3)
# Draw inner grey ring that shows this is a button rather than a text box
if !disabled?
shade = self.bitmap.font.color.clone
shade.alpha = 64
self.bitmap.outline_rect(@button_rect.x + 2, @button_rect.y + 2,
@button_rect.width - 4, @button_rect.height - 4,
shade, 1)
end
# Draw button text
draw_text_centered(self.bitmap, @button_rect.x,
@button_rect.y + (@button_rect.height - TEXT_BASE_OFFSET_Y) / 2,