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

View File

@ -13,7 +13,7 @@ local event, handlers, interruptingKeysDown, lastInterrupt = {
push = computer.pushSignal push = computer.pushSignal
}, {}, {}, 0 }, {}, {}, 0
event.interruptingFunction = event.defaultInterruptingDFunction event.interruptingFunction = event.defaultInterruptingFunction
local computerPullSignal, computerUptime, mathHuge, mathMin, skipSignalType = computer.pullSignal, computer.uptime, math.huge, math.min 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] local topmostWindow = desktopWindowsContainer.children[#desktopWindowsContainer.children]
desktopMenu.children = topmostWindow and topmostWindow.menu.children or system.menuInitialChildren desktopMenu.children = topmostWindow and topmostWindow.menu.children or system.menuInitialChildren
return topmostWindow
end end
local function setWorkspaceHidden(state) local function setWorkspaceHidden(state)
@ -1816,7 +1818,7 @@ local function windowRemove(window)
-- Удаляем само окошко -- Удаляем само окошко
table.remove(window.parent.children, window:indexOf()) table.remove(window.parent.children, window:indexOf())
updateMenu() GUI.focusedObject = updateDesktopMenuAndGetTopmostWindow()
end end
function system.addWindow(window, dontAddToDock, preserveCoordinates) function system.addWindow(window, dontAddToDock, preserveCoordinates)
@ -1887,10 +1889,10 @@ function system.addWindow(window, dontAddToDock, preserveCoordinates)
end end
-- Когда окно фокусицца, то главная ОСевая менюха заполницца ДЕТИШЕЧКАМИ оконной менюхи -- Когда окно фокусицца, то главная ОСевая менюха заполницца ДЕТИШЕЧКАМИ оконной менюхи
window.onFocus = updateMenu window.onFocus = updateDesktopMenuAndGetTopmostWindow
-- Заполняем главную менюху текущим окном -- Заполняем главную менюху текущим окном
updateMenu() updateDesktopMenuAndGetTopmostWindow()
break break
end end