The palette beside the tools picks the next colour, not the selection's
Picking a slot there recoloured whatever was selected as well, so choosing a colour for the next shape repainted the last one, which is usually still selected because it was just drawn. It now only says what is drawn next. Something already drawn is recoloured in the inspector, whose colour row now offers clear and remap after the slots, as the strip does, so a shape can still be made a knockout or a remap, and turned back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2eb5944a78
commit
d2245d7720
3 changed files with 54 additions and 41 deletions
|
|
@ -9,8 +9,9 @@
|
|||
|
||||
Shapes store only the selected local slot number. Palette identity is supplied
|
||||
by the symbol tree, and the colour input edits the project palette asset.
|
||||
Picking a slot also recolours whatever is selected; picking CLEAR makes it a
|
||||
knockout — select a lens, pick clear, and it is a hole.
|
||||
Picking a slot says what the NEXT shape is drawn in and nothing else; picking
|
||||
CLEAR makes that a knockout. What is already drawn is recoloured in the
|
||||
inspector, whose colour row offers the same slots, clear and remap.
|
||||
|
||||
The footage switch is NOT here. It is a viewing aid rather than something you
|
||||
set before you draw, so it is a section of the inspector. See `ui/params`."
|
||||
|
|
@ -18,7 +19,6 @@
|
|||
[arthur.domain.clip :as clip]
|
||||
[arthur.domain.raster :as raster]
|
||||
[arthur.footage.store :as store]
|
||||
[arthur.domain.node :as node]
|
||||
[arthur.domain.palette :as pal]
|
||||
[arthur.domain.symbol :as symbol]
|
||||
[arthur.subs.playback :as playback]
|
||||
|
|
@ -74,15 +74,14 @@
|
|||
[clip pid (get (pal/palettes clip) pid) followed]))
|
||||
|
||||
(defn- pick!
|
||||
"Make `tone` the colour new shapes get, and recolour what is selected."
|
||||
[tone placements]
|
||||
(rf/dispatch [::ui/set-tone tone])
|
||||
(let [edits (into [] (keep (fn [{:keys [sid id node frame]}]
|
||||
(when (contains? (get node/valid-paths (:kind node)) [:style :color])
|
||||
{:sid sid :id id :path [:style :color] :frame frame :value tone})))
|
||||
placements)]
|
||||
(when (seq edits)
|
||||
(rf/dispatch [::project/set-channels edits]))))
|
||||
"Make `tone` the colour the next shape is drawn in.
|
||||
|
||||
WHAT IS SELECTED IS LEFT ALONE. Picking a colour to draw with recoloured the
|
||||
selection too, so choosing a colour for the next shape repainted the last one
|
||||
— which is usually still selected, because it was just drawn. Recolouring
|
||||
something already drawn is the inspector's colour swatches."
|
||||
[tone]
|
||||
(rf/dispatch [::ui/set-tone tone]))
|
||||
|
||||
;; ---------------------------------------------------------------------------
|
||||
;; remap: a shape that lights what is under it
|
||||
|
|
@ -156,7 +155,7 @@
|
|||
:title (if (= i from) (str i " — as it is") (str "slot " i))
|
||||
:on-click #(do (map-slot! rm from i) (reset! open nil))}]))])]))))
|
||||
|
||||
(defn- swatch [pid i {:keys [name hex]} tone placements rm hex-of used?]
|
||||
(defn- swatch [pid i {:keys [name hex]} tone rm hex-of used?]
|
||||
(let [picker-id (str "palette-picker-" pid "-" i)
|
||||
to (get (:map rm) i)]
|
||||
[:div.slot {:key i}
|
||||
|
|
@ -174,7 +173,7 @@
|
|||
(.preventDefault e)
|
||||
(let [from (js/parseInt (.getData (.-dataTransfer e) "application/x-arthur-slot"))]
|
||||
(when (and rm (not (js/isNaN from))) (map-slot! rm from i))))
|
||||
:on-click #(pick! i placements)
|
||||
:on-click #(pick! i)
|
||||
:on-double-click (fn [e]
|
||||
(.preventDefault e)
|
||||
(some-> (js/document.getElementById picker-id) (.click)))}
|
||||
|
|
@ -189,7 +188,6 @@
|
|||
(let [[clip pid palette followed] (shown)
|
||||
tone @(rf/subscribe [::sub/tone])
|
||||
solo? @(rf/subscribe [::render/palette-solo?])
|
||||
placements @(rf/subscribe [::sub/selected-placements])
|
||||
used (conj (pal/slots-used (vals (:symbols clip))) pal/bg-slot)
|
||||
hex (when (number? tone) (:hex (get (:slots palette) tone)))]
|
||||
[:div.palette-grid
|
||||
|
|
@ -206,23 +204,23 @@
|
|||
[:span (cond (= :clear tone) "×" (symbol/remap? tone) "⇄" :else tone)]]
|
||||
[:div.cells
|
||||
(let [rm (remap) hex-of #(:hex (get (:slots palette) %))]
|
||||
(doall (map-indexed #(swatch pid %1 %2 tone placements rm hex-of (contains? used %1))
|
||||
(doall (map-indexed #(swatch pid %1 %2 tone rm hex-of (contains? used %1))
|
||||
(:slots palette))))
|
||||
[:div.slot
|
||||
[:button {:class (str "cell clear" (when (= :clear tone) " on"))
|
||||
:title "clear — draws a knockout: a hole in its symbol"
|
||||
:on-click #(pick! :clear placements)}]]
|
||||
:on-click #(pick! :clear)}]]
|
||||
[:div.slot
|
||||
[:button {:class (str "cell map" (when (symbol/remap? tone) " on"))
|
||||
:title "remap — draws light: what is under it is drawn in other slots of the palette. Set which in the inspector."
|
||||
:on-click #(pick! [:remap {}] placements)}
|
||||
:on-click #(pick! [:remap {}])}
|
||||
"⇄"]]]
|
||||
[:div.grid-tools
|
||||
[:button {:class (when solo? "on")
|
||||
:disabled (not (number? tone))
|
||||
:title (if solo?
|
||||
"showing only what is drawn in this colour — click one to select it; click again to show everything"
|
||||
"show only what is drawn in the chosen colour, to find and recolour it")
|
||||
"show only what is drawn in the chosen colour, to find it and recolour it in the inspector")
|
||||
:aria-pressed (boolean solo?)
|
||||
:on-click #(rf/dispatch [::solo])}
|
||||
"◎"]
|
||||
|
|
|
|||
|
|
@ -214,19 +214,38 @@
|
|||
(field 0 v put)
|
||||
(doall (map-indexed (fn [i x] (field i x #(put (assoc (vec v) i %)))) v)))))
|
||||
|
||||
(defn- swatches [value off? palette pick!]
|
||||
[:span.chan-swatches
|
||||
(doall
|
||||
(for [[i {:keys [name hex]}] (map-indexed vector (:slots palette))]
|
||||
^{:key i}
|
||||
[:button.swatch
|
||||
{:class (when (= i value) "on")
|
||||
:style {:background hex}
|
||||
:disabled off?
|
||||
:aria-label (str "color " i (when name (str " " (clojure.core/name name))))
|
||||
:aria-pressed (= i value)
|
||||
:title (str i (when name (str " · " (clojure.core/name name))) " · " hex)
|
||||
:on-click #(pick! i)}]))])
|
||||
(defn- swatches
|
||||
"A shape's colour, to change: every slot, then clear and remap, as the strip
|
||||
beside the tools offers them for the next shape. This is where something
|
||||
already drawn is recoloured — the strip only says what is drawn next."
|
||||
[v off? palette pick!]
|
||||
;; A slot by name is the slot of that name.
|
||||
(let [value (cond (integer? v) v
|
||||
(keyword? v) (first (keep-indexed #(when (= v (:name %2)) %1) (:slots palette))))]
|
||||
[:span.chan-swatches
|
||||
(doall
|
||||
(for [[i {:keys [name hex]}] (map-indexed vector (:slots palette))]
|
||||
^{:key i}
|
||||
[:button.swatch
|
||||
{:class (when (= i value) "on")
|
||||
:style {:background hex}
|
||||
:disabled off?
|
||||
:aria-label (str "color " i (when name (str " " (clojure.core/name name))))
|
||||
:aria-pressed (= i value)
|
||||
:title (str i (when name (str " · " (clojure.core/name name))) " · " hex)
|
||||
:on-click #(pick! i)}]))
|
||||
[:button.swatch.clear
|
||||
{:class (when (= :clear v) "on")
|
||||
:disabled off?
|
||||
:aria-label "clear" :aria-pressed (= :clear v)
|
||||
:title "clear — a knockout: a hole in its symbol"
|
||||
:on-click #(pick! :clear)}]
|
||||
[:button.swatch.map
|
||||
{:class (when (symbol/remap? v) "on")
|
||||
:disabled off?
|
||||
:aria-label "remap" :aria-pressed (boolean (symbol/remap? v))
|
||||
:title "remap — lights what is under it in other slots; set which below"
|
||||
:on-click #(when-not (symbol/remap? v) (pick! [:remap {}]))}]]))
|
||||
|
||||
(defn- channel-value
|
||||
"The editor for channel `path` of node `n`: boxes, a switch, swatches — or,
|
||||
|
|
@ -246,13 +265,7 @@
|
|||
(str (quot (count v) 2) " points")]
|
||||
|
||||
(= path [:style :color])
|
||||
(if (symbol/remap? v)
|
||||
[:span.dim "remap ↓"]
|
||||
;; A slot by name is the slot of that name; a knockout is none.
|
||||
(swatches (if (keyword? v)
|
||||
(first (keep-indexed #(when (= v (:name %2)) %1) (:slots palette)))
|
||||
(when (integer? v) v))
|
||||
off? palette put))
|
||||
(swatches v off? palette put)
|
||||
|
||||
(boolean? v)
|
||||
[:input {:type "checkbox" :checked v :disabled off?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue