Giter VIP home page Giter VIP logo

Comments (5)

ocornut avatar ocornut commented on August 16, 2024

It's not possible what's what the assert is saying. I don't understand why you would want it?

from imgui.

ocornut avatar ocornut commented on August 16, 2024

To clarify,

  • your custom widget can add an extra if statement to avoid submitting empty one or handle this edge case.
  • whereas if we remove this assert and claim to support it, users may accidentally have issues passing a zero value and never understanding where the widget is gone. Especially as for some API (0,0) may mean "fill available space" but not for this one.

from imgui.

ocornut avatar ocornut commented on August 16, 2024

I am assuming you can add the extra if in your custom widget, let us know if you feel this is a problem.
Closing.

from imgui.

alien-brother avatar alien-brother commented on August 16, 2024

Obviously, a custom widget can make an extra check before calling InvisibleButton(). I created the issue from the point of view that in general, size 0 is valid for ImGui widgets, cf. Dummy(), SmallButton(), and then there's one widget that crashes the whole program when given size 0.

from imgui.

ocornut avatar ocornut commented on August 16, 2024

I thought about it again and would like to confirm my first impression.

Button({0,0}) uses label size aka automatic sizing, just as many other widgets treat {0,0} as automatic sizing. InvisibleButton() doesn't have a label. If you pass {0,0} following a computation and the widget is automatic sized it's likely a mistake but one that becomes easy to spot.

I don't think there's a neat parallel possible with other widgets, it's just that InvisibleButton() cannot support automatic sizing.

Dummy({0,0}) indeed works but generally it wouldn't be "harmful" if you submit this or miscompute.

from imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.