stop responding to mouse in non-editable drawings

The way I'm accessing the mouse is quite unprincipled.
This commit is contained in:
Kartik K. Agaram 2022-07-16 21:16:21 -07:00
parent 2703f7cd65
commit 3a9a75df21

View File

@ -6,7 +6,7 @@ require 'drawing_tests'
-- into 256 parts.
function Drawing.draw(State, line)
local pmx,pmy = App.mouse_x(), App.mouse_y()
if pmx < State.right and pmy > line.y and pmy < line.y+Drawing.pixels(line.h, State.width) then
if State.show_cursor and pmx < State.right and pmy > line.y and pmy < line.y+Drawing.pixels(line.h, State.width) then
App.color(Icon_color)
love.graphics.rectangle('line', State.left,line.y, State.width,Drawing.pixels(line.h, State.width))
if icon[State.current_drawing_mode] then
@ -32,7 +32,7 @@ function Drawing.draw(State, line)
--? print(State.left, State.right)
for _,shape in ipairs(line.shapes) do
assert(shape)
if geom.on_shape(mx,my, line, shape) then
if State.show_cursor and geom.on_shape(mx,my, line, shape) then
App.color(Focus_stroke_color)
else
App.color(Stroke_color)
@ -44,7 +44,7 @@ function Drawing.draw(State, line)
local function py(y) return Drawing.pixels(y, State.width)+line.y end
for i,p in ipairs(line.points) do
if p.deleted == nil then
if Drawing.near(p, mx,my, State.width) then
if State.show_cursor and Drawing.near(p, mx,my, State.width) then
App.color(Focus_stroke_color)
love.graphics.circle('line', px(p.x),py(p.y), Same_point_distance)
else