Fixed MineCode selection bug when using multi-windowed software

This commit is contained in:
IgorTimofeev 2022-05-29 15:35:06 +03:00
parent e8f727eb35
commit fbc478d7c4
3 changed files with 12 additions and 8 deletions

View File

@ -1380,7 +1380,7 @@ local function createEditOrRightClickMenu(menu)
end
local function checkScrollbar(y)
return codeView.horizontalScrollBar.hidden or y < codeView.y + codeView.height - 1
return not codeView.horizontalScrollBar.hidden or y >= codeView.y + codeView.height - 1
end
local uptime = computer.uptime()
@ -1388,10 +1388,12 @@ codeView.eventHandler = function(workspace, object, e1, e2, e3, e4, e5)
if e1 == "touch" then
e3, e4 = math.ceil(e3), math.ceil(e4)
if not checkScrollbar(e4) then
if checkScrollbar(e4) then
return
end
GUI.alert("aefaf")
if e5 == 1 then
createEditOrRightClickMenu(GUI.addContextMenu(workspace, e3, e4))
else
@ -1407,7 +1409,7 @@ codeView.eventHandler = function(workspace, object, e1, e2, e3, e4, e5)
elseif e1 == "drag" then
e3, e4 = math.ceil(e3), math.ceil(e4)
if not checkScrollbar(e4) then
if checkScrollbar(e4) then
return
end

View File

@ -13,7 +13,7 @@ local event, handlers, interruptingKeysDown, lastInterrupt = {
push = computer.pushSignal
}, {}, {}, 0
event.interruptingFunction = event.defaultInterruptingDFunction
event.interruptingFunction = event.defaultInterruptingFunction
local computerPullSignal, computerUptime, mathHuge, mathMin, skipSignalType = computer.pullSignal, computer.uptime, math.huge, math.min

View File

@ -1761,10 +1761,12 @@ end
--------------------------------------------------------------------------------
local function updateMenu()
local function updateDesktopMenuAndGetTopmostWindow()
local topmostWindow = desktopWindowsContainer.children[#desktopWindowsContainer.children]
desktopMenu.children = topmostWindow and topmostWindow.menu.children or system.menuInitialChildren
return topmostWindow
end
local function setWorkspaceHidden(state)
@ -1816,7 +1818,7 @@ local function windowRemove(window)
-- Удаляем само окошко
table.remove(window.parent.children, window:indexOf())
updateMenu()
GUI.focusedObject = updateDesktopMenuAndGetTopmostWindow()
end
function system.addWindow(window, dontAddToDock, preserveCoordinates)
@ -1887,10 +1889,10 @@ function system.addWindow(window, dontAddToDock, preserveCoordinates)
end
-- Когда окно фокусицца, то главная ОСевая менюха заполницца ДЕТИШЕЧКАМИ оконной менюхи
window.onFocus = updateMenu
window.onFocus = updateDesktopMenuAndGetTopmostWindow
-- Заполняем главную менюху текущим окном
updateMenu()
updateDesktopMenuAndGetTopmostWindow()
break
end