Fixed root:switch-to-* command
Before the fix navigation between nodes in the root view was broken: the scale factor wasn't taken into account. Switching in the right and down directions was impossible for scale factors greater than one.
This commit is contained in:
parent
719262a416
commit
7e868e14e6
|
@ -1,4 +1,5 @@
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
|
local style = require "core.style"
|
||||||
local DocView = require "core.docview"
|
local DocView = require "core.docview"
|
||||||
local command = require "core.command"
|
local command = require "core.command"
|
||||||
|
|
||||||
|
@ -71,10 +72,10 @@ for _, dir in ipairs { "left", "right", "up", "down" } do
|
||||||
local x, y
|
local x, y
|
||||||
if dir == "left" or dir == "right" then
|
if dir == "left" or dir == "right" then
|
||||||
y = node.position.y + node.size.y / 2
|
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
|
else
|
||||||
x = node.position.x + node.size.x / 2
|
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
|
end
|
||||||
local node = core.root_view.root_node:get_child_overlapping_point(x, y)
|
local node = core.root_view.root_node:get_child_overlapping_point(x, y)
|
||||||
if not node:get_locked_size() then
|
if not node:get_locked_size() then
|
||||||
|
|
Loading…
Reference in New Issue