rename
This commit is contained in:
parent
91d79eba33
commit
9efeae1f82
20
drawing.lua
20
drawing.lua
|
@ -226,13 +226,13 @@ function Drawing.mouse_pressed(drawing, x,y, button)
|
||||||
print(Current_drawing_mode)
|
print(Current_drawing_mode)
|
||||||
assert(false)
|
assert(false)
|
||||||
end
|
end
|
||||||
Lines.current = drawing
|
Lines.current_drawing = drawing
|
||||||
end
|
end
|
||||||
|
|
||||||
-- a couple of operations on drawings need to constantly check the state of the mouse
|
-- a couple of operations on drawings need to constantly check the state of the mouse
|
||||||
function Drawing.update()
|
function Drawing.update()
|
||||||
if Lines.current == nil then return end
|
if Lines.current_drawing == nil then return end
|
||||||
local drawing = Lines.current
|
local drawing = Lines.current_drawing
|
||||||
assert(drawing.mode == 'drawing')
|
assert(drawing.mode == 'drawing')
|
||||||
local x, y = love.mouse.getX(), love.mouse.getY()
|
local x, y = love.mouse.getX(), love.mouse.getY()
|
||||||
if love.mouse.isDown('1') then
|
if love.mouse.isDown('1') then
|
||||||
|
@ -260,8 +260,8 @@ function Drawing.mouse_released(x,y, button)
|
||||||
if Current_drawing_mode == 'move' then
|
if Current_drawing_mode == 'move' then
|
||||||
Current_drawing_mode = Previous_drawing_mode
|
Current_drawing_mode = Previous_drawing_mode
|
||||||
Previous_drawing_mode = nil
|
Previous_drawing_mode = nil
|
||||||
elseif Lines.current then
|
elseif Lines.current_drawing then
|
||||||
local drawing = Lines.current
|
local drawing = Lines.current_drawing
|
||||||
if drawing.pending then
|
if drawing.pending then
|
||||||
if drawing.pending.mode == 'freehand' then
|
if drawing.pending.mode == 'freehand' then
|
||||||
-- the last point added during update is good enough
|
-- the last point added during update is good enough
|
||||||
|
@ -344,8 +344,8 @@ function Drawing.mouse_released(x,y, button)
|
||||||
print(drawing.pending.mode)
|
print(drawing.pending.mode)
|
||||||
assert(false)
|
assert(false)
|
||||||
end
|
end
|
||||||
Lines.current.pending = {}
|
Lines.current_drawing.pending = {}
|
||||||
Lines.current = nil
|
Lines.current_drawing = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
save_to_disk(Lines, Filename)
|
save_to_disk(Lines, Filename)
|
||||||
|
@ -480,7 +480,7 @@ function Drawing.keychord_pressed(chord)
|
||||||
end
|
end
|
||||||
Current_drawing_mode = 'move'
|
Current_drawing_mode = 'move'
|
||||||
drawing.pending = {mode=Current_drawing_mode, target_point=p}
|
drawing.pending = {mode=Current_drawing_mode, target_point=p}
|
||||||
Lines.current = drawing
|
Lines.current_drawing = drawing
|
||||||
end
|
end
|
||||||
elseif love.mouse.isDown('1') and chord == 'v' then
|
elseif love.mouse.isDown('1') and chord == 'v' then
|
||||||
local drawing,_,p = Drawing.select_point_at_mouse()
|
local drawing,_,p = Drawing.select_point_at_mouse()
|
||||||
|
@ -490,7 +490,7 @@ function Drawing.keychord_pressed(chord)
|
||||||
end
|
end
|
||||||
Current_drawing_mode = 'move'
|
Current_drawing_mode = 'move'
|
||||||
drawing.pending = {mode=Current_drawing_mode, target_point=p}
|
drawing.pending = {mode=Current_drawing_mode, target_point=p}
|
||||||
Lines.current = drawing
|
Lines.current_drawing = drawing
|
||||||
end
|
end
|
||||||
elseif chord == 'C-n' and not love.mouse.isDown('1') then
|
elseif chord == 'C-n' and not love.mouse.isDown('1') then
|
||||||
local drawing,point_index,p = Drawing.select_point_at_mouse()
|
local drawing,point_index,p = Drawing.select_point_at_mouse()
|
||||||
|
@ -502,7 +502,7 @@ function Drawing.keychord_pressed(chord)
|
||||||
Current_drawing_mode = 'name'
|
Current_drawing_mode = 'name'
|
||||||
p.name = ''
|
p.name = ''
|
||||||
drawing.pending = {mode=Current_drawing_mode, target_point=point_index}
|
drawing.pending = {mode=Current_drawing_mode, target_point=point_index}
|
||||||
Lines.current = drawing
|
Lines.current_drawing = drawing
|
||||||
end
|
end
|
||||||
elseif chord == 'C-d' and not love.mouse.isDown('1') then
|
elseif chord == 'C-d' and not love.mouse.isDown('1') then
|
||||||
local drawing,i,p = Drawing.select_point_at_mouse()
|
local drawing,i,p = Drawing.select_point_at_mouse()
|
||||||
|
|
4
main.lua
4
main.lua
|
@ -228,7 +228,7 @@ function App.textinput(t)
|
||||||
Search_text = nil
|
Search_text = nil
|
||||||
Text.search_next()
|
Text.search_next()
|
||||||
elseif Current_drawing_mode == 'name' then
|
elseif Current_drawing_mode == 'name' then
|
||||||
local drawing = Lines.current
|
local drawing = Lines.current_drawing
|
||||||
local p = drawing.points[drawing.pending.target_point]
|
local p = drawing.points[drawing.pending.target_point]
|
||||||
p.name = p.name..t
|
p.name = p.name..t
|
||||||
else
|
else
|
||||||
|
@ -362,7 +362,7 @@ function App.keychord_pressed(chord)
|
||||||
Current_drawing_mode = Previous_drawing_mode
|
Current_drawing_mode = Previous_drawing_mode
|
||||||
Previous_drawing_mode = nil
|
Previous_drawing_mode = nil
|
||||||
else
|
else
|
||||||
local drawing = Lines.current
|
local drawing = Lines.current_drawing
|
||||||
local p = drawing.points[drawing.pending.target_point]
|
local p = drawing.points[drawing.pending.target_point]
|
||||||
if chord == 'escape' then
|
if chord == 'escape' then
|
||||||
p.name = nil
|
p.name = nil
|
||||||
|
|
Loading…
Reference in New Issue