File tree Expand file tree Collapse file tree 7 files changed +36
-25
lines changed Expand file tree Collapse file tree 7 files changed +36
-25
lines changed Original file line number Diff line number Diff line change 23
23
(.setAttributeNS dom-el nil (name k) v)))
24
24
(.appendChild svg dom-el)
25
25
(set! (.-innerHTML dom-el) (if (empty? content) " \u 00a0" content))
26
- (let [bounds (bounds/from-bbox dom-el)]
26
+ (let [bounds (bounds/dom-el->bounds dom-el)]
27
27
(.remove dom-el)
28
28
bounds))))
29
29
Original file line number Diff line number Diff line change 60
60
(defmethod hierarchy /help [:transform :scale ]
61
61
[]
62
62
[:div " Hold " [:span.shortcut-key " Ctrl" ] " to lock proportions, "
63
- [:span.shortcut-key " ⇧" ] " to scale in place, " [:span.shortcut-key " Alt" ] " to also scale children." ])
63
+ [:span.shortcut-key " ⇧" ] " to scale in place, "
64
+ [:span.shortcut-key " Alt" ] " to also scale children." ])
64
65
65
66
(m/=> hovered? [:-> App Element boolean? boolean?])
66
67
(defn hovered?
Original file line number Diff line number Diff line change 14
14
[number? {:title " right" }]
15
15
[number? {:title " bottom" }]])
16
16
17
- (m/=> from-bbox [:-> DomElement [:maybe Bounds]])
18
- (defn from-bbox
17
+ (m/=> dom-el->bounds [:-> DomElement [:maybe Bounds]])
18
+ (defn dom-el->bounds
19
19
" Experimental way of getting the bounds of unknown or complicated elements
20
20
using the getBBox method.
21
21
https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox"
Original file line number Diff line number Diff line change 60
60
:position position}]))
61
61
(.readAsText reader file)))
62
62
63
+ (def supported-image-types
64
+ #{" image/jpeg"
65
+ " image/png"
66
+ " image/bmp"
67
+ " image/gif" })
68
+
63
69
(m/=> files! [:-> Vec2D any? nil?])
64
70
(defn files!
65
71
" https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/files"
70
76
(= file-type " image/svg+xml" )
71
77
(add-svg! file position)
72
78
73
- (contains? #{ " image/jpeg " " image/png " " image/bmp " " image/gif " } file-type)
79
+ (contains? supported- image-types file-type)
74
80
(add-image! file position)
75
81
76
82
:else
Original file line number Diff line number Diff line change 35
35
[:p " Please consider submitting an error report to improve your experience." ]
36
36
37
37
[:button.button.px-2.rounded.w-full.mb-5.border.border-default.hover:bg-transparent
38
- {:on-click #(rf/dispatch [::window.e/open-remote-url (submit-error-url error-message)])}
38
+ {:on-click #(rf/dispatch [::window.e/open-remote-url
39
+ (submit-error-url error-message)])}
39
40
" Submit an error report" ]
40
41
41
- [:p " You can try to undo your last action in order to recover to a previous working state." ]
42
+ [:p " You can try to undo your last action in order to recover to a
43
+ previous working state." ]
42
44
43
45
[:button.button.px-2.rounded.w-full.mb-5.overlay
44
46
{:on-click #(do (rf/dispatch [::history.e/undo ])
51
53
{:on-click #(rf/dispatch [::window.e/relaunch ])}
52
54
" Restart the application" ]
53
55
54
- [:p " If you keep getting the same error after restarting, try clearing your session and options data and restart.
55
- Please note that by doing so, you will loose any unsaved changes and your local application settings." ]
56
+ [:p " If you keep getting the same error after restarting,
57
+ try clearing your session and options data and restart.
58
+ Please note that by doing so, you will loose any unsaved changes
59
+ and your local application settings." ]
56
60
57
61
[:button.button.px-2.rounded.w-full.bg-warning
58
62
{:on-click #(rf/dispatch [::window.e/clear-local-storage-and-relaunch ])}
Original file line number Diff line number Diff line change 25
25
(if (= (:tag (zip/node loc)) :svg )
26
26
(zip/node loc)
27
27
(recur (zip/next loc))))))
28
-
Original file line number Diff line number Diff line change 26
26
27
27
:always
28
28
(-> (update :elements update-keys key->uuid)
29
- (update :elements
30
- update-vals
29
+ (update :elements update-vals
31
30
#(cond-> %
32
31
:always
33
32
(-> (update :id key->uuid)
37
36
(update :parent key->uuid)))))))]
38
37
39
38
[[0 4 4 ] (fn [document]
40
- (update document :elements update-vals (fn [el]
41
- (update-keys el #(case %
42
- :visible? :visible
43
- :selected? :selected
44
- :locked? :locked
45
- %)))))]
39
+ (update document :elements update-vals
40
+ (fn [el]
41
+ (update-keys el #(case %
42
+ :visible? :visible
43
+ :selected? :selected
44
+ :locked? :locked
45
+ %)))))]
46
46
47
47
[[0 4 5 ] (fn [document]
48
- (update document :elements update-vals (fn [el]
49
- (cond-> el
50
- (= (:tag el) :brush )
51
- (update-in [:attrs :points ] #(str/join " " (flatten %)))
52
-
53
- :always
54
- element/normalize-attrs))))]])
48
+ (update document :elements update-vals
49
+ (fn [el]
50
+ (cond-> el
51
+ (= (:tag el) :brush )
52
+ (update-in [:attrs :points ] #(str/join " " (flatten %)))
53
+
54
+ :always
55
+ element/normalize-attrs))))]])
You can’t perform that action at this time.
0 commit comments