Hold a new cel in a lane, so stretching it shows what is drawn in it

A double-clicked or newly created cel in a lane was a one-frame symbol
playing at speed 1 and stopping at its end, so dragging its edge out left
every frame past the first empty. It is now held at speed 0, as a drawing
cel already is: the two are the same lane-creation operation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Olive Vaughn 2026-10-10 19:45:38 -04:00
parent cd02eb0477
commit 641f1fa18c
3 changed files with 28 additions and 5 deletions

View file

@ -555,7 +555,9 @@
of the symbol plays on `frame` of `host`, which is what dragging something onto of the symbol plays on `frame` of `host`, which is what dragging something onto
a playhead is asking for. Its `:span` is in its OWN frames — the whole symbol, a playhead is asking for. Its `:span` is in its OWN frames — the whole symbol,
0 to its length at `speed` — wherever it was dropped; see `node/placed-span`. 0 to its length at `speed` — wherever it was dropped; see `node/placed-span`.
`speed` is 1 unless the symbol's frames are footage's at another rate. `speed` is 1 unless the symbol's frames are footage's at another rate, and 0
for a held cel, which shows its symbol's first frame and so starts one frame
long, as `span/held` does.
Refused, returning the clip unchanged, when it would make a cycle: a symbol Refused, returning the clip unchanged, when it would make a cycle: a symbol
cannot be placed inside itself or inside anything it places." cannot be placed inside itself or inside anything it places."
@ -575,7 +577,7 @@
;; Lexicographic draw order, as `domain/paint` does it: an instance made ;; Lexicographic draw order, as `domain/paint` does it: an instance made
;; later sits above one made earlier, and neither has to renumber. ;; later sits above one made earlier, and neither has to renumber.
:z (str "z" (js/Date.now) "-" (name sid)) :z (str "z" (js/Date.now) "-" (name sid))
:span [0 (js/Math.ceil (/ (:frames target) speed))] :span [0 (if (pos? speed) (js/Math.ceil (/ (:frames target) speed)) 1)]
:time {:mode :map :at frame :rate 1} :time {:mode :map :at frame :rate 1}
:source {:symbol sid} :source {:symbol sid}
:playback {:in 0 :speed speed :end :stop} :playback {:in 0 :speed speed :end :stop}

View file

@ -883,7 +883,13 @@
seeded (assoc-in document [:symbols sid] new-symbol)] seeded (assoc-in document [:symbols sid] new-symbol)]
(span/place-symbol seeded st host instance-id sid at (span/place-symbol seeded st host instance-id sid at
{:extent :grow-symbol {:extent :grow-symbol
:remainder-id (random-uuid)})))] :remainder-id (random-uuid)
;; Held like a drawing cel, so
;; stretching it shows what is drawn
;; in it across the whole cel.
:speed (if (and (= :lane destination-kind)
(not lane?))
0 1)})))]
(if-let [why (:refused result)] (if-let [why (:refused result)]
(update db :project merge {:status why}) (update db :project merge {:status why})
(let [selection [:node host instance-id (conj (vec down) instance-id)]] (let [selection [:node host instance-id (conj (vec down) instance-id)]]
@ -1026,7 +1032,7 @@
(rf/reg-event-db (rf/reg-event-db
::new-symbol-at ::new-symbol-at
;; ONE GESTURE AND ONE CREATION PATH FOR EVERY LANE. Empty space in a lane ;; ONE GESTURE AND ONE CREATION PATH FOR EVERY LANE. Empty space in a lane
;; takes a new one-frame symbol at the frame double-clicked -- the pointer ;; takes a new one-frame held symbol at the frame double-clicked -- the pointer
;; names a place in time as well as a lane, which is the whole of the gesture ;; names a place in time as well as a lane, which is the whole of the gesture
;; and the reason it is not the playhead's. The DESTINATION decides what is ;; and the reason it is not the playhead's. The DESTINATION decides what is
;; created there: a clip of a palette track is a palette symbol whose ;; created there: a clip of a palette track is a palette symbol whose
@ -1047,7 +1053,8 @@
palette? (assoc :type :palette))) palette? (assoc :type :palette)))
result (span/place-symbol seeded st (:sid where) uuid sid (:at where) result (span/place-symbol seeded st (:sid where) uuid sid (:at where)
{:extent :grow-symbol {:extent :grow-symbol
:remainder-id (random-uuid)}) :remainder-id (random-uuid)
:speed 0})
result (if-let [placed (and palette? (:clip result))] result (if-let [placed (and palette? (:clip result))]
(assoc result :clip (assoc result :clip
(assoc-in placed [:symbols (:sid where) :nodes uuid (assoc-in placed [:symbols (:sid where) :nodes uuid

View file

@ -879,3 +879,17 @@
(is (= 10 (get-in result [:clip :symbols :main :nodes :insert :time :at]))) (is (= 10 (get-in result [:clip :symbols :main :nodes :insert :time :at])))
(is (= (get-in doc [:symbols :wave :nodes]) (is (= (get-in doc [:symbols :wave :nodes])
(get-in result [:clip :symbols :wave :nodes]))))) (get-in result [:clip :symbols :wave :nodes])))))
(deftest a-held-placement-shows-its-first-frame-for-as-long-as-it-lasts
(let [lane (-> (document)
(assoc-in [:symbols :main] {:id :main :frames 40 :display :lane :nodes {}})
(assoc-in [:symbols :blank] {:id :blank :frames 1 :nodes {}}))
placed (:clip (span/place-symbol lane nil :main :cel :blank 0
{:extent :grow-symbol :remainder-id :r :speed 0}))
stretched (:clip (span/resize-out placed :main :cel 6 {:extent :grow-symbol}))
n (get-in stretched [:symbols :main :nodes :cel])]
(is (= [0 1] (node/placed-span (get-in placed [:symbols :main :nodes :cel])))
"a held cel starts one frame long rather than its symbol's length over zero")
(is (= [0 6] (node/placed-span n)))
(is (every? #(= {:symbol :blank :frame 0} (node/placed-frame n % 1)) (range 6))
"stretched, every frame of it shows the one drawing")))