Merge text0
This commit is contained in:
commit
9390a4a418
1
0001-on
1
0001-on
|
@ -12,6 +12,7 @@ on = {
|
|||
-- on.focus
|
||||
-- on.mouse_press (see love.mousepressed)
|
||||
-- on.mouse_release (see love.mousereleased)
|
||||
-- on.mouse_wheel_move (see love.wheelmoved)
|
||||
-- on.keychord_press (see keychord.lua in this repo)
|
||||
-- on.text_input (see love.textinput)
|
||||
-- on.key_release (see love.keyreleased)
|
||||
|
|
14
edit.lua
14
edit.lua
|
@ -205,6 +205,20 @@ function edit.mouse_release(State, x,y, mouse_button)
|
|||
--? print('selection:', State.selection1.line, State.selection1.pos)
|
||||
end
|
||||
|
||||
function edit.mouse_wheel_move(State, dx,dy)
|
||||
if dy > 0 then
|
||||
State.cursor1 = {line=State.screen_top1.line, pos=State.screen_top1.pos}
|
||||
for i=1,math.floor(dy) do
|
||||
Text.up(State)
|
||||
end
|
||||
elseif dy < 0 then
|
||||
State.cursor1 = {line=State.screen_bottom1.line, pos=State.screen_bottom1.pos}
|
||||
for i=1,math.floor(-dy) do
|
||||
Text.down(State)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function edit.text_input(State, t)
|
||||
if State.search_term then
|
||||
State.search_term = State.search_term..t
|
||||
|
|
5
main.lua
5
main.lua
|
@ -139,6 +139,11 @@ function App.mousereleased(x,y, mouse_button)
|
|||
if on.mouse_release then on.mouse_release(x,y, mouse_button) end
|
||||
end
|
||||
|
||||
function App.wheelmoved(dx,dy)
|
||||
Cursor_time = 0 -- ensure cursor is visible immediately after it moves
|
||||
if on.mouse_wheel_move then on.mouse_wheel_move(dx,dy) end
|
||||
end
|
||||
|
||||
function App.focus(in_focus)
|
||||
if in_focus then
|
||||
Last_focus_time = Current_time
|
||||
|
|
Loading…
Reference in New Issue