carousel.love/0017-on.mouse_release

40 lines
1.4 KiB
Plaintext

on.mouse_release = function(x,y, mouse_button)
-- == menu area
if Button_pressed then
Button_pressed = nil
return
end
-- == settings area
Global_state.selected_slider = nil
if Show_menu == 'settings' then
if on_area(Settings_menu_area, x,y) then
return
end
end
-- == main area
if Show_code then
if Current_pane.editor_state.scrollbar_drag then
adjust_scrollbar(Current_pane.editor_state, y)
Current_pane.editor_state.scrollbar_drag = nil
Current_pane.editor_state.scrollbar_offset = nil
elseif on_editor_scrollbar_area(Current_pane.editor_state, x,y) then
adjust_scrollbar(Current_pane.editor_state, y)
elseif x < Current_pane.editor_state.right + 15 - 5 and y < Current_pane.editor_state.bottom + 5 + 10 - 5 then
edit.mouse_release(Current_pane.editor_state, x,y, mouse_button)
elseif Current_pane.output_editor_state.scrollbar_drag then
adjust_scrollbar(Current_pane.output_editor_state, y)
Current_pane.output_editor_state.scrollbar_drag = nil
Current_pane.output_editor_state.scrollbar_offset = nil
elseif on_editor_scrollbar_area(Current_pane.output_editor_state, x,y) then
adjust_scrollbar(Current_pane.output_editor_state, y)
end
else
-- editors hidden
if car.mouse_release then
call_protected(car.mouse_release, x,y, mouse_button)
end
if car.mousereleased then
call_protected(car.mousereleased, x,y, mouse_button)
end
end
end