Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc committed Jan 8, 2024
1 parent 0658c42 commit 28ade64
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
22 changes: 11 additions & 11 deletions src/renderer/element/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@
(fn [[elements hovered-keys selected-keys] _]
(vals (select-keys elements (set/union hovered-keys selected-keys)))))

(rf/reg-sub
:element/colors
:<- [:element/visible]
(fn [visible-elements _]
(reduce (fn [colors element]
(let [color (get-in element [:attrs :fill])]
(if (and color (color/isValidColor color))
(conj colors (keyword (:hex (color/parse color))))
colors)))
#{}
visible-elements)))
#_(rf/reg-sub
:element/colors
:<- [:element/visible]
(fn [visible-elements _]
(reduce (fn [colors element]
(let [color (get-in element [:attrs :fill])]
(if (and color (color/isValidColor color))
(conj colors (keyword (:hex (color/parse color))))
colors)))
#{}
visible-elements)))

(rf/reg-sub
:snapping-points
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
:wheel
(if (some (:modifiers e) [:ctrl :alt])
(let [delta-y (second delta)
factor (Math/pow (+ 1 (/ (- 1 (:zoom-sensitivity db)) 100))
factor (Math/pow (inc (/ (dec (:zoom-sensitivity db)) 100))
(- delta-y))]
(frame-h/zoom-in-pointer-position db factor))
(frame-h/pan db delta))
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/reepl/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
{:should-go-up
(fn [_source inst]
(let [pos (.getCursor inst)]
(= 0 (.-line pos))))
(zero? (.-line pos))))

:should-go-down
(fn [_source inst]
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/reepl/replumb.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ cljs.js/*load-fn*
(= text a) -1
(= text b) 1
:else
(let [a-starts (= 0 (.indexOf a text))
b-starts (= 0 (.indexOf b text))]
(let [a-starts (zero? (.indexOf a text))
b-starts (zero? (.indexOf b text))]
(cond
(and a-starts b-starts) 0
a-starts -1
Expand Down Expand Up @@ -284,7 +284,7 @@ cljs.js/*load-fn*
(filter matches? names))))))

(defn process-apropos [text]
(if (= 0 (.indexOf text "js/"))
(if (zero? (.indexOf text "js/"))
(js-completion (.slice text 3))
(cljs-completion text)))

Expand Down

0 comments on commit 28ade64

Please sign in to comment.