Fork me on GitHub
#membrane
<
2020-08-29
>
genekim00:08:34

wild. (believe it or not, that’s not a word I use a lot… finding myself saying that a LOT in our interactions. hahahaha)

phronmophobic00:08:48

let me know if you experience any performance issues

phronmophobic00:08:43

one of the cool things about clojurizing a design is that, in my experience, using pure functions and values gives you design flexibility

genekim00:08:04

roger that! oh, one last question… what is best way to get the dimensions of the window, to best calculate the sizes of left/right, height/width of the panes?

phronmophobic00:08:20

here's an example with 1000's of hoverable items. it uses an RTree rather than the default mouse-move handler, https://blog.phronemophobic.com/treemap/images/hover-keypath-shrunk.gif

phronmophobic00:08:58

someone else was requesting getting the window dimensions, https://github.com/phronmophobic/membrane/issues/2

(def window-size (atom [400 400]))
(defn -reshape [window window-handle width height]
  (try
    (let [[xscale yscale :as content-scale] (skia/get-window-content-scale-size window-handle)
          width (/ width xscale)
          height (/ height yscale)]
      (reset! window-size [width height]))
    (catch Exception e
      (println e))
    (finally
      (skia/-reshape window window-handle width height))))

;; need to provide a `reshape` handler
(comment
  ;; run use the following
  (let [[window-width window-height] @window-size]
    (skia/run #(counter @window-size @counter-state)
      {:handlers {:reshape -reshape}
       :window-start-width window-width
       :window-start-height window-height})))

genekim00:08:12

HEY! I read that blog article in my RSS reader! I loved it! I had no idea you wrote it! So cool!!!

phronmophobic00:08:37

I think the above snippet is the relevant bit

phronmophobic00:08:44

the only part that would be different for you is instead of #(counter @window-size @counter-state), you would have something like #(memframe/re-frame-app (todo-app))

genekim00:08:17

Hahaha. I remember reading that article, marveling at the UI, wondering how the author built it. And I was just about to ask you, as you talk about your design goals, I’d love to understand what in the world you’re writing that would cause you to rewrite your own UI framework, almost from scratch. So hilarious that both questions are now somewhat answered. Cool, I’ll give that a shot…. Maybe tonight. Gotta go feed kids. Thanks for all the hand holding. I’ll write an experience report, as well, to put in an issue and sample program.

phronmophobic00:08:14

thanks so much for plowing through all the rough edges!

phronmophobic00:08:00

the goal is to build something like http://worrydream.com/DrawingDynamicVisualizationsTalkAddendum/ , except instead of dynamic drawings, building actual dynamic user interfaces. Bret Victor doesn't talk about how to do event handling, so that's an area I've been working on.

genekim03:08:09

Bret Victor! Amazing! I love that lecture he did in Portland five years ago — https://www.youtube.com/watch?v=agOdP2Bmieg. I haven’t watched that video in years, but I remember being blown away when I first watched it. I’lll watch in again tonight. After I get search and selection working in app. 🙂

phronmophobic06:08:14

it's been a while since I've watched his series of talks. I'll have to go through them again

genekim05:08:16

@smith.adriane First time I’ve made an animated GIF — shows clicking to select, as well as using j/k to select. Next up: search! 🙂

genekim05:08:41

(Just realized I cut the portion with the scrolling — I’ll post another one when I get search working. 🙂

phronmophobic06:08:48

fyi, this is the script I've been using for making gifs from mov files:

f="demo1.mov"
ffmpeg -i "$f" -filter_complex "setpts=0.25*PTS,split=[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" `basename "$f" .mov`".gif"
the 0.25 in the script speeds up the video by 4x

genekim06:08:26

And I just got search/filtering working! I’ll post movie in just a second! Thanks for your help!

genekim06:08:24

Holy cow, this is great! You can see the scrolling strangeness 15s in… filtering at 30s. So fun.. and just in case you can’t tell, I’m super happy that I could build something with utility! (link to 80MB movie in dropbox.). Thanks for all your great work and your help! https://www.dropbox.com/s/dz832r85jxtd90u/demo2.mov?dl=0

genekim06:08:28

Have great night!

phronmophobic06:08:08

checking it out! have a great night!

genekim06:08:16

Oh, another potentially far out request: Is it possible to copy/paste text from a scrollview?

phronmophobic06:08:07

like with text selection or just generally?

genekim06:08:16

Umm, don’t know? Any way to select text, and then copy to clipboard would be great. (I now recall that I saw copy to clipboard as an event, but no way. to click/drag/select text.)

phronmophobic06:08:50

I haven't built a way to generically select text from labels

genekim06:08:42

Roger that! (makes one not take all these native UI widgets for granted!!! 😂. Okay, catch you likely over the weekend. Much fun planned!!! 🙂

genekim06:08:48

Have a great Friday night!

phronmophobic06:08:36

text selection and copy and paste work in text areas, but not in labels. if you're copying full snippets (like the titles), I've added little copy buttons that just paste to clipboard:

(defn copy-to-clipboard! [s]
  (let [selection (StringSelection. s)
        clipboard (.getSystemClipboard (Toolkit/getDefaultToolkit))]
    (.setContents clipboard selection selection)))

phronmophobic06:08:53

(:import
   java.awt.Toolkit
   java.awt.datatransfer.StringSelection
   java.awt.datatransfer.Clipboard)

genekim06:08:10

Oh wait. What are the other ways to render text besides ui/label? I might be using the wrong UI widget. (Umm, what is the right term for scrollarea, button, label?)

phronmophobic06:08:15

all the text rendering uses ui/label

phronmophobic06:08:42

but there are other views that render text (they use ui/label under the hood) like buttons

genekim06:08:35

Thx! Roger that. Okay, have a great night! 🎉

phronmophobic06:08:45

have great night!