Anim Editor: added FoeFlip property, Space to play, S to swap sides, P to show/hide property lines for selected particle

This commit is contained in:
Maruno17
2024-04-18 22:35:15 +01:00
parent 15033d6114
commit 4480def33c
23 changed files with 264 additions and 161 deletions

View File

@@ -2,11 +2,10 @@
#
#===============================================================================
class UIControls::List < UIControls::BaseControl
BORDER_THICKNESS = 2
ROW_HEIGHT = 24
TEXT_PADDING_X = 4
TEXT_OFFSET_Y = 3
BORDER_THICKNESS = 2
ROW_HEIGHT = 24
TEXT_PADDING_X = 4
TEXT_OFFSET_Y = 3
SELECTED_ROW_COLOR = Color.new(216, 192, 32) # Dark yellow
def initialize(width, height, viewport, values = [])
@@ -30,6 +29,8 @@ class UIControls::List < UIControls::BaseControl
super
end
#-----------------------------------------------------------------------------
def x=(new_val)
super(new_val)
@scrollbar.x = new_val + width - UIControls::Scrollbar::SLIDER_WIDTH - BORDER_THICKNESS
@@ -64,6 +65,17 @@ class UIControls::List < UIControls::BaseControl
invalidate
end
# Returns the ID of the selected row.
def value
return nil if @selected < 0
if @values.is_a?(Array)
return (@values[@selected].is_a?(Array)) ? @values[@selected][0] : @selected
elsif @values.is_a?(Hash)
return @values.keys[@selected]
end
return nil
end
def top_row=(val)
old_val = @top_row
@top_row = val
@@ -81,16 +93,7 @@ class UIControls::List < UIControls::BaseControl
invalidate
end
# Returns the ID of the selected row.
def value
return nil if @selected < 0
if @values.is_a?(Array)
return (@values[@selected].is_a?(Array)) ? @values[@selected][0] : @selected
elsif @values.is_a?(Hash)
return @values.keys[@selected]
end
return nil
end
#-----------------------------------------------------------------------------
def mouse_in_control?
mouse_x, mouse_y = mouse_pos
@@ -100,6 +103,12 @@ class UIControls::List < UIControls::BaseControl
return false
end
def busy?
return !@captured_area.nil?
end
#-----------------------------------------------------------------------------
def set_interactive_rects
@interactions = {}
@values.length.times do |i|
@@ -112,12 +121,6 @@ class UIControls::List < UIControls::BaseControl
#-----------------------------------------------------------------------------
def busy?
return !@captured_area.nil?
end
#-----------------------------------------------------------------------------
def draw_area_highlight
# If a row is captured, it will automatically be selected and the selection
# colour will be drawn over the highlight. There's no point drawing a