From 8ca422cbce98e98a82110cdef9f8d06c3efb0a4b Mon Sep 17 00:00:00 2001 From: Axeer <46658873+Axeer@users.noreply.github.com> Date: Mon, 29 Aug 2022 04:58:52 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=82=D0=B5=D0=BA=D1=81=D1=82=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь только один слот под активную субменюшку, остальные считаются неактивными и ремуваются. Это решает проблему множества зависших в воздухе subMenu, которые наслаиваются друг на друга --- Libraries/GUI.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Libraries/GUI.lua b/Libraries/GUI.lua index a873bf3d..108a4672 100755 --- a/Libraries/GUI.lua +++ b/Libraries/GUI.lua @@ -3923,6 +3923,15 @@ end local function dropDownMenuItemEventHandler(workspace, object, e1, ...) if e1 == "touch" then if object.type == 1 and not object.pressed then + + dropDownMenuReleaseItems(object.parent.parent) + if #object.parent.parent.subMenus then + for i, subMenu in ipairs(object.parent.parent.subMenus) do + subMenu:remove() + table.remove(object.parent.parent.subMenus, i) + end + end + object.pressed = true workspace:draw() @@ -3934,7 +3943,7 @@ local function dropDownMenuItemEventHandler(workspace, object, e1, ...) object.subMenu.localX = object.parent.parent.localX - object.subMenu.width object.parent.parent:moveToFront() end - + table.insert(object.parent.parent.subMenus, object.subMenu) workspace:draw() else event.sleep(0.2) @@ -4133,6 +4142,7 @@ function GUI.dropDownMenu(x, y, width, maximumHeight, itemHeight, backgroundColo menu.eventHandler = dropDownMenuEventHandler menu.update = dropDownMenuUpdate + menu.subMenus = {} return menu end