This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-25
Channels
- # announcements (6)
- # asami (1)
- # babashka (80)
- # beginners (89)
- # bitcoin (1)
- # calva (30)
- # cider (33)
- # clj-kondo (1)
- # cljsrn (45)
- # clojars (5)
- # clojure (60)
- # clojure-australia (1)
- # clojure-dev (9)
- # clojure-europe (133)
- # clojure-italy (7)
- # clojure-nl (6)
- # clojure-uk (44)
- # clojurescript (11)
- # conjure (1)
- # data-oriented-programming (2)
- # datahike (13)
- # datascript (4)
- # datomic (19)
- # deps-new (29)
- # depstar (5)
- # duct (39)
- # fulcro (8)
- # girouette (1)
- # helix (10)
- # honeysql (17)
- # jobs (5)
- # jobs-discuss (2)
- # leiningen (6)
- # lsp (51)
- # malli (60)
- # meander (37)
- # membrane (8)
- # off-topic (31)
- # overtone (3)
- # pathom (36)
- # re-frame (8)
- # reagent (30)
- # remote-jobs (2)
- # sci (1)
- # sql (32)
- # startup-in-a-month (3)
- # testing (3)
- # tools-deps (7)
- # xtdb (7)
Is there anything glaring that I'm missing from my circle
implementation for skija that is preventing it from working with center
? The rectangle works fine
(defrecord Circle [rad]
ui/IOrigin
(-origin [_]
[0 0])
ui/IBounds
(-bounds [this]
[(* rad 2) (* rad 2)])
skija/IDraw
(draw [this]
(.drawCircle ^Canvas skija/*canvas* 0.0 0.0 (float rad)
(skija/map->paint skija/*paint*))))
(defn draw []
(let [x 500
y 350
circ
(ui/translate x y
(ui/with-color [1.0 0.7529411764705882 0.796078431372549]
(Circle. 50)))
rect
(ui/translate 100 100
(ui/with-color [0.6784313725490196 0.8470588235294118 0.9019607843137255]
(ui/rectangle 100 100)))]
[rect
(ui/center
(ui/translate 100 100
(ui/label (str (ui/origin rect) "," (ui/bounds rect))))
(ui/bounds rect))
circ
(ui/center
(ui/translate x y
(ui/label (str (ui/origin circ) "," (ui/bounds circ))))
(ui/bounds circ))]))
the origin should be in the upper left. I don't know off the top of my head if .drawCircle draws from the center or not
I haven't had a chance to think through all the implications of having a negative origin, so there might be some issues with hit detection (if you're using the default ui/mouse-move
/`ui/mouse-down`/etc event functions when the origin is negative
if you are using the ui/mouse*
stuff, then you might want to translate the circle before drawing so you can have a >= 0 point of origin
What about just keeping the origin at [0 0]
and changing the skija drawCircle
call to use rad
as x and y
? because I did that and it seems to work
yea, as long as the origin >= [0,0]