mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-15 20:52:35 +00:00
Fixed GUI having a total recalculation whenever a style changed, made tooltip not be centered on mouse, removed duplicate loc from Text
This commit is contained in:
@@ -23,7 +23,6 @@ module CyberarmEngine
|
|||||||
@shadow = true if options[:shadow].nil?
|
@shadow = true if options[:shadow].nil?
|
||||||
@shadow_size = options[:shadow_size] || 1
|
@shadow_size = options[:shadow_size] || 1
|
||||||
@shadow_alpha = options[:shadow_alpha] || 30
|
@shadow_alpha = options[:shadow_alpha] || 30
|
||||||
@shadow_alpha = options[:shadow_alpha] || 30
|
|
||||||
@shadow_color = options[:shadow_color]
|
@shadow_color = options[:shadow_color]
|
||||||
@textobject = check_cache(@size, @font)
|
@textobject = check_cache(@size, @font)
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_styles(event = :default)
|
def update_styles(event = :default)
|
||||||
|
old_width = width
|
||||||
|
old_height = height
|
||||||
|
|
||||||
_style = @style.send(event)
|
_style = @style.send(event)
|
||||||
@style_event = event
|
@style_event = event
|
||||||
|
|
||||||
@@ -126,7 +129,13 @@ module CyberarmEngine
|
|||||||
@text.swap_font(_style&.dig(:text_size) || @style.default[:text_size], _style&.dig(:font) || @style.default[:font])
|
@text.swap_font(_style&.dig(:text_size) || @style.default[:text_size], _style&.dig(:font) || @style.default[:font])
|
||||||
end
|
end
|
||||||
|
|
||||||
(root&.gui_state || @gui_state).request_recalculate
|
return if self.is_a?(ToolTip)
|
||||||
|
|
||||||
|
if old_width != width || old_height != height
|
||||||
|
(root&.gui_state || @gui_state).request_recalculate
|
||||||
|
else
|
||||||
|
stylize
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_events
|
def default_events
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ module CyberarmEngine
|
|||||||
if Vector.new(window.mouse_x, window.mouse_y) == @last_mouse_pos
|
if Vector.new(window.mouse_x, window.mouse_y) == @last_mouse_pos
|
||||||
if @mouse_over && (Gosu.milliseconds - @mouse_moved_at) > tool_tip_delay
|
if @mouse_over && (Gosu.milliseconds - @mouse_moved_at) > tool_tip_delay
|
||||||
@tip.value = @mouse_over.tip if @mouse_over
|
@tip.value = @mouse_over.tip if @mouse_over
|
||||||
@tip.x = window.mouse_x - @tip.width / 2
|
@tip.x = window.mouse_x
|
||||||
@tip.x = 0 if @tip.x < 0
|
@tip.x = 0 if @tip.x < 0
|
||||||
@tip.x = window.width - @tip.width if @tip.x + @tip.width > window.width
|
@tip.x = window.width - @tip.width if @tip.x + @tip.width > window.width
|
||||||
@tip.y = window.mouse_y - (@tip.height + 5)
|
@tip.y = window.mouse_y - (@tip.height + 5)
|
||||||
|
|||||||
Reference in New Issue
Block a user