Фух блядь

This commit is contained in:
IgorTimofeev 2024-01-27 19:26:12 +03:00
parent 1b686708ea
commit 7f36d4f7a1
2 changed files with 89 additions and 101 deletions

View File

@ -376,7 +376,6 @@ local function workspaceStart(workspace, eventPullTimeout)
local
e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32,
isScreenEvent,
checkBounds,
roundedX,
roundedY,
capturedObject,
@ -385,11 +384,67 @@ local function workspaceStart(workspace, eventPullTimeout)
animationOnFinishMethodsIndex,
animationOnFinishMethods
local processObject, processContainer
local function processObject(object, boundsX1, boundsY1, boundsX2, boundsY2)
local govno = false
if isScreenEvent then
if workspace.capturedObject then
if workspace.capturedObject == object then
elseif object.ignoresCapturedObject then
if not boundsX1 or not (
roundedX >= boundsX1
and roundedX <= boundsX2
and roundedY >= boundsY1
and roundedY <= boundsY2
) then
goto pizda
end
else
goto pizda
end
else
if
not boundsX1 or not (
roundedX >= boundsX1
and roundedX <= boundsX2
and roundedY >= boundsY1
and roundedY <= boundsY2
)
then
goto pizda
else
govno = not object.passScreenEvents
end
end
if object.eventHandler and not object.disabled then
object.eventHandler(workspace, object, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32)
end
else
if
not workspace.capturedObject
or workspace.capturedObject == object
or object.ignoresCapturedObject
then
if object.eventHandler and not object.disabled then
object.eventHandler(workspace, object, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32)
end
end
end
processObject = function(child, boundsX1, boundsY1, boundsX2, boundsY2)
-- Container
if child.children then
::pizda::
if object.children and boundsX1 then
local child, newBoundsX1, newBoundsY1, newBoundsX2, newBoundsY2
for i = #object.children, 1, -1 do
child = object.children[i]
if not child.hidden then
newBoundsX1, newBoundsY1, newBoundsX2, newBoundsY2 = getRectangleBounds(
boundsX1,
boundsY1,
@ -402,75 +457,20 @@ local function workspaceStart(workspace, eventPullTimeout)
child.y + child.height - 1
)
if
newBoundsX1
and processContainer(
if processObject(
child,
newBoundsX1,
newBoundsY1,
newBoundsX2,
newBoundsY2
)
then
return true
end
-- Not container
else
if isScreenEvent then
if not checkBounds or child:isPointInside(roundedX, roundedY)then
if child.eventHandler and not child.disabled then
child.eventHandler(workspace, child, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32)
end
if not child.passScreenEvents then
return true
end
end
elseif child.eventHandler then
child.eventHandler(workspace, child, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32)
end
end
end
processContainer = function(currentContainer, boundsX1, boundsY1, boundsX2, boundsY2)
local currentContainerPassed, child, newBoundsX1, newBoundsY1, newBoundsX2, newBoundsY2
if isScreenEvent then
if checkBounds and not (
roundedX >= boundsX1
and roundedX <= boundsX2
and roundedY >= boundsY1
and roundedY <= boundsY2
) then
return
end
if currentContainer.eventHandler and not currentContainer.disabled then
currentContainer.eventHandler(workspace, currentContainer, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32)
end
currentContainerPassed = not currentContainer.passScreenEvents
elseif currentContainer.eventHandler then
currentContainer.eventHandler(workspace, currentContainer, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32)
end
for i = #currentContainer.children, 1, -1 do
child = currentContainer.children[i]
if not child.hidden then
checkBounds = true
if processObject(child, boundsX1, boundsY1, boundsX2, boundsY2) then
return true
end
end
end
end
if currentContainerPassed then
if govno then
return true
end
end
@ -491,31 +491,13 @@ local function workspaceStart(workspace, eventPullTimeout)
roundedX, roundedY = math.ceil(e3), math.ceil(e4)
end
capturedObject = workspace.capturedObject
if capturedObject then
if not capturedObject.hidden then
checkBounds = false
processObject(
capturedObject,
workspace.x,
workspace.y,
workspace.x + workspace.width - 1,
workspace.y + workspace.height - 1
)
end
else
checkBounds = true
processContainer(
workspace,
workspace.x,
workspace.y,
workspace.x + workspace.width - 1,
workspace.y + workspace.height - 1
)
end
if workspace.animations then
animationIndex, animationOnFinishMethodsIndex, animationOnFinishMethods = 1, 1, {}

View File

@ -1333,6 +1333,8 @@ local function iconFieldUpdateFileList(iconField)
)
anyIconFieldAddIcon(iconField, icon)
icon.ignoresCapturedObject = true
icon.eventHandler = iconFieldIconEventHandler
iconField:addChild(icon)
@ -2934,9 +2936,13 @@ function system.updateWorkspace()
-- Clearing workspace
workspace:removeChildren()
workspace.ignoresCapturedObject = true
-- Creating desktop background object
local oldDraw = desktopBackground and desktopBackground.draw
desktopBackground = workspace:addChild(GUI.object(1, 1, workspace.width, workspace.height))
desktopBackground.ignoresCapturedObject = true
local oldDraw = desktopBackground and desktopBackground.draw
desktopBackground.draw = oldDraw or desktopBackgroundAmbientDraw
end