allow text to be typed while mouse hovers over drawing
The whole point of my keyboard shortcuts scheme is that if you press a regular key and the mouse is not down, it goes in at the cursor.
This commit is contained in:
parent
04dc87482d
commit
97531d9d05
13
main.lua
13
main.lua
|
@ -490,7 +490,6 @@ end
|
|||
|
||||
function love.textinput(t)
|
||||
if love.mouse.isDown('1') then return end
|
||||
if mouse_in_drawing() then return end
|
||||
if lines[cursor_line].mode == 'drawing' then return end
|
||||
local byteoffset
|
||||
if cursor_pos > 1 then
|
||||
|
@ -765,18 +764,6 @@ function nearest_cursor_pos(line, x, hint)
|
|||
return right
|
||||
end
|
||||
|
||||
function mouse_in_drawing()
|
||||
local x, y = love.mouse.getX(), love.mouse.getY()
|
||||
for _,drawing in ipairs(lines) do
|
||||
if drawing.mode == 'drawing' then
|
||||
if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 16 and x < 16+drawingw then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function current_drawing()
|
||||
local x, y = love.mouse.getX(), love.mouse.getY()
|
||||
for _,drawing in ipairs(lines) do
|
||||
|
|
Loading…
Reference in New Issue