Git Product home page Git Product logo

Comments (3)

seanmiddleditch avatar seanmiddleditch commented on June 28, 2024 1

I've been shy of adding too many new colors in the style system, while the expectation is that this will be boldly reworked. Admittedly this is a bit of a procrastination tactic at this point.

Hah, alright. Perhaps a version that takes colors as parameters, a la TextColored, to start? (Though using the standard style system would be better ofc.)

It'd be awkward to implement/demo an "open browser" thing at least in the demo as that's quite OS dependent

A significant number of uses here have nothing to do with browers, but rather just replacing buttons for navigating within the app itself. That is, this is just a differently-styled button.

It certainly would be awesome to have an OpenExternal kind of thing in imgui, I think that's entirely orthogonal.

A control that's actually built around opening links in browsers is slightly different in other ways. It needs both URL and optional label parameters. It needs default behaviours to show the URL in a tooltip (assuming the label is not omitted). It needs some way to easily copy the URL to clipboard, e.g. via a context menu. That's a lot more stuff and a lot more "opinion" the that a URL/browser-focused control needs to provide over the core UI functionality of having clickable hyperlinks.

It'd been hoping to include this as part of a larger rework of text functions, so it would be easily to include in wrapping text, markups etc. But arguably we would likely still need a helper API entry point similar to one you suggested.

👍🏼 Some work I'm doing right now on an experimental "advancing layout+styling in imgui" project makes me think you're right about that. Breaking up text into separate runs across line breaks, with each run having its own hitbox/etc. makes handling advanced behavior w/ wordwrap much easier. Leaving all the wordwrap to the DrawList limits flexibility substantially.

from imgui.

ocornut avatar ocornut commented on June 28, 2024 1

Some work I'm doing right now on an experimental "advancing layout+styling in imgui" project makes me think you're right about that. Breaking up text into separate runs across line breaks, with each run having its own hitbox/etc. makes handling advanced behavior w/ wordwrap much easier. Leaving all the wordwrap to the DrawList limits flexibility substantially.

I have work in progress new text functions which will be more flexible in many ways (and also faster) but they aren't ready yet.
One common issue is #2313 that wrapping offset is conflating with start offset.

from imgui.

ocornut avatar ocornut commented on June 28, 2024

I am puzzled because I thought there was a topic or PR exactly about this but I can't find one now.
Also note TextURL() in https://gist.github.com/dougbinks/ef0962ef6ebe2cadae76c4e9f0586c69 for another reference (and generally https://github.com/ocornut/imgui/wiki/Useful-Extensions#rich-text).

Having something like this in dear imgui itself instead of being reimplemented (often poorly) would be a small win.

You are right.

The reasons something like this is not in yet:

  • I've been shy of adding too many new colors in the style system, while the expectation is that this will be boldly reworked. Admittedly this is a bit of a procrastination tactic at this point.
  • It'd be awkward to implement/demo an "open browser" thing at least in the demo as that's quite OS dependent. And it may be nice if links would open without user need to wrap link+action, but that's optional. See ImOsOpenInShell() in https://github.com/ocornut/imgui_test_engine/blob/main/imgui_test_engine/imgui_te_utils.cpp. I wonder if if we should add this to dear imgui behind a function pointer stored in ImGuiIO, defaulting to a internal version of ImOsOpenInShell but letting user override.
  • It'd been hoping to include this as part of a larger rework of text functions, so it would be easily to include in wrapping text, markups etc. But arguably we would likely still need a helper API entry point similar to one you suggested.

I'm going to keep this open and see if we can implement something simple.

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.