~akkartik/carousel.love

42cc608d06821fcefad5b0d25c5583aeade62713 — Kartik K. Agaram 7 months ago eb9bafa
bugfix: only check for settings menu when open

Scenario I was seeing:
* on an Android phone
* when font size is small
* if I scrolled down a bit
* and then tapped on the editor

Then before this commit, the scrollbar would move. Even though I was
tapping nowhere near the scrollbar. Or even the settings area!

I carefully bisected this down to commit 7ca20061451 and this code in
on.mouse_release:

  if on_area(Settings_menu_area, x,y) then
    return
  end

What was actually going on in the above scenario:
* on a device with a small screen
* after I open the settings menu once
* the scrollbar overlaps the erstwhile setting menu, so that dragging
  the scrollbar doesn't trigger on.mouse_receive
* as a result the scrollbar is still active when I tap the editor.

Holy smokes!
2 files changed, 10 insertions(+), 3 deletions(-)

M 0012-on.draw
M 0017-on.mouse_release
M 0012-on.draw => 0012-on.draw +6 -1
@@ 22,4 22,9 @@ on.draw = function()
	end
	draw_menu()
	draw_next_frames_of_animations()
end
\ No newline at end of file
  love.graphics.print('06', 20,150)
  if Settings_menu_area.x then
    App.color{r=1, g=0.8, b=0}
    love.graphics.rectangle('line', Settings_menu_area.x, Settings_menu_area.y, Settings_menu_area.w, Settings_menu_area.h)
  end
end

M 0017-on.mouse_release => 0017-on.mouse_release +4 -2
@@ 6,8 6,10 @@ on.mouse_release = function(x,y, mouse_button)
		return
	end
	-- == settings area
	if on_area(Settings_menu_area, x,y) then
		return
	if Show_settings then
		if on_area(Settings_menu_area, x,y) then
			return
		end
	end
	-- == main area
	if Show_code then