Merge pull request #15 from richiefreedom/fix-node-navigation

Fixed root:switch-to-* command
This commit is contained in:
rxi 2020-02-01 16:44:58 +00:00 committed by GitHub
commit 36b77171c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
local core = require "core"
local style = require "core.style"
local DocView = require "core.docview"
local command = require "core.command"
@ -71,10 +72,10 @@ for _, dir in ipairs { "left", "right", "up", "down" } do
local x, y
if dir == "left" or dir == "right" then
y = node.position.y + node.size.y / 2
x = node.position.x + (dir == "left" and -1 or node.size.x + 1)
x = node.position.x + (dir == "left" and -1 or node.size.x + style.divider_size)
else
x = node.position.x + node.size.x / 2
y = node.position.y + (dir == "up" and -1 or node.size.y + 1)
y = node.position.y + (dir == "up" and -1 or node.size.y + style.divider_size)
end
local node = core.root_view.root_node:get_child_overlapping_point(x, y)
if not node:get_locked_size() then