mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-15 12:42:34 +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_size = options[:shadow_size] || 1
|
||||
@shadow_alpha = options[:shadow_alpha] || 30
|
||||
@shadow_alpha = options[:shadow_alpha] || 30
|
||||
@shadow_color = options[:shadow_color]
|
||||
@textobject = check_cache(@size, @font)
|
||||
|
||||
|
||||
@@ -118,6 +118,9 @@ module CyberarmEngine
|
||||
end
|
||||
|
||||
def update_styles(event = :default)
|
||||
old_width = width
|
||||
old_height = height
|
||||
|
||||
_style = @style.send(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])
|
||||
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
|
||||
|
||||
def default_events
|
||||
|
||||
@@ -103,7 +103,7 @@ module CyberarmEngine
|
||||
if Vector.new(window.mouse_x, window.mouse_y) == @last_mouse_pos
|
||||
if @mouse_over && (Gosu.milliseconds - @mouse_moved_at) > tool_tip_delay
|
||||
@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 = window.width - @tip.width if @tip.x + @tip.width > window.width
|
||||
@tip.y = window.mouse_y - (@tip.height + 5)
|
||||
|
||||
Reference in New Issue
Block a user