From d5e50e6928271b65113574ad9aefe7bca6195d11 Mon Sep 17 00:00:00 2001 From: IgorTimofeev Date: Sun, 28 Jan 2024 14:15:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D1=83=20=D0=B0=20=D1=85=D1=83=D0=BB?= =?UTF-8?q?=D0=B8=20=D0=BC=D1=8B=20=D1=8D=D1=82=D0=BE=20=D0=B3=D0=BE=D0=B2?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D0=BE=D1=81=D1=82=D0=BE=D1=8F=D0=BD=D0=BD?= =?UTF-8?q?=D0=BE=20=D1=81=D0=B5=D0=B9=D0=B2=D0=B8=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Libraries/System.lua | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/Libraries/System.lua b/Libraries/System.lua index 85c12df0..367ba1dc 100755 --- a/Libraries/System.lua +++ b/Libraries/System.lua @@ -1055,13 +1055,13 @@ end local function iconFieldIconEventHandler(workspace, icon, e1, e2, e3, e4, e5, ...) if e1 == "touch" then local iconField = icon.parent - + + icon.lastTouchX = e3 + icon.lastTouchY = e4 + workspace.focusedObject = iconField workspace.capturedObject = icon - icon.lastTouchPosition = icon.lastTouchPosition or {} - icon.lastTouchPosition.x, icon.lastTouchPosition.y = e3, e4 - icon:moveToFront() if e5 == 0 then @@ -1084,21 +1084,29 @@ local function iconFieldIconEventHandler(workspace, icon, e1, e2, e3, e4, e5, .. -- Ебучие авторы мода, ну на кой хуй было делать drop-ивент без наличия drag? ПИДОРЫ elseif e1 == "drag" and icon.parent.iconConfigEnabled and workspace.capturedObject == icon then - icon.localX = icon.localX + e3 - icon.lastTouchPosition.x - icon.localY = icon.localY + e4 - icon.lastTouchPosition.y - icon.lastTouchPosition.x, icon.lastTouchPosition.y = e3, e4 + icon.localX = icon.localX + e3 - icon.lastTouchX + icon.localY = icon.localY + e4 - icon.lastTouchY + icon.lastTouchX = e3 + icon.lastTouchY = e4 + icon.dragged = true workspace:draw() elseif e1 == "drop" and workspace.capturedObject == icon then - icon.lastTouchPosition, workspace.capturedObject = nil, nil + -- We don't need to save the same position + if icon.dragged then + iconFieldSaveIconPosition( + icon.parent, + icon.filename .. (icon.isDirectory and "/" or ""), + icon.localX, + icon.localY + ) + end - iconFieldSaveIconPosition( - icon.parent, - icon.filename .. (icon.isDirectory and "/" or ""), - icon.localX, - icon.localY - ) + icon.lastTouchX = nil + icon.lastTouchY = nil + icon.dragged = nil + workspace.capturedObject = nil end end