bug: Setting high ZIndex for parent after adding children overshadows interactions with said children #38

Closed
opened 2022-11-22 15:37:47 +08:00 by luiz00martins · 3 comments
luiz00martins commented 2022-11-22 15:37:47 +08:00 (Migrated from github.com)

Minimal Working Example

https://user-images.githubusercontent.com/43142209/203252616-efd726ed-06e9-42cb-aadc-66c0ec43a488.mp4

local filePath = "/basalt.lua" --here you can change the file path default: basalt
if not(fs.exists(filePath))then
    shell.run("pastebin run ESs1mg7P packed true "..filePath:gsub(".lua", "")) -- this is an alternative to the wget command
end
local basalt = require(filePath:gsub(".lua", ""))

local main = basalt.createFrame("mainFrame")

local function visual_button(btn)
    btn:onClick(function(self) btn:setBackground(colors.black) btn:setForeground(colors.lightGray) end)
    btn:onClickUp(function(self) btn:setBackground(colors.gray) btn:setForeground(colors.black) end)
    btn:onLoseFocus(function(self) btn:setBackground(colors.gray) btn:setForeground(colors.black) end)
end


local working_frame = main:addFrame("working_frame")
	:setPosition(2, 2)
	:setSize(20, 10)
	:setBackground(colors.black)
	-- This will work fine (notice that it's done before adding the children).
	:setZIndex(1000)

local working_input = working_frame:addInput("input")
	:setPosition(2, 2)
	:setSize(18, 1)
	:setDefaultText("Search Text")

local working_button = working_frame:addButton("button")
	:setPosition(2, 4)
	:setSize(18, 1)
	:setValue("Search")
visual_button(working_button)


local not_working_frame = main:addFrame("not_working_frame")
	:setPosition(23, 2)
	:setSize(20, 10)
	:setBackground(colors.black)

local not_working_input = not_working_frame:addInput("input")
	:setPosition(2, 2)
	:setSize(18, 1)
	:setDefaultText("Search Text")

local not_working_button = not_working_frame:addButton("button")
	:setPosition(2, 4)
	:setSize(18, 1)
	:setValue("Search")
visual_button(not_working_button)

-- This will effectively disable the children (notice that it's done after adding the children).
not_working_frame:setZIndex(1000)


main:show()
basalt.autoUpdate()

Expected behavior

Children being interactable after changing the ZIndex of parent.

Checklist

[X] I am running the latest version.

### Minimal Working Example https://user-images.githubusercontent.com/43142209/203252616-efd726ed-06e9-42cb-aadc-66c0ec43a488.mp4 ```lua local filePath = "/basalt.lua" --here you can change the file path default: basalt if not(fs.exists(filePath))then shell.run("pastebin run ESs1mg7P packed true "..filePath:gsub(".lua", "")) -- this is an alternative to the wget command end local basalt = require(filePath:gsub(".lua", "")) local main = basalt.createFrame("mainFrame") local function visual_button(btn) btn:onClick(function(self) btn:setBackground(colors.black) btn:setForeground(colors.lightGray) end) btn:onClickUp(function(self) btn:setBackground(colors.gray) btn:setForeground(colors.black) end) btn:onLoseFocus(function(self) btn:setBackground(colors.gray) btn:setForeground(colors.black) end) end local working_frame = main:addFrame("working_frame") :setPosition(2, 2) :setSize(20, 10) :setBackground(colors.black) -- This will work fine (notice that it's done before adding the children). :setZIndex(1000) local working_input = working_frame:addInput("input") :setPosition(2, 2) :setSize(18, 1) :setDefaultText("Search Text") local working_button = working_frame:addButton("button") :setPosition(2, 4) :setSize(18, 1) :setValue("Search") visual_button(working_button) local not_working_frame = main:addFrame("not_working_frame") :setPosition(23, 2) :setSize(20, 10) :setBackground(colors.black) local not_working_input = not_working_frame:addInput("input") :setPosition(2, 2) :setSize(18, 1) :setDefaultText("Search Text") local not_working_button = not_working_frame:addButton("button") :setPosition(2, 4) :setSize(18, 1) :setValue("Search") visual_button(not_working_button) -- This will effectively disable the children (notice that it's done after adding the children). not_working_frame:setZIndex(1000) main:show() basalt.autoUpdate() ``` ### Expected behavior Children being interactable after changing the ZIndex of parent. ### Checklist [X] I am running the latest version.
NoryiE commented 2022-11-23 01:34:04 +08:00 (Migrated from github.com)

Hello - thank you for the bug report! The bug got fixed in 37dde88 i guess. Maybe you can also test it. I tested it and the "not_working_frame" works fine after the fix. You need to redownload basalt. The fix got added to the master branch.

Hello - thank you for the bug report! The bug got fixed in [37dde88](https://github.com/Pyroxenium/Basalt/commit/37dde881ad73d03e2461fbbf1d3ec22016d53a63) i guess. Maybe you can also test it. I tested it and the "not_working_frame" works fine after the fix. You need to redownload basalt. The fix got added to the master branch.
piprett commented 2022-12-19 03:11:22 +08:00 (Migrated from github.com)

This should probably be closed. 👍

This should probably be closed. 👍
luiz00martins commented 2022-12-19 14:35:24 +08:00 (Migrated from github.com)

Yeah, sorry for the delay. Got busy with college, so I left CC hanging for a while.

Just hopped back in though to check, an it seems to be working fine! Thanks for the update

Yeah, sorry for the delay. Got busy with college, so I left CC hanging for a while. Just hopped back in though to check, an it seems to be working fine! Thanks for the update
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GitHub/Basalt#38
No description provided.