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
|
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.
|
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
|
Picking a slot says what the NEXT shape is drawn in and nothing else; picking
|
||||||
knockout — select a lens, pick clear, and it is a hole.
|
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
|
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`."
|
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.clip :as clip]
|
||||||
[arthur.domain.raster :as raster]
|
[arthur.domain.raster :as raster]
|
||||||
[arthur.footage.store :as store]
|
[arthur.footage.store :as store]
|
||||||
[arthur.domain.node :as node]
|
|
||||||
[arthur.domain.palette :as pal]
|
[arthur.domain.palette :as pal]
|
||||||
[arthur.domain.symbol :as symbol]
|
[arthur.domain.symbol :as symbol]
|
||||||
[arthur.subs.playback :as playback]
|
[arthur.subs.playback :as playback]
|
||||||
|
|
@ -74,15 +74,14 @@
|
||||||
[clip pid (get (pal/palettes clip) pid) followed]))
|
[clip pid (get (pal/palettes clip) pid) followed]))
|
||||||
|
|
||||||
(defn- pick!
|
(defn- pick!
|
||||||
"Make `tone` the colour new shapes get, and recolour what is selected."
|
"Make `tone` the colour the next shape is drawn in.
|
||||||
[tone placements]
|
|
||||||
(rf/dispatch [::ui/set-tone tone])
|
WHAT IS SELECTED IS LEFT ALONE. Picking a colour to draw with recoloured the
|
||||||
(let [edits (into [] (keep (fn [{:keys [sid id node frame]}]
|
selection too, so choosing a colour for the next shape repainted the last one
|
||||||
(when (contains? (get node/valid-paths (:kind node)) [:style :color])
|
— which is usually still selected, because it was just drawn. Recolouring
|
||||||
{:sid sid :id id :path [:style :color] :frame frame :value tone})))
|
something already drawn is the inspector's colour swatches."
|
||||||
placements)]
|
[tone]
|
||||||
(when (seq edits)
|
(rf/dispatch [::ui/set-tone tone]))
|
||||||
(rf/dispatch [::project/set-channels edits]))))
|
|
||||||
|
|
||||||
;; ---------------------------------------------------------------------------
|
;; ---------------------------------------------------------------------------
|
||||||
;; remap: a shape that lights what is under it
|
;; 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))
|
:title (if (= i from) (str i " — as it is") (str "slot " i))
|
||||||
:on-click #(do (map-slot! rm from i) (reset! open nil))}]))])]))))
|
: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)
|
(let [picker-id (str "palette-picker-" pid "-" i)
|
||||||
to (get (:map rm) i)]
|
to (get (:map rm) i)]
|
||||||
[:div.slot {:key i}
|
[:div.slot {:key i}
|
||||||
|
|
@ -174,7 +173,7 @@
|
||||||
(.preventDefault e)
|
(.preventDefault e)
|
||||||
(let [from (js/parseInt (.getData (.-dataTransfer e) "application/x-arthur-slot"))]
|
(let [from (js/parseInt (.getData (.-dataTransfer e) "application/x-arthur-slot"))]
|
||||||
(when (and rm (not (js/isNaN from))) (map-slot! rm from i))))
|
(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]
|
:on-double-click (fn [e]
|
||||||
(.preventDefault e)
|
(.preventDefault e)
|
||||||
(some-> (js/document.getElementById picker-id) (.click)))}
|
(some-> (js/document.getElementById picker-id) (.click)))}
|
||||||
|
|
@ -189,7 +188,6 @@
|
||||||
(let [[clip pid palette followed] (shown)
|
(let [[clip pid palette followed] (shown)
|
||||||
tone @(rf/subscribe [::sub/tone])
|
tone @(rf/subscribe [::sub/tone])
|
||||||
solo? @(rf/subscribe [::render/palette-solo?])
|
solo? @(rf/subscribe [::render/palette-solo?])
|
||||||
placements @(rf/subscribe [::sub/selected-placements])
|
|
||||||
used (conj (pal/slots-used (vals (:symbols clip))) pal/bg-slot)
|
used (conj (pal/slots-used (vals (:symbols clip))) pal/bg-slot)
|
||||||
hex (when (number? tone) (:hex (get (:slots palette) tone)))]
|
hex (when (number? tone) (:hex (get (:slots palette) tone)))]
|
||||||
[:div.palette-grid
|
[:div.palette-grid
|
||||||
|
|
@ -206,23 +204,23 @@
|
||||||
[:span (cond (= :clear tone) "×" (symbol/remap? tone) "⇄" :else tone)]]
|
[:span (cond (= :clear tone) "×" (symbol/remap? tone) "⇄" :else tone)]]
|
||||||
[:div.cells
|
[:div.cells
|
||||||
(let [rm (remap) hex-of #(:hex (get (:slots palette) %))]
|
(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))))
|
(:slots palette))))
|
||||||
[:div.slot
|
[:div.slot
|
||||||
[:button {:class (str "cell clear" (when (= :clear tone) " on"))
|
[:button {:class (str "cell clear" (when (= :clear tone) " on"))
|
||||||
:title "clear — draws a knockout: a hole in its symbol"
|
:title "clear — draws a knockout: a hole in its symbol"
|
||||||
:on-click #(pick! :clear placements)}]]
|
:on-click #(pick! :clear)}]]
|
||||||
[:div.slot
|
[:div.slot
|
||||||
[:button {:class (str "cell map" (when (symbol/remap? tone) " on"))
|
[: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."
|
: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
|
[:div.grid-tools
|
||||||
[:button {:class (when solo? "on")
|
[:button {:class (when solo? "on")
|
||||||
:disabled (not (number? tone))
|
:disabled (not (number? tone))
|
||||||
:title (if solo?
|
:title (if solo?
|
||||||
"showing only what is drawn in this colour — click one to select it; click again to show everything"
|
"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?)
|
:aria-pressed (boolean solo?)
|
||||||
:on-click #(rf/dispatch [::solo])}
|
:on-click #(rf/dispatch [::solo])}
|
||||||
"◎"]
|
"◎"]
|
||||||
|
|
|
||||||
|
|
@ -214,19 +214,38 @@
|
||||||
(field 0 v put)
|
(field 0 v put)
|
||||||
(doall (map-indexed (fn [i x] (field i x #(put (assoc (vec v) i %)))) v)))))
|
(doall (map-indexed (fn [i x] (field i x #(put (assoc (vec v) i %)))) v)))))
|
||||||
|
|
||||||
(defn- swatches [value off? palette pick!]
|
(defn- swatches
|
||||||
[:span.chan-swatches
|
"A shape's colour, to change: every slot, then clear and remap, as the strip
|
||||||
(doall
|
beside the tools offers them for the next shape. This is where something
|
||||||
(for [[i {:keys [name hex]}] (map-indexed vector (:slots palette))]
|
already drawn is recoloured — the strip only says what is drawn next."
|
||||||
^{:key i}
|
[v off? palette pick!]
|
||||||
[:button.swatch
|
;; A slot by name is the slot of that name.
|
||||||
{:class (when (= i value) "on")
|
(let [value (cond (integer? v) v
|
||||||
:style {:background hex}
|
(keyword? v) (first (keep-indexed #(when (= v (:name %2)) %1) (:slots palette))))]
|
||||||
:disabled off?
|
[:span.chan-swatches
|
||||||
:aria-label (str "color " i (when name (str " " (clojure.core/name name))))
|
(doall
|
||||||
:aria-pressed (= i value)
|
(for [[i {:keys [name hex]}] (map-indexed vector (:slots palette))]
|
||||||
:title (str i (when name (str " · " (clojure.core/name name))) " · " hex)
|
^{:key i}
|
||||||
:on-click #(pick! 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
|
(defn- channel-value
|
||||||
"The editor for channel `path` of node `n`: boxes, a switch, swatches — or,
|
"The editor for channel `path` of node `n`: boxes, a switch, swatches — or,
|
||||||
|
|
@ -246,13 +265,7 @@
|
||||||
(str (quot (count v) 2) " points")]
|
(str (quot (count v) 2) " points")]
|
||||||
|
|
||||||
(= path [:style :color])
|
(= path [:style :color])
|
||||||
(if (symbol/remap? v)
|
(swatches v off? palette put)
|
||||||
[: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))
|
|
||||||
|
|
||||||
(boolean? v)
|
(boolean? v)
|
||||||
[:input {:type "checkbox" :checked v :disabled off?
|
[:input {:type "checkbox" :checked v :disabled off?
|
||||||
|
|
|
||||||
|
|
@ -1809,7 +1809,8 @@ button.tl-gap:hover { background: rgba(47, 111, 192, .28); }
|
||||||
|
|
||||||
/* Clear is no colour: a knockout. Checkered, as transparency is everywhere. */
|
/* Clear is no colour: a knockout. Checkered, as transparency is everywhere. */
|
||||||
.palette-grid .clear,
|
.palette-grid .clear,
|
||||||
.palette-grid .chip.clear {
|
.palette-grid .chip.clear,
|
||||||
|
.swatch.clear {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
background-image:
|
background-image:
|
||||||
linear-gradient(45deg, #c9c9c5 25%, transparent 25%, transparent 75%, #c9c9c5 75%),
|
linear-gradient(45deg, #c9c9c5 25%, transparent 25%, transparent 75%, #c9c9c5 75%),
|
||||||
|
|
@ -1860,7 +1861,8 @@ button.tl-gap:hover { background: rgba(47, 111, 192, .28); }
|
||||||
shown as what is under the shape will be drawn in; the original is the chip
|
shown as what is under the shape will be drawn in; the original is the chip
|
||||||
in its corner. */
|
in its corner. */
|
||||||
.palette-grid .cell.map,
|
.palette-grid .cell.map,
|
||||||
.palette-grid .chip.map {
|
.palette-grid .chip.map,
|
||||||
|
.swatch.map {
|
||||||
background: linear-gradient(135deg, #3a3f52 0 50%, #e8d9a8 50% 100%);
|
background: linear-gradient(135deg, #3a3f52 0 50%, #e8d9a8 50% 100%);
|
||||||
color: #fff; font-size: 11px; line-height: 1; text-shadow: 0 1px 1px rgba(0, 0, 0, .6);
|
color: #fff; font-size: 11px; line-height: 1; text-shadow: 0 1px 1px rgba(0, 0, 0, .6);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue