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

Is there any way to delete a figure in the makie_context? #154

Open
FaresX opened this issue Oct 17, 2024 · 4 comments
Open

Is there any way to delete a figure in the makie_context? #154

FaresX opened this issue Oct 17, 2024 · 4 comments

Comments

@FaresX
Copy link

FaresX commented Oct 17, 2024

My program requires frequent creation and destruction of figures. I want to delete the specific figure binding to some id and reuse this id. If it's not possible now, I hope this type of function can be provided in future versions.

@JamesWrigley
Copy link
Collaborator

JamesWrigley commented Oct 17, 2024

I have been thinking about that actually because I'll probably need this too. For context, the implementation is that there's a makie_context dictionary somewhat akin to an ImGuiContext:

const makie_context = Dict{ig.ImGuiID, ImMakieFigure}()

If you want to hack around it for now, you'll need to delete the entry for the figure in that dictionary. Something like this (untested):

function delete_figure!(title_id)
    extension_module = Base.get_extension(ig, :MakieIntegration)
    delete!(extension_module.makie_context, ig.GetID(title_id))
end

@FaresX
Copy link
Author

FaresX commented Oct 17, 2024

It seems that this line changes the id. I cannot dermine the actual id.

ig.PushID(title_id)

@JamesWrigley
Copy link
Collaborator

Ah right. Then you'd need to iterate through the values() and find the ImMakieFigure for which immakiefigure.figure === my_figure.

@FaresX
Copy link
Author

FaresX commented Oct 18, 2024

You are right. This issue #150 has no effect now. Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants