From fbcbcd032188ec707c572a9c4045ed1ab4a4c006 Mon Sep 17 00:00:00 2001 From: Olive Vaughn Date: Sat, 10 Oct 2026 21:38:35 -0400 Subject: [PATCH 01/17] The pool is a tree of what places what, and deletes A drawing is named by where it is drawn, `body 12`, until it is given a name of its own. The pool lists each symbol under what places it, with the root's lanes always showing and anything placed nowhere at the top, where it wants looking at. Delete or the cross removes a symbol and its placements, asking first when it is used anywhere. Co-Authored-By: Claude Opus 5.5 --- frontend/src/arthur/domain/clip.cljs | 52 ++++++- frontend/src/arthur/domain/nest.cljs | 17 +++ frontend/src/arthur/domain/span.cljs | 12 +- frontend/src/arthur/events/project.cljs | 6 +- frontend/src/arthur/events/ui.cljs | 71 +++++++-- frontend/src/arthur/ui/pool.cljs | 140 +++++++++++++----- .../test/arthur/domain/instance_test.cljs | 25 +++- frontend/test/arthur/domain/nest_test.cljs | 13 ++ frontend/test/arthur/events/export_test.cljs | 4 +- static/arthur/app.css | 13 ++ 10 files changed, 285 insertions(+), 68 deletions(-) diff --git a/frontend/src/arthur/domain/clip.cljs b/frontend/src/arthur/domain/clip.cljs index 9bb0257..4c46bcb 100644 --- a/frontend/src/arthur/domain/clip.cljs +++ b/frontend/src/arthur/domain/clip.cljs @@ -66,10 +66,56 @@ [sym] (= :trace (:type sym))) -(defn symbol-name - "What to call a symbol: its `:name`, or its id when it has none." +(defonce ^:private placed-cache (atom nil)) + +(defn placements + "Where every symbol is placed: `{sid [[owner frame] ...]}`, earliest first, + where `owner` is the symbol whose node places it and `frame` is where in the + owner that node starts. + + Cached by IDENTITY of the document, as `raster` caches a palette: a document + is a value, so the same object means the same answer, and names and the pool + ask this once per symbol per render." + [clip] + (let [cached @placed-cache] + (if (identical? clip (:clip cached)) + (:index cached) + (let [index (-> (reduce (fn [m [owner sym]] + (reduce (fn [m [_ n]] + (if-let [sid (node/source n)] + (update m sid (fnil conj []) + [owner (:at (node/time-of n))]) + m)) + m (:nodes sym))) + {} (:symbols clip)) + (update-vals #(vec (sort-by second %))))] + (reset! placed-cache {:clip clip :index index}) + index)))) + +(defn owners + "The symbols that place `sid`, each once." [clip sid] - (or (:name (symbol clip sid)) (name sid))) + (into [] (comp (map first) (distinct)) (get (placements clip) sid))) + +(defn symbol-name + "What to call a symbol: its `:name`, or where it is when it has none. + + A DRAWING IS NAMED BY WHERE IT IS DRAWN. One placed by exactly one symbol + reads as that symbol's name and the frame it starts on — `body 12` — worked + out on every read, so renaming the lane renames its drawings and moving one + renames it. A symbol placed nowhere, or in two places, has no one place to be + named by and reads as its id. A `:name` that is just the id is no name: older + documents stored one on every drawing." + ([clip sid] (symbol-name clip sid #{})) + ([clip sid seen] + (let [given (:name (symbol clip sid)) + [owner :as os] (owners clip sid)] + (cond + (and given (not= given (name sid))) given + (and (= 1 (count os)) (not (seen owner))) + (str (symbol-name clip owner (conj seen sid)) " " + (js/Math.floor (second (first (get (placements clip) sid))))) + :else (name sid))))) (defn node-label "What to call node `n` on screen. diff --git a/frontend/src/arthur/domain/nest.cljs b/frontend/src/arthur/domain/nest.cljs index cccfdcd..c6f084c 100644 --- a/frontend/src/arthur/domain/nest.cljs +++ b/frontend/src/arthur/domain/nest.cljs @@ -253,6 +253,23 @@ [clip sid id] (clip/update-symbol clip sid update :nodes #(apply dissoc % (subtree % id)))) +(defn delete-symbol + "Symbol `sid` gone from the library, with every node that places it — as + deleting a library item in Flash takes its instances with it. What it placed + stays, placed nowhere now, for whoever deletes it next. `{:clip}`, or + `{:refused why}` for the root, which is what the document opens on." + [clip sid] + (cond + (not (clip/symbol clip sid)) {:refused "there is no such symbol"} + (= sid (clip/opens-on clip)) {:refused "the project opens on this symbol; it cannot be deleted"} + :else + {:clip (reduce (fn [c [owner _]] + (reduce (fn [c [id n]] + (if (= sid (node/source n)) (delete-node c owner id) c)) + c (:nodes (clip/symbol c owner)))) + (update clip :symbols dissoc sid) + (:symbols clip))})) + (defn- transplant "Move node `id` from symbol `host`, where frame `frame` is showing, into symbol `target`, keeping where it is on screen and when. `carry` is the matrix from diff --git a/frontend/src/arthur/domain/span.cljs b/frontend/src/arthur/domain/span.cljs index 26d56f2..2863b6d 100644 --- a/frontend/src/arthur/domain/span.cljs +++ b/frontend/src/arthur/domain/span.cljs @@ -701,7 +701,7 @@ (when (clip/symbol clip drawing-id) "the new drawing ID is already used"))] {:refused why} (place (assoc-in clip [:symbols drawing-id] - {:id drawing-id :name (name drawing-id) :frames 1 :nodes {}}) + {:id drawing-id :frames 1 :nodes {}}) sid id drawing-id at extent true))) (defn reuse-drawing @@ -774,7 +774,7 @@ (clip/symbol clip drawing-id) "the new drawing ID is already used")] {:refused why} (let [c (assoc-in clip [:symbols drawing-id] - {:id drawing-id :name (name drawing-id) :frames 1 :nodes {}}) + {:id drawing-id :frames 1 :nodes {}}) nodes (assoc nodes id (held id drawing-id at))] (claim c sid nodes id extent remainder-id))))) @@ -810,10 +810,10 @@ :else (let [c (assoc-in clip [:symbols drawing-id] (if from - ;; Its own name: it is a new drawing, and two of one - ;; name in the library is a question nobody asked. - (assoc (clip/symbol clip from) :id drawing-id :name (name drawing-id)) - {:id drawing-id :name (name drawing-id) :frames 1 :nodes {}}))] + ;; No name: it is a new drawing, named by where it + ;; is drawn, and two of one name is a question nobody asked. + (-> (clip/symbol clip from) (assoc :id drawing-id) (dissoc :name)) + {:id drawing-id :frames 1 :nodes {}}))] (if (= f next-lo) ;; A cel starts right here, so there is no room: make some. (place c sid new-id drawing-id f extent true) diff --git a/frontend/src/arthur/events/project.cljs b/frontend/src/arthur/events/project.cljs index b9121ba..860fcc7 100644 --- a/frontend/src/arthur/events/project.cljs +++ b/frontend/src/arthur/events/project.cljs @@ -694,9 +694,9 @@ ;; a rename coalesce with whatever edit happened next. ;; ;; BLANK REMOVES THE NAME rather than storing an empty one. `clip/symbol-name` - ;; falls back to the id, so a symbol cleared of its name reads as `main` - ;; again instead of as a row with nothing on it — and the document carries no - ;; field it did not need. + ;; falls back to where the symbol is drawn, or its id, so a symbol cleared of + ;; its name reads as `body 12` or `main` again instead of as a row with + ;; nothing on it — and the document carries no field it did not need. (let [value (not-empty (str/trim (str value)))] (if-not (clip/symbol (:clip (store/entry (:clip/current db))) sid) db diff --git a/frontend/src/arthur/events/ui.cljs b/frontend/src/arthur/events/ui.cljs index 9815690..f109dab 100644 --- a/frontend/src/arthur/events/ui.cljs +++ b/frontend/src/arthur/events/ui.cljs @@ -1163,10 +1163,8 @@ (if (:refused where) (update db :project merge {:status (:refused where)}) (let [seeded (assoc-in document [:symbols sid] - (cond-> {:id sid - :name (if palette? "palette transition" (name sid)) - :frames 1 :nodes {}} - palette? (assoc :type :palette))) + (cond-> {:id sid :frames 1 :nodes {}} + palette? (assoc :type :palette :name "palette transition"))) result (span/place-symbol seeded st (:sid where) uuid sid (:at where) {:extent :grow-symbol :remainder-id (random-uuid) @@ -1441,30 +1439,73 @@ (boolean (get-in db [:ui :auto-key?])) st)) % edits)))))) -(rf/reg-event-db +(rf/reg-fx + ::confirm + (fn [{:keys [message then]}] + (when (js/confirm message) (rf/dispatch then)))) + +(rf/reg-event-fx + ::delete-symbol + ;; Out of the library, with its placements; see `nest/delete-symbol`. Its tab + ;; closes, and if it was on screen the root takes its place. + ;; + ;; ASKED FIRST WHEN IT IS PLACED, because then the delete reaches past the row + ;; you pointed at, into every symbol that uses it. One placed nowhere goes + ;; without a question; undo is there either way. + (fn [{:keys [db]} [_ sid sure?]] + (let [clip (:clip (store/entry (:clip/current db))) + {gone :clip why :refused} (nest/delete-symbol clip sid) + uses (clip/uses clip sid)] + (cond + why + {:db (refused db why)} + + (and (pos? uses) (not sure?)) + {::confirm {:message (str "Delete " (clip/symbol-name clip sid) "? It is used " + (if (= 1 uses) "once" (str uses " times")) ", in " + (str/join ", " (map #(clip/symbol-name clip %) + (clip/owners clip sid))) + ", and every use of it goes too.") + :then [::delete-symbol sid true]}} + + :else + (cond-> {:db (-> db + (edit/transaction (constantly gone)) + (update-in [:ui :tabs] #(vec (remove #{sid} %))) + (update :ui (fn [ui] + (cond-> ui + (= [:symbol sid] (:selection ui)) + (assoc :selection nil :selections [])))))} + (= sid (get-in db [:ui :open])) + (assoc :dispatch [::playback/open-symbol (clip/opens-on gone)])))))) + +(rf/reg-event-fx ::delete-selected ;; Backspace while drawing takes the last point back, as in Illustrator; on - ;; the pen, with a point of the selected shape picked, it takes that point. - (fn [db _] + ;; the pen, with a point of the selected shape picked, it takes that point. A + ;; symbol picked in the pool is deleted from the library. + (fn [{:keys [db]} _] (let [[vsid vid i] (get-in db [:ui :vertex]) primary (get-in db [:ui :selection])] (cond (seq (get-in db [:ui :draft])) - (update-in db [:ui :draft] #(subvec % 0 (- (count %) 2))) + {:db (update-in db [:ui :draft] #(subvec % 0 (- (count %) 2)))} (and i (= :pen (get-in db [:ui :tool])) (= [:node vsid vid] (take 3 primary))) - (deleting-vertex db vsid vid i) + {:db (deleting-vertex db vsid vid i)} + + (= :symbol (first primary)) + {:dispatch [::delete-symbol (second primary)]} :else (let [many (vec (get-in db [:ui :selections])) selections (if (some #{primary} many) many (if primary [primary] [])) nodes (distinct (keep (fn [[kind sid id]] (when (= :node kind) [sid id])) selections))] - (if (seq nodes) - (-> db - (edit/transaction #(reduce (fn [c [sid id]] (nest/delete-node c sid id)) % nodes)) - (assoc-in [:ui :selection] nil) - (assoc-in [:ui :selections] [])) - db)))))) + (when (seq nodes) + {:db (-> db + (edit/transaction #(reduce (fn [c [sid id]] (nest/delete-node c sid id)) % nodes)) + (assoc-in [:ui :selection] nil) + (assoc-in [:ui :selections] []))})))))) (rf/reg-event-db ::restack diff --git a/frontend/src/arthur/ui/pool.cljs b/frontend/src/arthur/ui/pool.cljs index e574bbc..65f32c5 100644 --- a/frontend/src/arthur/ui/pool.cljs +++ b/frontend/src/arthur/ui/pool.cljs @@ -15,13 +15,12 @@ looking at and puts the number on its tab. THE MAIN TIMELINE LEADS, and it is `clip/opens-on`'s answer rather than a - name: the longest symbol nothing else places is the one the project plays and - the one the work happens in, so it gets the top of the pane and a row drawn at - a size you can read a pose off. Every other symbol is the list under it. That - is one list and not two — every symbol here IS a timeline, and heading a - section TIMELINES and the next one SYMBOLS would name the same thing twice. - None of it is `:main` being special either: rename it, place it inside - something else, and the pool follows the document. + name: the symbol the project plays and the one the work happens in, so it gets + the top of the pane and a row drawn at a size you can read a pose off. Every + other symbol is the tree under it: what nothing places beside it at the top, + and the rest under whatever places it — see `this-project`. None of it is + `:main` being special either: rename it, place it inside something else, and + the pool follows the document. Every row is a drag source, and what it carries says what it is: `symbol:` for a symbol of this document, `import:||` for @@ -199,13 +198,27 @@ its own under the name — `sub2` — rather than one of them out at the edge. `rename` is `{:key :value :begin! :commit!}` and is what makes a row - renameable at all: a row without one has no pencil and does not answer F2." - [{:keys [label sub sub2 title thumb on? open? main? disabled? rename] :as opts}] + renameable at all: a row without one has no pencil and does not answer F2. + + `depth` puts a row in a tree: indented that far, with a twisty ahead of it. + `inside` is `{:count :open? :flip!}` for a row with rows under it; a row with + none keeps the twisty's room, so names line up down a level. + + `delete!` puts a cross beside the pencil, on hover as the pencil is." + [{:keys [label sub sub2 title thumb on? open? main? disabled? rename depth inside delete!] + :as opts}] (let [{:keys [key value begin! commit!]} rename editing? (boolean (and key (= key (:editing rename))))] [:div.pool-row {:class (str (when main? "main ") (when on? "on ") (when open? "open ") (when disabled? "disabled ") - (when editing? "editing"))} + (when editing? "editing")) + :style (when depth {:padding-left (+ 4 (* 10 depth))})} + (when depth + (if-let [{:keys [count open? flip!]} inside] + [:span.pool-twisty {:title (str count " inside") + :on-click (fn [^js e] (.stopPropagation e) (flip!))} + (if open? "\u25BE" "\u25B8")] + [:span.pool-twisty])) (if editing? ;; The input REPLACES the row rather than floating over it, so the list ;; does not change height while you type in it. @@ -235,7 +248,7 @@ (.preventDefault e) (begin! key))))} (dissoc opts :label :sub :sub2 :title :on? :open? :main? - :disabled? :thumb :rename)) + :disabled? :thumb :rename :depth :inside :delete!)) thumb [:span.text ;; The label is `.text`'s first child and stays that way: it is how @@ -250,13 +263,19 @@ ;; being avoided, and F2 already reaches it from the keyboard. :on-click (fn [^js e] (.stopPropagation e) (begin! key))} "\u270E"]) + (when delete! + [:span.pool-rename.pool-delete + {:title (str "delete " label " (Delete)") + :on-click (fn [^js e] (.stopPropagation e) (delete!))} + "\u00D7"]) ;; The main row says both its facts under the name instead. (when (and sub (not main?)) [:span.sub sub])]])])) ;; --------------------------------------------------------------------------- ;; the rows of each kind -(defn- symbol-row [document sid {:keys [clip-id store palette selection open main rename]}] +(defn- symbol-row [document sid {:keys [clip-id store palette selection open main rename + depth inside]}] (let [sym (clip/symbol document sid) label (clip/symbol-name document sid) nodes (count (:nodes sym))] @@ -276,6 +295,9 @@ :on? (= selection [:symbol sid]) :open? (= sid open) :main? (= sid main) + :depth depth + :inside inside + :delete! (when-not (= sid main) #(rf/dispatch [::ui/delete-symbol sid])) :rename (assoc rename :key [:symbol sid] :value label @@ -427,23 +449,62 @@ [:div.pool-empty "no match in this scope"] (into [:<>] (map section) children))) +(def ^:private own-section? + "Symbols with a section of their own, kept out of the tree." + #{:palette :palette-track :trace}) + +(defn- listed? [document sid] + (not (own-section? (:type (clip/symbol document sid))))) + +(defn- placed-in + "What each symbol places, as `{owner [sid ...]}`: each once, in the order they + first start in it." + [document] + (reduce-kv (fn [m sid at] + (if (listed? document sid) + (reduce-kv (fn [m owner [[_ f]]] (update m owner (fnil conj []) [f sid])) + m (group-by first at)) + m)) + {} (clip/placements document))) + +(defn- tree + "`sid`'s row and, while it is open, the rows of what it places under it. A + symbol placed in two symbols is under both. `path` is what this row is under, + which keys the row and stops a cycle." + [{:keys [document placed expanded flip! main] :as ctx} sid depth path] + (let [kids (->> (get placed sid) (sort-by (juxt first (comp str second))) + (map second) (remove (set (conj path sid)))) + root? (and (= main sid) (empty? path)) + open? (and (seq kids) (or root? (contains? expanded [path sid])))] + (into [(with-meta (symbol-row document sid + (assoc ctx :depth depth + :inside (when (and (seq kids) (not root?)) + {:count (count kids) :open? open? + :flip! #(flip! [path sid])}))) + {:key (str (conj path sid))})] + (when open? + (mapcat #(tree ctx % (inc depth) (conj path sid)) kids))))) + (defn- this-project - "The open document's own, with the main timeline at the top and every other - symbol under it. + "The open document's own: its symbols as the tree of what places what, then + each kind with a section of its own. - NOT \"TIMELINES AND SYMBOLS\". Every symbol in this model IS a timeline — it - has frames and nodes and you open it and work in it — so a pair of headings - naming those two things names one thing twice, and invites a reader to go - looking for the difference. There is one list of symbols. What is true is that - exactly one of them is where the work happens: `clip/opens-on`'s answer, the - longest symbol nothing else places. That gets the top of the pane and a row - drawn like the thing it is, and the rest of the library is the list below it. + WHAT NOTHING PLACES IS AT THE TOP, and everything else is under what places + it. Drawing makes a symbol per drawing, and a flat list of every one buries the + few that matter; a drawing is under its lane, its lane under its scene. What + is left at the top is the root the project opens on, drawn big and first with + what it places always showing under it, and + whatever is placed nowhere — a scene, something made to be placed later, or + something left behind — which is what wants looking at: keep it, place it, or + delete it. Nothing is ever cleared away for you. - Still not `:main` being special. The document says which symbol that is by its - structure; rename it, place it inside something else, and the pool follows." + One rule for every symbol, worked out from the document on each render and + stored nowhere: place it, unplace it, and the pool follows. + + A SEARCH IS FLAT: you asked for it by name, and a hit inside a closed twisty is + a hit you cannot see." [{:keys [document query searching? media sounds images chosen rename main selection] :as ctx}] (let [named? #(hit? query (clip/symbol-name document %)) - top (when (and main (named? main)) main) symbol-ids (sort-by str (keys (:symbols document))) transition-ids (into #{} (mapcat (fn [sym] (when (= :palette-track (:type sym)) @@ -454,22 +515,24 @@ transitions (filterv #(and (named? %) (transition? %)) symbol-ids) tracing (filterv #(and (named? %) (clip/trace? (clip/symbol document %))) symbol-ids) - rest (filterv #(and (named? %) (not= main %) - (not (#{:palette :palette-track :trace} - (:type (clip/symbol document %))))) - symbol-ids) + listed (filterv #(listed? document %) symbol-ids) + symbols (if searching? + (mapv #(symbol-row document % ctx) (filterv named? listed)) + (let [ctx (assoc ctx :placed (placed-in document)) + top (cond->> (filterv #(and (not= main %) + (empty? (clip/owners document %))) + listed) + (contains? (:symbols document) main) (into [main]))] + (into [] (mapcat #(tree ctx % 0 [])) top))) media (filterv #(hit? query (:label %)) media) sounds (filterv #(hit? query (:label %)) sounds) images (filterv #(hit? query (:label %)) images)] [sections searching? - (+ (if top 1 0) (count rest) (count transitions) (count tracing) + (+ (count symbols) (count transitions) (count tracing) (count media) (count sounds) (count images)) - [{:title "project" :searching? searching? + [{:title "symbols" :searching? searching? :blank "nothing to open yet" - :rows (when top [(symbol-row document top ctx)])} - {:title "symbols" :searching? searching? - :blank "nothing else in the library" - :rows (mapv #(symbol-row document % ctx) rest)} + :rows symbols} {:title "tracing layers" :searching? searching? :blank "no tracing layers yet" :rows (mapv #(symbol-row document % ctx) tracing)} @@ -559,7 +622,10 @@ ;; Which row is being renamed, as `[kind id]`. One atom rather ;; than a flag per row: exactly one name is ever being edited, and ;; opening a second input has to close the first. - editing (r/atom nil)] + editing (r/atom nil) + ;; Which tree rows are open, as `[path sid]`. Everything under + ;; the root's own children starts shut — see `tree`. + expanded (r/atom #{})] (let [{:keys [loading? status available sounds images uploaded chosen]} @(rf/subscribe [::playback/footage]) document @(rf/subscribe [::sub/settled-clip]) @@ -596,7 +662,9 @@ ;; else places is the timeline the work happens in, and it is the ;; one row in this pane drawn big enough to read a pose off. :main (clip/opens-on document) - :rename {:editing @editing :begin! #(reset! editing %)}} + :rename {:editing @editing :begin! #(reset! editing %)} + :expanded @expanded + :flip! #(swap! expanded (fn [open] (if (open %) (disj open %) (conj open %))))} tallies (counts ctx) files? (fn [^js e] (some #{"Files"} (array-seq (.. e -dataTransfer -types))))] [:section.pane.pool diff --git a/frontend/test/arthur/domain/instance_test.cljs b/frontend/test/arthur/domain/instance_test.cljs index f4585e9..ceb43d5 100644 --- a/frontend/test/arthur/domain/instance_test.cljs +++ b/frontend/test/arthur/domain/instance_test.cljs @@ -267,6 +267,25 @@ (is (= (get-in c [:symbols :outer :nodes]) (get-in (leaf/clip "c" (leaf/leaves "c" c)) [:symbols :outer :nodes])))))) +(deftest a-drawing-is-named-by-where-it-is-drawn + (let [c (assoc-in (nested) [:symbols :outer :name] "body")] + (testing "placed by one symbol: that symbol's name and the frame it starts on" + (is (= [:outer] (clip/owners c :inner))) + (is (= "body 5" (clip/symbol-name c :inner))) + (is (= "lane 5" (clip/symbol-name (assoc-in c [:symbols :outer :name] "lane") :inner)) + "renaming the lane renames its drawings")) + (testing "a name of its own wins, and one that is only the id is no name" + (is (= "hand" (clip/symbol-name (assoc-in c [:symbols :inner :name] "hand") :inner))) + (is (= "body 5" (clip/symbol-name (assoc-in c [:symbols :inner :name] "inner") :inner)))) + (testing "placed nowhere, or in two symbols, it is its id" + (is (= "loose" (clip/symbol-name c :loose))) + (is (= "inner" (clip/symbol-name (clip/place-symbol c nil :loose :inner 0 (random-uuid) nil) + :inner)))) + (testing "a cycle of unnamed symbols ends rather than recurring" + (let [loop (clip/place-symbol (update-in c [:symbols :outer] dissoc :name) + nil :inner :outer 0 (random-uuid) nil)] + (is (string? (clip/symbol-name loop :inner))))))) + (deftest an-instance-is-labelled-by-what-it-places (let [c (-> (nested) (assoc-in [:symbols :inner :name] "mouth")) @@ -278,9 +297,9 @@ (is (= "mouth" (clip/node-label c id n))) (is (= "jaw" (clip/node-label (assoc-in c [:symbols :inner :name] "jaw") id n)) "renaming the symbol renames every row that shows an instance of it")) - (testing "an unnamed symbol falls back to its id, not to the node's uuid" - (is (= "inner" (clip/node-label (update-in c [:symbols :inner] dissoc :name) - id n)))) + (testing "an unnamed symbol is named by where it is drawn, not by the node's uuid" + (is (= "outer 5" (clip/node-label (update-in c [:symbols :inner] dissoc :name) + id n)))) (testing "and a name left on the instance is not read: it has none of its own" (is (= "mouth" (clip/node-label c id (assoc n :name "left eye"))))) (testing "every placement of a symbol is counted" diff --git a/frontend/test/arthur/domain/nest_test.cljs b/frontend/test/arthur/domain/nest_test.cljs index 2d3473b..13f29ec 100644 --- a/frontend/test/arthur/domain/nest_test.cljs +++ b/frontend/test/arthur/domain/nest_test.cljs @@ -560,3 +560,16 @@ (is (near? [10 90] (piv c))) (is (near? [10 90] (piv grown)) "the pivot moved because something else was drawn, which is the bug"))) + +(deftest deleting-a-symbol-takes-its-placements-and-leaves-what-it-placed + (let [c (-> (clip/blank) + (assoc-in [:symbols :lane] {:id :lane :frames 10 :nodes {}}) + (assoc-in [:symbols :cel] {:id :cel :frames 1 :nodes {}}) + (clip/place-symbol nil :main :lane 0 (random-uuid) nil) + (clip/place-symbol nil :lane :cel 3 (random-uuid) nil)) + {gone :clip} (nest/delete-symbol c :lane)] + (is (nil? (clip/symbol gone :lane))) + (is (empty? (:nodes (clip/symbol gone :main))) "its instance in the root went with it") + (is (clip/symbol gone :cel) "what it placed stays") + (is (empty? (clip/owners gone :cel)) "placed nowhere now") + (is (:refused (nest/delete-symbol c :main)) "the root cannot be deleted"))) diff --git a/frontend/test/arthur/events/export_test.cljs b/frontend/test/arthur/events/export_test.cljs index a92c334..75e933f 100644 --- a/frontend/test/arthur/events/export_test.cljs +++ b/frontend/test/arthur/events/export_test.cljs @@ -67,11 +67,11 @@ :kind :instance :parent :root :z "a1" :source {:symbol :sym/face}} :a-rect {:id :a-rect :kind :rect :parent :root :z "a3"}}} - :sym/face {:frames 40 :nodes {:root {:id :root :kind :group :z "a1"}}}}}) + :sym/face {:name "head" :frames 40 :nodes {:root {:id :root :kind :group :z "a1"}}}}}) (deftest the-picker-offers-every-symbol-then-every-instance-in-the-open-one (let [ts (export/targets clip :main)] - (is (= ["main" "face" "face 1" "face 2"] (mapv :label ts)) + (is (= ["main" "face" "head 1" "head 2"] (mapv :label ts)) "every symbol, then the instances in the open one") (testing "the instances isolate a node in the open symbol and the symbols do not" (is (= [nil nil] (mapv :isolate (take 2 ts)))) diff --git a/static/arthur/app.css b/static/arthur/app.css index d3363bb..e16348d 100644 --- a/static/arthur/app.css +++ b/static/arthur/app.css @@ -600,6 +600,19 @@ button.share-button:hover, button.share-button.on { filter: brightness(1.1); } } .pool-row:hover:not(.disabled) { background: #fff; } + +/* A tree row's disclosure: what this symbol places, shut until asked. A row + with nothing under it keeps the width, so names line up down a level. */ +.pool-twisty { + flex: none; + width: 10px; + color: var(--dim); + cursor: pointer; + text-align: center; + user-select: none; +} +.pool-twisty:empty { cursor: default; } +.pool-twisty:hover:not(:empty) { color: var(--fg); } .pool-row.on { background: var(--sel-bg); border-color: var(--sel); } /* WHICH ONE IS OPEN, as a mark and not as the word "open" — a list this narrow From 831843aeb029e0949e2509250404be9c793975c4 Mon Sep 17 00:00:00 2001 From: Olive Vaughn Date: Sat, 10 Oct 2026 21:42:05 -0400 Subject: [PATCH 02/17] N's symbols are named by where they are drawn too Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011FLuCjp9kNH6ovwJVXSbq9 --- frontend/src/arthur/events/ui.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/arthur/events/ui.cljs b/frontend/src/arthur/events/ui.cljs index f109dab..90a0124 100644 --- a/frontend/src/arthur/events/ui.cljs +++ b/frontend/src/arthur/events/ui.cljs @@ -970,7 +970,7 @@ (or (nil? end) (>= at end)) {:refused "the playhead is past the end of this symbol"} :else - (let [new-symbol (cond-> {:id sid :name (name sid) + (let [new-symbol (cond-> {:id sid ;; A fresh cel is one frame for ;; frame-by-frame work. In an ;; ordinary composition the new From 2f6fde26fb8cc7a0c83a3508fadf8f4b68faa14b Mon Sep 17 00:00:00 2001 From: Olive Vaughn Date: Sat, 10 Oct 2026 23:18:21 -0400 Subject: [PATCH 03/17] Paste onto your own paste goes beside it A paste selects what it made, and went into what was selected, so pasting a symbol twice nested the second copy inside the first. Figma's rule: while the selection is still exactly what the last paste made, paste goes where that one went. Select anything else and it follows the selection. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011FLuCjp9kNH6ovwJVXSbq9 --- frontend/src/arthur/events/ui.cljs | 25 ++++++++++++++---- frontend/test/arthur/events/lane_test.cljs | 30 +++++++++++++++++++++- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/frontend/src/arthur/events/ui.cljs b/frontend/src/arthur/events/ui.cljs index 90a0124..d67ce86 100644 --- a/frontend/src/arthur/events/ui.cljs +++ b/frontend/src/arthur/events/ui.cljs @@ -584,11 +584,25 @@ (edit/transaction (constantly (:clip r))) (select-results [])))))))) +(defn- paste-anchor + "The selection a paste goes by: the selection, unless it is still exactly + what the last paste made, and then whatever that paste went by. + + FIGMA'S RULE. A paste goes into what is selected and selects what it made, + so without this pasting a symbol twice put the second copy inside the first, + and a third inside that. Pasting again onto your own paste means another one + beside it; select anything else and paste follows the selection again." + [db] + (let [{:keys [made from]} (get-in db [:ui :paste])] + (if (and made (= made (current-selections db))) + from + (get-in db [:ui :selection])))) + (defn paste-destination "The effective creation context at the playhead, in the destination's frames." [db clip st] (creation/target clip st (get-in db [:ui :open]) - (get-in db [:ui :selection]) (editing-frame db clip))) + (paste-anchor db) (editing-frame db clip))) (rf/reg-event-db ::paste @@ -602,10 +616,11 @@ r (clipboard/paste clip payload sid frame {:fresh-id random-uuid})] (if-let [why (:refused r)] (command-refused db why) - (-> db - (edit/transaction (constantly (:clip r))) - (select-results - (mapv (fn [id] [:node sid id (conj path id)]) (:roots r)))))))))) + (let [made (mapv (fn [id] [:node sid id (conj path id)]) (:roots r))] + (-> db + (edit/transaction (constantly (:clip r))) + (select-results made) + (assoc-in [:ui :paste] {:from (paste-anchor db) :made made}))))))))) (defn- duplicate-selected [db unique?] (let [clip (:clip (store/entry (:clip/current db))) diff --git a/frontend/test/arthur/events/lane_test.cljs b/frontend/test/arthur/events/lane_test.cljs index aefaa67..37e5da8 100644 --- a/frontend/test/arthur/events/lane_test.cljs +++ b/frontend/test/arthur/events/lane_test.cljs @@ -1,5 +1,5 @@ (ns arthur.events.lane-test - (:require [cljs.test :refer [deftest is]] + (:require [cljs.test :refer [deftest is testing]] [arthur.domain.clip :as clip] [arthur.domain.creation :as creation] [arthur.domain.history :as history] @@ -316,6 +316,34 @@ (select-keys (ui/paste-destination db doc nil) [:sid :path :frame])) "an inactive selected symbol falls back to the open symbol"))) +(deftest pasting-onto-your-own-paste-goes-beside-it + (let [doc {:fps 24 :width 20 :height 20 + :symbols + {:main {:id :main :frames 40 + :nodes {:drawing {:id :drawing :kind :instance :z "a" + :span [0 10] :time {:at 0 :rate 1} + :source {:symbol :inside} + :playback {:in 0 :speed 1 :end :stop}}}} + :inside {:id :inside :frames 10 :nodes {}}}} + id (store/install! {:clip doc :store {}} "paste-beside") + instances #(count (get-in (store/entry id) [:clip :symbols % :nodes]))] + (reset! rf-db/app-db {:clip/current id :paint/revision 0 + :ui {:open :main :selection [:node :main :drawing [:drawing]]} + :playback {:frame 2}}) + (rf/dispatch-sync [::ui/copy]) + (rf/dispatch-sync [::ui/select [:node :main nil []]]) + (rf/dispatch-sync [::ui/paste]) + (is (= 2 (instances :main))) + (rf/dispatch-sync [::ui/paste]) + (rf/dispatch-sync [::ui/paste]) + (is (= 4 (instances :main)) + "the selected copy is a symbol under the playhead, and the paste still goes beside it") + (is (= 0 (instances :inside))) + (testing "selecting something else makes paste follow the selection again" + (rf/dispatch-sync [::ui/select [:node :main :drawing [:drawing]]]) + (is (= :inside (:sid (ui/paste-destination @rf-db/app-db + (:clip (store/entry id)) {}))))))) + (deftest multi-paste-uses-one-current-primary-target-and-selects-the-batch (let [doc (fixture/document) id (store/install! {:clip doc :store {}} "multi-paste-target") From 0291d7c6283037f7cca803f6647bfc8c38a8ed6c Mon Sep 17 00:00:00 2001 From: Olive Vaughn Date: Sat, 10 Oct 2026 23:21:49 -0400 Subject: [PATCH 04/17] The timeline's bar shows what the selection can take Blender's transport: the ends, the keys either side, a frame, play. Speed is one button that steps. In and out set the loop marks, as I and O do. Between them and making things, only what the selection can have done to it: key and blank in a lane, - and = on anything with a span, split where the playhead cuts it, and peg on one node, which leaves the edit menu with nothing a key does not already do, so it goes. A button and its key send the same thing, from one function. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011FLuCjp9kNH6ovwJVXSbq9 --- frontend/src/arthur/ui/icon.cljs | 1 + frontend/src/arthur/ui/shortcuts.cljs | 36 +---- frontend/src/arthur/ui/timeline.cljs | 159 ++++++++++++++++---- frontend/src/arthur/ui/topbar.cljs | 32 ---- frontend/test/arthur/ui/shortcuts_test.cljs | 4 +- static/arthur/app.css | 3 + 6 files changed, 142 insertions(+), 93 deletions(-) diff --git a/frontend/src/arthur/ui/icon.cljs b/frontend/src/arthur/ui/icon.cljs index 7c986b4..60d147a 100644 --- a/frontend/src/arthur/ui/icon.cljs +++ b/frontend/src/arthur/ui/icon.cljs @@ -30,6 +30,7 @@ (def ^:private glyphs {:start {:fill ["M2 2.5h1.3v7H2z" ; the bar it stops against "M10 2.5v7L4.2 6z"]} ; and the triangle into it + :end {:fill ["M8.7 2.5H10v7H8.7z" "M2 2.5v7L7.8 6z"]} :play {:fill ["M3.4 2.3L10 6 3.4 9.7z"]} :pause {:fill ["M3.3 2.4h1.9v7.2H3.3z" "M6.8 2.4h1.9v7.2H6.8z"]} diff --git a/frontend/src/arthur/ui/shortcuts.cljs b/frontend/src/arthur/ui/shortcuts.cljs index 8b9045d..64b2c75 100644 --- a/frontend/src/arthur/ui/shortcuts.cljs +++ b/frontend/src/arthur/ui/shortcuts.cljs @@ -24,7 +24,6 @@ (:require [arthur.events.history :as history] [arthur.events.playback :as pb] [arthur.events.ui :as ui] - [arthur.footage.store :as store] [arthur.ui.layout :as layout] [arthur.ui.timeline :as timeline] [clojure.string :as str] @@ -32,27 +31,6 @@ [re-frame.db :as db] [reagent.core :as r])) -(defn stops - "The frames ↑ and ↓ stop on: every key and every clip edge the timeline shows, - as frames of the open symbol. In a lane that is drawing to drawing, on a tween - key to key — one rule, read off the rows the timeline draws, so a jump lands - on something you can see." - [db] - (let [{document :clip} (store/entry (:clip/current db)) - selection (get-in db [:ui :selection]) - n (pb/frames db)] - (into (sorted-set) - (comp (mapcat (fn [{:keys [keys span cels]}] - (concat keys span (mapcat (juxt :span :keys) cels)))) - (mapcat #(if (number? %) [%] %)) - ;; The first whole frame that shows it, forgiving the rounding - ;; a mapped key picks up on its way through a clock. - (map #(js/Math.ceil (- % 1e-6))) - (filter #(< -1 % n))) - (when document - (timeline/rows document (get-in db [:ui :open]) (get-in db [:ui :expanded]) - (when (= :node (first selection)) (nth selection 3))))))) - (defn- frame [db] (get-in db [:playback :frame] 0)) (defn- seek [f] [::pb/seek f]) @@ -62,12 +40,10 @@ :note "hold and drag on the stage to pan"} {:label "Previous frame" :keys ["ArrowLeft" "a"] :run #(seek (dec (frame %)))} {:label "Next frame" :keys ["ArrowRight" "d"] :run #(seek (inc (frame %)))} - {:label "Previous key" :keys ["ArrowDown" "s"] - :run #(some-> (first (rsubseq (stops %) < (frame %))) seek)} - {:label "Next key" :keys ["ArrowUp" "w"] - :run #(some-> (first (subseq (stops %) > (frame %))) seek)} + {:label "Previous key" :keys ["ArrowDown" "s"] :run timeline/prev-key} + {:label "Next key" :keys ["ArrowUp" "w"] :run timeline/next-key} {:label "First frame" :keys ["Home" "shift+ArrowLeft" "shift+a"] :run (constantly (seek 0))} - {:label "Last frame" :keys ["End" "shift+ArrowRight" "shift+d"] :run #(seek (dec (pb/frames %)))} + {:label "Last frame" :keys ["End" "shift+ArrowRight" "shift+d"] :run timeline/last-frame} {:label "Mark in" :keys ["i"] :run (constantly [::pb/mark :in]) :note "playback loops between the marks"} {:label "Mark out" :keys ["o"] :run (constantly [::pb/mark :out])} @@ -83,12 +59,12 @@ ["Animate" [{:label "Key here" :keys ["k"] :note "in a lane, a copy of the drawing from the playhead on" - :run #(if (ui/lane-here %) [::ui/drawing-here true] [::ui/key-selected])} + :run timeline/key-here} {:label "Blank drawing here" :keys ["shift+k"] :run (constantly [::ui/drawing-here false])} {:label "One frame longer" :keys ["=" "+"] :note "moves the end of the selection's span" - :run #(when-let [p (ui/span-path %)] [::ui/slide p 1 :out true])} + :run (timeline/hold 1)} {:label "One frame shorter" :keys ["-"] - :run #(when-let [p (ui/span-path %)] [::ui/slide p -1 :out true])}]] + :run (timeline/hold -1)}]] ["Make" [{:label "New symbol" :keys ["n"] :run (constantly [::ui/new :inside false]) :note "in the selected symbol; in a lane, a blank drawing"} diff --git a/frontend/src/arthur/ui/timeline.cljs b/frontend/src/arthur/ui/timeline.cljs index 93e5af4..fa6dc86 100644 --- a/frontend/src/arthur/ui/timeline.cljs +++ b/frontend/src/arthur/ui/timeline.cljs @@ -41,6 +41,7 @@ [arthur.ui.layout :as layout] [arthur.ui.player :as player] [re-frame.core :as rf] + [re-frame.db :as rf-db] [reagent.core :as r])) ;; --------------------------------------------------------------------------- @@ -497,9 +498,60 @@ (aget cel "arthurCel"))) (array-seq (.elementsFromPoint js/document (.-clientX event) (.-clientY event))))) +(defn stops + "The frames ↑ and ↓ stop on: every key and every clip edge the timeline shows, + as frames of the open symbol. In a lane that is drawing to drawing, on a tween + key to key — one rule, read off the rows the timeline draws, so a jump lands + on something you can see." + [db] + (let [{document :clip} (store/entry (:clip/current db)) + selection (get-in db [:ui :selection]) + n (pb/frames db)] + (into (sorted-set) + (comp (mapcat (fn [{:keys [keys span cels]}] + (concat keys span (mapcat (juxt :span :keys) cels)))) + (mapcat #(if (number? %) [%] %)) + ;; The first whole frame that shows it, forgiving the rounding + ;; a mapped key picks up on its way through a clock. + (map #(js/Math.ceil (- % 1e-6))) + (filter #(< -1 % n))) + (when document + (rows document (get-in db [:ui :open]) (get-in db [:ui :expanded]) + (when (= :node (first selection)) (nth selection 3))))))) + +(defn- at [db] (get-in db [:playback :frame] 0)) + +;; WHAT A KEY AND ITS BUTTON BOTH SEND, as functions of the db answering the +;; event, or nil for nothing to do. `ui/shortcuts` puts them on keys and the +;; toolbar on buttons, so the two cannot come to mean different things. + +(defn prev-key [db] (some->> (first (rsubseq (stops db) < (at db))) (vector ::pb/seek))) +(defn next-key [db] (some->> (first (subseq (stops db) > (at db))) (vector ::pb/seek))) +(defn last-frame [db] [::pb/seek (dec (pb/frames db))]) + +(defn key-here + "K: in a lane, a new drawing from the playhead on, copying the one there; on + anything else, a key of what is selected." + [db] + (if (ui/lane-here db) [::ui/drawing-here true] [::ui/key-selected])) + +(defn hold + "= and −: the end of the selection's span, `delta` frames later." + [delta] + (fn [db] (when-let [p (ui/span-path db)] [::ui/slide p delta :out true]))) + +(rf/reg-sub + ::here + ;; Which of the toolbar's commands mean something for the selection right now. + (fn [db _] + {:lane? (some? (ui/lane-here db)) + :span? (some? (ui/span-path db))})) + ;; --------------------------------------------------------------------------- ;; the panes +(def ^:private speeds [[0.25 "¼×"] [0.5 "½×"] [1 "1×"] [2 "2×"] [4 "4×"]]) + (defn- transport [] (let [playing? @(rf/subscribe [::playback/playing?]) rate @(rf/subscribe [::playback/rate]) @@ -536,14 +588,27 @@ host (when (number? owner-frame) (span/host-frame clip sid id owner-frame)) cuttable? (and span? (integer? host) (let [[lo hi] (node/placed-span n)] (< lo host hi))) - act (fn [event] #(rf/dispatch event))] + act (fn [event] #(rf/dispatch event)) + ;; A command that reads the db when it is pressed, as a key does. + run (fn [f] #(some-> (f @rf-db/app-db) rf/dispatch)) + here @(rf/subscribe [::here]) + marks @(rf/subscribe [::playback/range]) + selections @(rf/subscribe [::sub/selections]) + ;; A peg goes over ONE node: it takes that node's place in the + ;; hierarchy, and there is no one place a pair of them would go. + one-node (when (= 1 (count selections)) + (let [[kind _ _ path] (first selections)] + (when (and (= :node kind) (seq path)) path)))] [:div.pane-head ;; ----------------------------------------------------------------- time ;; Where the playhead is and how it moves. Nothing here depends on a ;; selection, which is why it is the one group that is never greyed. + ;; Blender's timeline header: the ends, the keys, a frame, play. [:div.group [:button.ico {:aria-label "go to start" :title "go to the first frame (Home)" :on-click (act [::pb/seek 0])} [icon/view :start]] + [:button.ico {:aria-label "previous key" :title "back to the key or drawing before (↓ or S)" + :on-click (run prev-key)} [icon/view :prev]] [:button {:aria-label "−1" :title "step back one frame (← or A)" :on-click (act [::pb/step -1])} "−1"] [:button.ico.ico-play {:aria-label (if playing? "pause" "play") @@ -551,7 +616,11 @@ :on-click (act [::pb/toggle])} [icon/view (if playing? :pause :play)]] [:button {:aria-label "+1" :title "step forward one frame (→ or D)" - :on-click (act [::pb/step 1])} "+1"]] + :on-click (act [::pb/step 1])} "+1"] + [:button.ico {:aria-label "next key" :title "on to the key or drawing after (↑ or W)" + :on-click (run next-key)} [icon/view :next]] + [:button.ico {:aria-label "go to end" :title "go to the last frame (End)" + :on-click (run last-frame)} [icon/view :end]]] [:div.group [:button.ico {:class (when loop? "on") :aria-label "loop" :title "loop playback" :on-click (act [::pb/toggle-loop])} @@ -563,36 +632,68 @@ ;; read WHILE scrubbing, and tabular figures keep it from twitching as it ;; counts. [:span.readout.at-frame (str frame " / " frames)] - ;; Five buttons for one mutually exclusive choice that is 1× almost always. - ;; A select says "pick one of these" in the width of the answer. - ;; playbackRate on the audio element and nothing else: the sound slows, - ;; currentTime advances proportionally, and the derived frame follows. Slow - ;; motion cannot desync by construction. - [:span.pick - [:select {:value rate :aria-label "playback speed" :title "playback speed" - :on-change #(rf/dispatch [::pb/set-rate - (js/parseFloat (.. % -target -value))])} - (doall (for [[r label] [[0.25 "¼×"] [0.5 "½×"] [1.0 "1×"] [2.0 "2×"] [4.0 "4×"]]] - ^{:key r} [:option {:value r} label]))]] - [:span.sep] - ;; The same direct timing operations apply to any selected symbol clip, - ;; whether it is placed freely or lives in a lane. - [:div.group.timing-controls {:aria-label "timing"} - [:button {:disabled (not cuttable?) :aria-label "split" - :title "split the selected clip at the playhead" - :on-click (act [::ui/split])} "split"] - [:button {:disabled (not cuttable?) :aria-label "trim in" - :title "move the selected clip's start to the playhead" - :on-click (act [::ui/trim :in])} "in"] - [:button {:disabled (not cuttable?) :aria-label "trim out" - :title "move the selected clip's end to the playhead" - :on-click (act [::ui/trim :out])} "out"]] + ;; ONE BUTTON THAT SAYS THE SPEED AND STEPS IT, rather than a menu: it is + ;; 1× almost always, and a click is all the other four are away. Shift goes + ;; back. playbackRate on the audio element and nothing else: the sound + ;; slows, currentTime advances proportionally, and the derived frame + ;; follows. Slow motion cannot desync by construction. + (let [i (or (first (keep-indexed #(when (= rate (first %2)) %1) speeds)) 2)] + [:button.speed {:class (when (not= 1 rate) "on") :aria-label "playback speed" + :title "playback speed · click for faster, shift-click for slower" + :on-click (fn [^js e] + (let [j (mod (+ i (if (.-shiftKey e) -1 1)) (count speeds))] + (rf/dispatch [::pb/set-rate (first (nth speeds j))])))} + (second (nth speeds i))]) + ;; Resolve's I and O: where playback loops in the open tab. Lit while set, + ;; and shift takes one away, as on the keys. + [:div.group {:aria-label "loop marks"} + (doall + (for [[which word k] [[:in "in" "I"] [:out "out" "O"]]] + ^{:key which} + [:button {:class (when (get marks which) "on") + :title (str "mark " word " at the playhead (" k ")" + " · shift-click clears it (⇧" k ")") + :on-click (fn [^js e] + (rf/dispatch (if (.-shiftKey e) + [::pb/clear-mark which] + [::pb/mark which])))} + word]))] [:span.sep] + ;; WHAT THE SELECTION CAN HAVE DONE TO IT, and nothing else. A drawing in + ;; a lane takes a new drawing and a longer hold; a symbol placed anywhere + ;; takes a cut and a longer span; a node takes a key and a peg. Shown, not + ;; greyed, so the strip says what is possible here, and each says its key. + (let [{:keys [lane?] hold? :span?} here] + [:div.group.context-controls {:aria-label "selection"} + (when (or lane? one-node) + [:button {:title (if lane? + "a new drawing from the playhead on, copying the one there (K)" + "key the selection at the playhead (K)") + :on-click (run key-here)} "◆ key"]) + (when lane? + [:button {:title "a blank drawing from the playhead on (⇧K)" + :on-click (act [::ui/drawing-here false])} "□ blank"]) + (when hold? + [:<> + [:button {:aria-label "one frame shorter" :title "one frame shorter (−)" + :on-click (run (hold -1))} "−"] + [:button {:aria-label "one frame longer" :title "one frame longer (=)" + :on-click (run (hold 1))} "="]]) + (when cuttable? + [:button {:title "split the selected clip at the playhead" + :on-click (act [::ui/split])} "split"]) + (when (and one-node (not lane?)) + ;; The only way to keep a pivot, and the only way to transform a + ;; measured part by hand — which is what `gesture/refusal` tells you + ;; to do, so it has to be reachable from somewhere. + [:button {:title "a transform node over the selection · ⌃/⌘-drag its cross to place the pivot" + :on-click (act [::ui/peg one-node])} "peg"])]) + [:span.spacer] [:div.group.creation-controls {:aria-label "create"} - [:button {:title "create a symbol in the selected location" + [:button {:title "create a symbol in the selected location (N)" :on-click (act [::ui/new-symbol :inside])} [icon/view :symbol] " symbol"] - [:button {:title "create a lane in the selected location" + [:button {:title "create a lane in the selected location (⇧N)" :on-click (act [::ui/new-lane])} [icon/view :lane] " lane"]] [:button.auto-key {:class (when auto? "on") @@ -602,7 +703,7 @@ "auto-key edited parameters at this frame") :on-click (act [::ui/toggle-auto-key])} "◆ auto key"] - [:span.spacer] + [:span.sep] ;; How many pixels a frame is. The tracks are positioned in percentages of ;; their own width, so this is one custom property on the grid and no ;; arithmetic here — see `ui/layout`. diff --git a/frontend/src/arthur/ui/topbar.cljs b/frontend/src/arthur/ui/topbar.cljs index f7510e4..0ccb234 100644 --- a/frontend/src/arthur/ui/topbar.cljs +++ b/frontend/src/arthur/ui/topbar.cljs @@ -8,11 +8,8 @@ (:require [arthur.events.collab :as collab] [arthur.events.export :as export] [arthur.events.project :as project] - [arthur.events.ui :as ui] [arthur.subs.playback :as playback] - [arthur.subs.ui :as sub] [arthur.ui.layout :as layout] - [arthur.ui.menu :as menu] [arthur.ui.openmenu :as openmenu] [arthur.ui.settings :as settings] [arthur.ui.share :as share] @@ -57,14 +54,6 @@ (let [{project-name :name project-seq :seq :keys [busy? status]} @(rf/subscribe [::playback/project]) {footage-status :status} @(rf/subscribe [::playback/footage]) {export-status :status} @(rf/subscribe [::export/state]) - selections @(rf/subscribe [::sub/selections]) - clipboard @(rf/subscribe [::sub/clipboard]) - selected? (boolean (seq selections)) - ;; A peg goes over ONE node: it takes that node's place in the - ;; hierarchy, and there is no one place a pair of them would go. - one-node (when (= 1 (count selections)) - (let [[kind _ _ path] (first selections)] - (when (and (= :node kind) (seq path)) path))) title (or project-name "untitled") commit! (fn [] (rf/dispatch [::project/rename @draft]) @@ -79,27 +68,6 @@ [settings/new-project "new"] [openmenu/view] [undo/view] - [menu/view - {:label "edit" :title "selection and clipboard" - :items [{:label "copy" :sub "Copy selection · ⌘/Ctrl C" - :disabled? (not selected?) :on-click #(rf/dispatch [::ui/copy])} - {:label "cut" :sub "Cut selection · ⌘/Ctrl X" - :disabled? (not selected?) :on-click #(rf/dispatch [::ui/cut])} - {:label "paste" :sub "Paste at playhead into the active row · ⌘/Ctrl V" - :disabled? (nil? clipboard) :on-click #(rf/dispatch [::ui/paste])} - {:label "duplicate" :sub "Duplicate beside selection; lanes repeat forward · ⌘/Ctrl D" - :disabled? (not selected?) :on-click #(rf/dispatch [::ui/duplicate])} - {:label "duplicate unique" - :sub "Duplicate with a private nested symbol graph · ⇧⌘/Ctrl D" - :disabled? (not selected?) - :on-click #(rf/dispatch [::ui/duplicate-unique])} - ;; The only way to keep a pivot, and the only way to transform a - ;; measured part by hand — which is what `gesture/refusal` tells - ;; you to do, so it has to be reachable from somewhere. - {:label "add peg" - :sub "A transform node over the selection · ⌃/⌘-drag its cross to place the pivot" - :disabled? (nil? one-node) - :on-click #(rf/dispatch [::ui/peg one-node])}]}] [snapshots/view] (if @renaming? [:input.project-name {:auto-focus true :value @draft diff --git a/frontend/test/arthur/ui/shortcuts_test.cljs b/frontend/test/arthur/ui/shortcuts_test.cljs index 9eeb46e..75784f9 100644 --- a/frontend/test/arthur/ui/shortcuts_test.cljs +++ b/frontend/test/arthur/ui/shortcuts_test.cljs @@ -2,7 +2,7 @@ (:require [cljs.test :refer [deftest is]] [arthur.domain.sequence-test :as fixture] [arthur.footage.store :as store] - [arthur.ui.shortcuts :as shortcuts])) + [arthur.ui.timeline :as timeline])) (deftest the-key-jumps-stop-on-every-cel-edge-and-key-the-timeline-shows ;; Cels at 0, 4 and 8; `:b` keyed on its own frames 0 and 1, which it shows @@ -10,4 +10,4 @@ ;; last frame and is not somewhere to stand. (let [id (store/install! {:clip (fixture/document) :store {}} "shortcut-stops")] (is (= [0 4 5 8 11] - (vec (shortcuts/stops {:clip/current id :ui {:open :main}})))))) + (vec (timeline/stops {:clip/current id :ui {:open :main}})))))) diff --git a/static/arthur/app.css b/static/arthur/app.css index e16348d..b80fc30 100644 --- a/static/arthur/app.css +++ b/static/arthur/app.css @@ -1024,6 +1024,9 @@ button.share-button:hover, button.share-button.on { filter: brightness(1.1); } .loc-shared { flex: 0 0 auto; display: inline-flex; align-items: baseline; gap: 5px; } .loc .spacer { flex: 1; } .creation-controls button { display: inline-flex; align-items: center; gap: 4px; } +/* Wide enough for the widest speed it steps through, so the strip does not + shift as it changes. */ +.pane-head button.speed { min-width: 3.2em; font-variant-numeric: tabular-nums; } .creation-controls svg { width: 11px; height: 11px; } /* -------------------------------------------------------------------------- From b40564ad97b87c0bdad552e89d1cf121a12740d7 Mon Sep 17 00:00:00 2001 From: Olive Vaughn Date: Sat, 10 Oct 2026 23:52:23 -0400 Subject: [PATCH 05/17] A tap on a phone is a click, not a zoom Double-tap zoom is off from the root down, and the viewport's maximum scale keeps iOS from zooming into a small field when it takes focus. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011FLuCjp9kNH6ovwJVXSbq9 --- clips/templates/clips/index.html | 2 +- index.html | 2 +- static/arthur/app.css | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/clips/templates/clips/index.html b/clips/templates/clips/index.html index d73c62e..9d87f04 100644 --- a/clips/templates/clips/index.html +++ b/clips/templates/clips/index.html @@ -18,7 +18,7 @@ and PUTs with ordinary CSRF protection — no endpoint in this app is exempt. - + arthur diff --git a/index.html b/index.html index 31b4e0c..7d048e6 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + arthur