Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
luiz00martins opened this issue Nov 22, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@luiz00martins
Copy link

Minimal Working Example

Minecraft_.1.16.5.-.Singleplayer.2022-11-22.04-31-52.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.

@luiz00martins luiz00martins added the bug Something isn't working label Nov 22, 2022
@NoryiE
Copy link
Collaborator

NoryiE commented Nov 22, 2022

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.

@Erb3
Copy link
Contributor

Erb3 commented Dec 18, 2022

This should probably be closed. 👍

@NoryiE NoryiE closed this as completed Dec 18, 2022
@luiz00martins
Copy link
Author

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants