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

Formspec: Fix clicking on tooltip-obstructed elements #9266

Merged
merged 1 commit into from
Jan 4, 2020

Conversation

Desour
Copy link
Member

@Desour Desour commented Dec 30, 2019

  • Goal of the PR: Fixing a bug.
  • How does the PR work?
    irr::gui::IGUIElement::getElementFromPoint ignores invisible elements. Tooltips and inventorylists do not need to be visible to be drawn as they don't use the draw function.
  • Fixes Formspec tooltip element prevents clicking on fields defined before it #9264.
  • Side-note: This fix wouldn't work for other elements, and inventorylists should be done properly one day (with their own class instead of being drawn in GUIFormspecMenu). Other not-rectangular or holey elements need (best non-hacky) a way to pass not handled callbacks to elements below them.

To do

This PR is a Ready for Review.

How to test

local elements = [[
	list[current_player;main;0,0;4,4;]
	button[5,0;2,1;btn;Button]
	button[3,1.5;3,1;btn;Button2]
]]

local fs = [[
	size[11,10]
]] .. elements .. [[
	tooltip[0,0;10,5;<rect_mode tooltip defined after other elements>]
	container[0,6]
	tooltip[0,0;10,5;<rect_mode tooltip defined before other elements>]
]] .. elements .. [[
	container_end[]
]]

minetest.register_on_joinplayer(function(player)
	minetest.show_formspec(player:get_player_name(), "fs_test", fs)
end)

minetest.register_chatcommand("fs", {
	params = "",
	description = "Show the test formspec.",
	privs = {},
	func = function(name, param)
		minetest.show_formspec(name, "fs", fs)
		return true
	end,
})

Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected

@SmallJoker SmallJoker changed the title Formspec: set rect_mode tooltip and inventorylist elements invisible to allow clicking the elements beneath Formspec: Fix clicking on tooltip-obstructed elements Dec 30, 2019
@sfan5 sfan5 merged commit 7c0e0c3 into minetest:master Jan 4, 2020
@Desour Desour deleted the fs_tooltip_over_fix branch January 4, 2020 14:53
aldum pushed a commit to banyamesterseg/minetest that referenced this pull request Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formspec tooltip element prevents clicking on fields defined before it
3 participants