Fork me on GitHub
#membrane
<
2023-03-13
>
Ben Sless09:03:01

Following our chats, how's that for a tabs view?

(defui tabbed [{:keys [tabs focus orientation]
                :or {orientation :left}}]
  (let [the-tabs
        (for [[text _] tabs]
          (let [hover? (get extra [:hover? text])]
            (basic/button {:text text
                           :hover? hover?
                           :on-click (fn [] [[:set $focus text]])})))]
    (case orientation
      :left
      (ui/horizontal-layout
       (apply ui/vertical-layout the-tabs)
       (get tabs focus))
      :right
      (ui/horizontal-layout
       (get tabs focus)
       (apply ui/vertical-layout the-tabs))
      :down
      (ui/vertical-layout
       (get tabs focus)
       (apply ui/horizontal-layout the-tabs))
      :up
      (ui/vertical-layout
       (apply ui/horizontal-layout the-tabs)
       (get tabs focus)))))

genekim23:03:38

https://clojurians.slack.com/archives/CQT1NFF4L/p1678736832100809?thread_ts=1678672410.695219&amp;channel=CQT1NFF4L&amp;message_ts=1678736832.100809 @smith.adriane holy cow. This is awesome. How did you do the “click to turn all edges from that node red?” I’m guessing you used your wrapper around graphviz, but how are you catching the event when node is clicked, and how are you turning the edges red? Thanks!

phronmophobic23:03:40

The edges are highlighted on mouse hover. The code is still a WIP, but I just pushed it https://github.com/phronmophobic/dewey/blob/main/examples/cosmos/src/cosmos_viewer.clj.

phronmophobic23:03:02

There are around 130k nodes, so I build an rtree before hand to make hit detection fast. Likewise, I also organize edges by id ahead of time.

phronmophobic05:03:06

Been trying out different color schemes and this one is my favorite.

🔥 2
phronmophobic04:03:09

Just the edges

🔥 2