From 7e868e14e6eb32ea6771e53116e3a487dc2a31b5 Mon Sep 17 00:00:00 2001 From: "Sergei V. Rogachev" Date: Sat, 1 Feb 2020 17:40:38 +0300 Subject: [PATCH] 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. --- data/core/commands/root.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/core/commands/root.lua b/data/core/commands/root.lua index f59dc75..1e472e7 100644 --- a/data/core/commands/root.lua +++ b/data/core/commands/root.lua @@ -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