humbleui

jlmr 2024-09-22T07:04:32.257459Z

Hi I’ve noticed that when using canvas and trying the “new” paint spec with more than one paint the JVM crashes:

(canvas/draw-rect canvas (util/irect-ltrb l t r b) (ui/paint [{:stroke "ffffff"} {:fill "000000"}]))
Just two lines from the core dump:
# Problematic frame:
# C  [libskija.dylib+0x308d2c]  SkPaint::nothingToDraw() const+0x10
It works fine if I stick to a simple paint:
(canvas/draw-rect canvas (util/irect-ltrb l t r b) (ui/paint {:stroke "ffffff"}))
Is this a bug in Humble?

jlmr 2024-09-23T07:33:59.192419Z

Thanks!

jlmr 2024-09-23T07:35:10.410639Z

I’m still playing around with the whiteboard example. I find myself implementing functionality in canvas like dragging widgets around. Is that the best way you think?

Niki 2024-09-23T09:56:13.767269Z

Depends. There’s also a draggable component, although I only used if for splits, so API might be lacking. Let me know if you need anything added to it

Niki 2024-09-22T08:59:22.590999Z

Yeah, canvas was not re-thought yet. It used Skia api more or less directly, so expects paint object, not spec. Here’s how to do it:

(ui/with-paint ctx [paint [{:stroke "ffffff"}
                           {:fill "000000"}]]
  (canvas/draw-rect canvas (util/irect-ltrb l t r b) paint))

Niki 2024-09-22T08:59:49.151879Z

I’ll update canvas namespace later, probably a good idea