Skip to content

Commit f86b2be

Browse files
committed
rename to-fixed
1 parent ecdf83a commit f86b2be

File tree

17 files changed

+50
-49
lines changed

17 files changed

+50
-49
lines changed

src/renderer/app/views.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939

4040
(defn coll->str
4141
[coll]
42-
(str "[" (string/join " " (map utils.length/to-fixed coll)) "]"))
42+
(str "[" (string/join " " (map utils.length/->fixed coll)) "]"))
4343

4444
(defn map->str
4545
[m]
4646
(interpose ", " (map (fn [[k v]]
4747
^{:key k}
4848
[:span (str (name k) ": " (if (number? v)
49-
(utils.length/to-fixed v)
49+
(utils.length/->fixed v)
5050
(coll->str v)))]) m)))
5151

5252
(defn debug-rows

src/renderer/element/impl/custom/brush.cljs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,20 @@
8282
b (nth points 1)
8383
c (nth points 2)
8484
d (str
85-
"M" (utils.length/to-fixed (first a)) "," (utils.length/to-fixed (second a))
86-
" Q" (utils.length/to-fixed (first b)) "," (utils.length/to-fixed (second b))
87-
" " (utils.length/to-fixed (matrix.stats/mean [(first b) (first c)])) ","
88-
(utils.length/to-fixed (matrix.stats/mean [(second b) (second c)])) " T")]
85+
"M" (utils.length/->fixed (first a)) "," (utils.length/->fixed (second a))
86+
" Q" (utils.length/->fixed (first b)) "," (utils.length/->fixed (second b))
87+
" " (utils.length/->fixed (matrix.stats/mean [(first b) (first c)])) ","
88+
(utils.length/->fixed (matrix.stats/mean [(second b) (second c)])) " T")]
8989
(reduce-kv
9090
(fn [result index]
9191
(if (or (= len (inc index)) (< index 2))
9292
result
9393
(let [a (nth points index)
9494
b (nth points (inc index))]
9595
(str result
96-
(utils.length/to-fixed (matrix.stats/mean [(first a) (first b)]))
96+
(utils.length/->fixed (matrix.stats/mean [(first a) (first b)]))
9797
","
98-
(utils.length/to-fixed (matrix.stats/mean [(second a) (second b)]))
98+
(utils.length/->fixed (matrix.stats/mean [(second a) (second b)]))
9999
" ")))) d points)))))
100100

101101
(def partition-to-px

src/renderer/element/impl/shape/circle.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
r (/ (first (utils.bounds/->dimensions bbox)) 2)]
7878
[:g
7979
[utils.svg/line [cx cy] [(+ cx r) cy]]
80-
[utils.svg/label (str (utils.length/to-fixed r)) [(+ cx (/ r 2)) cy]]
80+
[utils.svg/label (str (utils.length/->fixed r)) [(+ cx (/ r 2)) cy]]
8181
[utils.svg/times [cx cy]]
8282
[tool.views/square-handle {:x (+ cx r)
8383
:y cy

src/renderer/element/impl/shape/ellipse.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@
8484
[:g ::edit-handles
8585
[utils.svg/times [cx cy]]
8686
[utils.svg/line [cx cy] [(+ cx rx) cy]]
87-
[utils.svg/label (str (utils.length/to-fixed rx)) [(+ cx (/ rx 2)) cy]]
87+
[utils.svg/label (str (utils.length/->fixed rx)) [(+ cx (/ rx 2)) cy]]
8888
[utils.svg/line [cx cy] [cx (- cy ry)]]
89-
[utils.svg/label (str (utils.length/to-fixed ry)) [cx (- cy (/ ry 2))]]
89+
[utils.svg/label (str (utils.length/->fixed ry)) [cx (- cy (/ ry 2))]]
9090
(map (fn [handle]
9191
^{:key (:id handle)}
9292
[tool.views/square-handle

src/renderer/element/impl/shape/line.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
[:title {:key (str id "-title")} (name id)]]
7373
(when is-active
7474
[utils.svg/label
75-
(string/join " " [(utils.length/to-fixed x) (utils.length/to-fixed y)])
75+
(string/join " " [(utils.length/->fixed x) (utils.length/->fixed y)])
7676
[(- x margin) (+ y margin)]
7777
"end"])]))
7878
[{:x x1

src/renderer/element/impl/shape/polyshape.cljs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
:element (:id el)}]
8484
(when is-active
8585
[utils.svg/label
86-
(->> [(utils.length/to-fixed x) (utils.length/to-fixed y)]
86+
(->> [x y]
87+
(mapv utils.length/->fixed)
8788
(string/join " "))
8889
[(- x margin) (+ y margin)]
8990
"end"])]))

src/renderer/tool/impl/base/transform.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@
422422
x (+ min-x (/ (- max-x min-x) 2))
423423
y (+ y2 (/ (+ (/ theme.db/handle-size 2) 15) zoom))
424424
[w h] (utils.bounds/->dimensions bbox)
425-
text (str (utils.length/to-fixed w) " x " (utils.length/to-fixed h))]
425+
text (str (utils.length/->fixed w) " x " (utils.length/->fixed h))]
426426
[utils.svg/label text [x y]]))
427427

428428
(m/=> area-label [:-> number? BBox any?])
@@ -433,7 +433,7 @@
433433
[min-x min-y max-x] bbox
434434
x (+ min-x (/ (- max-x min-x) 2))
435435
y (+ min-y (/ (- -15 (/ theme.db/handle-size 2)) zoom))
436-
text (str (utils.length/to-fixed area) " px²")]
436+
text (str (utils.length/->fixed area) " px²")]
437437
[utils.svg/label text [x y]])))
438438

439439
(defmethod tool.hierarchy/render :transform

src/renderer/tool/impl/element/circle.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
[db _e]
3737
(let [offset (or (:nearest-neighbor-offset db) (:adjusted-pointer-offset db))
3838
position (or (:point (:nearest-neighbor db)) (:adjusted-pointer-pos db))
39-
radius (utils.length/to-fixed (matrix/distance position offset))
39+
radius (utils.length/->fixed (matrix/distance position offset))
4040
id (:id (first (element.handlers/selected db)))]
4141
(element.handlers/update-el db id #(assoc-in % [:attrs :r] (str radius)))))
4242

src/renderer/tool/impl/element/ellipse.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
(let [[offset-x offset-y] (or (:nearest-neighbor-offset db)
2525
(:adjusted-pointer-offset db))
2626
[x y] (or (:point (:nearest-neighbor db)) (:adjusted-pointer-pos db))
27-
rx (utils.length/to-fixed (abs (- x offset-x)))
28-
ry (utils.length/to-fixed (abs (- y offset-y)))]
27+
rx (utils.length/->fixed (abs (- x offset-x)))
28+
ry (utils.length/->fixed (abs (- y offset-y)))]
2929
{:rx (cond-> rx lock-ratio (min ry))
3030
:ry (cond-> ry lock-ratio (min rx))}))
3131

src/renderer/tool/impl/element/line.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
{:keys [id parent]} (first (element.handlers/selected db))
3939
[min-x min-y] (element.hierarchy/bbox (element.handlers/entity db parent))
4040
[x y] (matrix/sub position [min-x min-y])
41-
x (utils.length/to-fixed x)
42-
y (utils.length/to-fixed y)]
41+
x (utils.length/->fixed x)
42+
y (utils.length/->fixed y)]
4343
(element.handlers/update-el db id #(-> %
4444
(assoc-in [:attrs :x2] (str x))
4545
(assoc-in [:attrs :y2] (str y))))))

0 commit comments

Comments
 (0)