diff --git a/frontend/src/arthur/domain/clip.cljs b/frontend/src/arthur/domain/clip.cljs index 595bf97..d060042 100644 --- a/frontend/src/arthur/domain/clip.cljs +++ b/frontend/src/arthur/domain/clip.cljs @@ -555,7 +555,9 @@ 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, 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 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 ;; later sits above one made earlier, and neither has to renumber. :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} :source {:symbol sid} :playback {:in 0 :speed speed :end :stop} diff --git a/frontend/src/arthur/events/ui.cljs b/frontend/src/arthur/events/ui.cljs index 97a33ff..6474729 100644 --- a/frontend/src/arthur/events/ui.cljs +++ b/frontend/src/arthur/events/ui.cljs @@ -883,7 +883,13 @@ seeded (assoc-in document [:symbols sid] new-symbol)] (span/place-symbol seeded st host instance-id sid at {: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)] (update db :project merge {:status why}) (let [selection [:node host instance-id (conj (vec down) instance-id)]] @@ -1026,7 +1032,7 @@ (rf/reg-event-db ::new-symbol-at ;; 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 ;; 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 @@ -1047,7 +1053,8 @@ palette? (assoc :type :palette))) result (span/place-symbol seeded st (:sid where) uuid sid (:at where) {:extent :grow-symbol - :remainder-id (random-uuid)}) + :remainder-id (random-uuid) + :speed 0}) result (if-let [placed (and palette? (:clip result))] (assoc result :clip (assoc-in placed [:symbols (:sid where) :nodes uuid diff --git a/frontend/test/arthur/domain/sequence_test.cljs b/frontend/test/arthur/domain/sequence_test.cljs index 5248810..6a4481f 100644 --- a/frontend/test/arthur/domain/sequence_test.cljs +++ b/frontend/test/arthur/domain/sequence_test.cljs @@ -879,3 +879,17 @@ (is (= 10 (get-in result [:clip :symbols :main :nodes :insert :time :at]))) (is (= (get-in doc [: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")))