57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
on.keychord_press = function(chord, key)
|
|
print('key press', chord)
|
|
if chord == 'C-=' then
|
|
-- zoom in
|
|
Viewport.zoom = Viewport.zoom+0.1
|
|
A()
|
|
elseif chord == 'C--' then
|
|
-- zoom out
|
|
if Viewport.zoom > 0.1 then
|
|
Viewport.zoom = Viewport.zoom-0.1
|
|
A()
|
|
end
|
|
elseif chord == 'C-0' then
|
|
-- reset zoom
|
|
Viewport.zoom = 1.0
|
|
A()
|
|
--? elseif chord == 'C-z' then
|
|
--? dump_state()
|
|
elseif Cursor_node and Cursor_node.editor.cursor_x then
|
|
edit.keychord_press(Cursor_node.editor, chord, key)
|
|
pan_viewport_to_contain_cursor(Cursor_node)
|
|
A()
|
|
else
|
|
if chord == 'up' then
|
|
Viewport.y = Viewport.y - scale(20)
|
|
B()
|
|
elseif chord == 'down' then
|
|
Viewport.y = Viewport.y + scale(20)
|
|
B()
|
|
elseif chord == 'left' then
|
|
Viewport.x = Viewport.x - scale(50)
|
|
B()
|
|
elseif chord == 'right' then
|
|
Viewport.x = Viewport.x + scale(50)
|
|
B()
|
|
elseif chord == 'pageup' then
|
|
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
|
|
B()
|
|
elseif chord == 'S-up' then
|
|
Viewport.y = Viewport.y - App.screen.height/Viewport.zoom
|
|
B()
|
|
elseif chord == 'pagedown' then
|
|
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
|
|
B()
|
|
elseif chord == 'S-down' then
|
|
Viewport.y = Viewport.y + App.screen.height/Viewport.zoom
|
|
B()
|
|
elseif chord == 'S-left' then
|
|
Viewport.x = Viewport.x - App.screen.width/Viewport.zoom
|
|
B()
|
|
elseif chord == 'S-right' then
|
|
Viewport.x = Viewport.x + App.screen.width/Viewport.zoom
|
|
B()
|
|
end
|
|
end
|
|
end
|