Make field planner request recalulate on mouse move

This commit is contained in:
2023-02-06 15:10:30 -06:00
parent caa2000e91
commit be1c1f4989

View File

@@ -80,12 +80,15 @@ module TAC
@segment_thickness = 2
@font = CyberarmEngine::Text.new(font: THEME_BOLD_FONT, size: 18, border: true, static: true)
@last_mouse_position = CyberarmEngine::Vector.new(window.mouse_x, window.mouse_y)
measure_path
refresh_panel
end
def draw
super
@field.draw
display_path
@@ -105,15 +108,19 @@ module TAC
@font.width + 12,
@font.height + 12,
0xaa_000000,
100_000)
@font.draw
100_000
)
@font.draw
end
end
def update
super
current_state.request_repaint if window.mouse_x != @last_mouse_position.x || window.mouse_y != @last_mouse_position.y
@last_mouse_position = CyberarmEngine::Vector.new(window.mouse_x, window.mouse_y)
@field.update
measure_path