Skip to content

Commit

Permalink
minor style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc committed Nov 23, 2024
1 parent e8e36cd commit d906cad
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/renderer/element/impl/renderable.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
(.setAttributeNS dom-el nil (name k) v)))
(.appendChild svg dom-el)
(set! (.-innerHTML dom-el) (if (empty? content) "\u00a0" content))
(let [bounds (bounds/from-bbox dom-el)]
(let [bounds (bounds/dom-el->bounds dom-el)]
(.remove dom-el)
bounds))))

Expand Down
3 changes: 2 additions & 1 deletion src/renderer/tool/impl/base/transform.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
(defmethod hierarchy/help [:transform :scale]
[]
[:div "Hold " [:span.shortcut-key "Ctrl"] " to lock proportions, "
[:span.shortcut-key ""] " to scale in place, " [:span.shortcut-key "Alt"] " to also scale children."])
[:span.shortcut-key ""] " to scale in place, "
[:span.shortcut-key "Alt"] " to also scale children."])

(m/=> hovered? [:-> App Element boolean? boolean?])
(defn hovered?
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/utils/bounds.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
[number? {:title "right"}]
[number? {:title "bottom"}]])

(m/=> from-bbox [:-> DomElement [:maybe Bounds]])
(defn from-bbox
(m/=> dom-el->bounds [:-> DomElement [:maybe Bounds]])
(defn dom-el->bounds
"Experimental way of getting the bounds of unknown or complicated elements
using the getBBox method.
https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox"
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/utils/drop.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
:position position}]))
(.readAsText reader file)))

(def supported-image-types
#{"image/jpeg"
"image/png"
"image/bmp"
"image/gif"})

(m/=> files! [:-> Vec2D any? nil?])
(defn files!
"https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/files"
Expand All @@ -70,7 +76,7 @@
(= file-type "image/svg+xml")
(add-svg! file position)

(contains? #{"image/jpeg" "image/png" "image/bmp" "image/gif"} file-type)
(contains? supported-image-types file-type)
(add-image! file position)

:else
Expand Down
12 changes: 8 additions & 4 deletions src/renderer/utils/error.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@
[:p "Please consider submitting an error report to improve your experience."]

[:button.button.px-2.rounded.w-full.mb-5.border.border-default.hover:bg-transparent
{:on-click #(rf/dispatch [::window.e/open-remote-url (submit-error-url error-message)])}
{:on-click #(rf/dispatch [::window.e/open-remote-url
(submit-error-url error-message)])}
"Submit an error report"]

[:p "You can try to undo your last action in order to recover to a previous working state."]
[:p "You can try to undo your last action in order to recover to a
previous working state."]

[:button.button.px-2.rounded.w-full.mb-5.overlay
{:on-click #(do (rf/dispatch [::history.e/undo])
Expand All @@ -51,8 +53,10 @@
{:on-click #(rf/dispatch [::window.e/relaunch])}
"Restart the application"]

[:p "If you keep getting the same error after restarting, try clearing your session and options data and restart.
Please note that by doing so, you will loose any unsaved changes and your local application settings."]
[:p "If you keep getting the same error after restarting,
try clearing your session and options data and restart.
Please note that by doing so, you will loose any unsaved changes
and your local application settings."]

[:button.button.px-2.rounded.w-full.bg-warning
{:on-click #(rf/dispatch [::window.e/clear-local-storage-and-relaunch])}
Expand Down
1 change: 0 additions & 1 deletion src/renderer/utils/hiccup.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@
(if (= (:tag (zip/node loc)) :svg)
(zip/node loc)
(recur (zip/next loc))))))

31 changes: 16 additions & 15 deletions src/renderer/utils/migrations.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@

:always
(-> (update :elements update-keys key->uuid)
(update :elements
update-vals
(update :elements update-vals
#(cond-> %
:always
(-> (update :id key->uuid)
Expand All @@ -37,18 +36,20 @@
(update :parent key->uuid)))))))]

[[0 4 4] (fn [document]
(update document :elements update-vals (fn [el]
(update-keys el #(case %
:visible? :visible
:selected? :selected
:locked? :locked
%)))))]
(update document :elements update-vals
(fn [el]
(update-keys el #(case %
:visible? :visible
:selected? :selected
:locked? :locked
%)))))]

[[0 4 5] (fn [document]
(update document :elements update-vals (fn [el]
(cond-> el
(= (:tag el) :brush)
(update-in [:attrs :points] #(str/join " " (flatten %)))

:always
element/normalize-attrs))))]])
(update document :elements update-vals
(fn [el]
(cond-> el
(= (:tag el) :brush)
(update-in [:attrs :points] #(str/join " " (flatten %)))

:always
element/normalize-attrs))))]])

0 comments on commit d906cad

Please sign in to comment.