File tree Expand file tree Collapse file tree 17 files changed +50
-49
lines changed Expand file tree Collapse file tree 17 files changed +50
-49
lines changed Original file line number Diff line number Diff line change 39
39
40
40
(defn coll->str
41
41
[coll]
42
- (str " [" (string/join " " (map utils.length/to- fixed coll)) " ]" ))
42
+ (str " [" (string/join " " (map utils.length/-> fixed coll)) " ]" ))
43
43
44
44
(defn map->str
45
45
[m]
46
46
(interpose " , " (map (fn [[k v]]
47
47
^{:key k}
48
48
[:span (str (name k) " : " (if (number? v)
49
- (utils.length/to- fixed v)
49
+ (utils.length/-> fixed v)
50
50
(coll->str v)))]) m)))
51
51
52
52
(defn debug-rows
Original file line number Diff line number Diff line change 82
82
b (nth points 1 )
83
83
c (nth points 2 )
84
84
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" )]
89
89
(reduce-kv
90
90
(fn [result index]
91
91
(if (or (= len (inc index)) (< index 2 ))
92
92
result
93
93
(let [a (nth points index)
94
94
b (nth points (inc index))]
95
95
(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)]))
97
97
" ,"
98
- (utils.length/to- fixed (matrix.stats/mean [(second a) (second b)]))
98
+ (utils.length/-> fixed (matrix.stats/mean [(second a) (second b)]))
99
99
" " )))) d points)))))
100
100
101
101
(def partition-to-px
Original file line number Diff line number Diff line change 77
77
r (/ (first (utils.bounds/->dimensions bbox)) 2 )]
78
78
[:g
79
79
[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]]
81
81
[utils.svg/times [cx cy]]
82
82
[tool.views/square-handle {:x (+ cx r)
83
83
:y cy
Original file line number Diff line number Diff line change 84
84
[:g ::edit-handles
85
85
[utils.svg/times [cx cy]]
86
86
[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]]
88
88
[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 ))]]
90
90
(map (fn [handle]
91
91
^{:key (:id handle)}
92
92
[tool.views/square-handle
Original file line number Diff line number Diff line change 72
72
[:title {:key (str id " -title" )} (name id)]]
73
73
(when is-active
74
74
[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)])
76
76
[(- x margin) (+ y margin)]
77
77
" end" ])]))
78
78
[{:x x1
Original file line number Diff line number Diff line change 83
83
:element (:id el)}]
84
84
(when is-active
85
85
[utils.svg/label
86
- (->> [(utils.length/to-fixed x) (utils.length/to-fixed y)]
86
+ (->> [x y]
87
+ (mapv utils.length/->fixed)
87
88
(string/join " " ))
88
89
[(- x margin) (+ y margin)]
89
90
" end" ])]))
Original file line number Diff line number Diff line change 422
422
x (+ min-x (/ (- max-x min-x) 2 ))
423
423
y (+ y2 (/ (+ (/ theme.db/handle-size 2 ) 15 ) zoom))
424
424
[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))]
426
426
[utils.svg/label text [x y]]))
427
427
428
428
(m/=> area-label [:-> number? BBox any?])
433
433
[min-x min-y max-x] bbox
434
434
x (+ min-x (/ (- max-x min-x) 2 ))
435
435
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²" )]
437
437
[utils.svg/label text [x y]])))
438
438
439
439
(defmethod tool.hierarchy /render :transform
Original file line number Diff line number Diff line change 36
36
[db _e]
37
37
(let [offset (or (:nearest-neighbor-offset db) (:adjusted-pointer-offset db))
38
38
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))
40
40
id (:id (first (element.handlers/selected db)))]
41
41
(element.handlers/update-el db id #(assoc-in % [:attrs :r ] (str radius)))))
42
42
Original file line number Diff line number Diff line change 24
24
(let [[offset-x offset-y] (or (:nearest-neighbor-offset db)
25
25
(:adjusted-pointer-offset db))
26
26
[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)))]
29
29
{:rx (cond-> rx lock-ratio (min ry))
30
30
:ry (cond-> ry lock-ratio (min rx))}))
31
31
Original file line number Diff line number Diff line change 38
38
{:keys [id parent]} (first (element.handlers/selected db))
39
39
[min-x min-y] (element.hierarchy/bbox (element.handlers/entity db parent))
40
40
[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)]
43
43
(element.handlers/update-el db id #(-> %
44
44
(assoc-in [:attrs :x2 ] (str x))
45
45
(assoc-in [:attrs :y2 ] (str y))))))
You can’t perform that action at this time.
0 commit comments