humbleui

Quest 2023-04-04T18:10:08.817479Z

Here's a little gist for a Label that can text-wrap based on a fixed input width. https://gist.github.com/Quezion/74ff0685a92e54dc5eaf58f185214192 You can achieve the 'auto-wrapping' behavior in this gif by pulling the :window out of a dynamic's ctx and passing it along.

(ui/dynamic
 ctx
 [window-rect (window/window-rect (:window ctx))
  width (-> (- (._right window-rect) (._left window-rect))
            (* 0.99)
            (int))]
 (ui/center
  (ui/column
   (ui/wrap-label {:wrap-width width} (->> (cycle ["Foo" "Bar" "Baz"])
                                           (take 100)
                                           (interpose " ")
                                           (apply str))))))
The code isn't PR ready; besides being inefficient, there's probably some better way of specifying this behavior. Might involve extending :stretch to support floats and auto-set width of child elements? [:stretch 0.95 ...] Either way it'll be some weeks until I touch this again, so posting it here for the record

πŸ‘πŸ» 1
Niki 2023-04-05T12:02:45.909039Z

Nice! I think real implementation would require going into the depths of Skia and ICU, but this could do for now. Multi-line text is kind of a must, and I’ve been postponing it long enough. I might actually do a quick-and-dirty version for now based on your idea, if you don’t mind

πŸ’― 1
Niki 2023-04-05T16:26:24.724959Z

Done! https://github.com/HumbleUI/HumbleUI/commit/4632e2c6f559e63977b7a0f116d4b61e1e7d7645

2
πŸ“° 1
πŸŽ‰ 9
Niki 2023-04-05T16:27:05.101889Z

Suddenly Humble UI feels much more like real framework now

πŸ‘ 1
πŸŽ‰ 3
Quest 2023-04-05T17:31:00.506639Z

Thanks Niki, this really makes my morning! πŸ™‚ β€’ paragraph confirmed working as a drop-in replacement for wrap-label β€’ I had to update local JWM/HumbleUI, I see you've been busy β€’ Nice layout code, haven't seen loopr macro before Looking forward to more, but I'll be out for a couple weeks. (Still need to PR Win32 impl of SetTitlebarVisible, find a real fix for (dynamic (text-field ...)), & x-platform bring-to-front) A second thanks for all the help over the last weeks & back soon πŸ™

Niki 2023-04-05T17:31:54.648859Z

> find a real fix for (dynamic (text-field ...)), I’m working on it right now

Quest 2023-04-05T17:36:25.556869Z

That's awesome but no pressure. Knocking out paragraph in < 1 day is already some fantastic support πŸ˜‰ I expected this fix would take me several days to really grok what was happening in the library. I noticed that ctx :hui/focused? true was being inappropriately dropped by parent window/focusables but couldn't figure out why. Anyway, I'll keep an eye out for a PR; interested in knowing the mechanics happening here

Niki 2023-04-06T16:23:08.241049Z

If you are curious, I’m taking notes as I’m trying to figure it out. Peek here https://tonsky.notion.site/State-Management-d45ce7c481fa4c0fa1c82accbcbfc166

πŸ‘€ 2
Quest 2023-04-06T17:05:36.789729Z

Good notes. Humble UI's Endgame mentions should leverage Clojure macros; are you thinking akin to Membrane's defui (providing references and handling incidental state?)