Skip to content

Commit 0161577

Browse files
committed
enhance naming
1 parent 6c0a9a2 commit 0161577

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/renderer/element/handlers.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@
424424
(let [svgs (reverse (root-svgs db))
425425
pointer-pos (:adjusted-pointer-pos db)]
426426
(or
427-
(some #(when (bounds/contained-point? (:bounds %) pointer-pos) %) svgs)
427+
(some #(when (bounds/contain-point? (:bounds %) pointer-pos) %) svgs)
428428
(element db :canvas))))
429429

430430
(defn translate
@@ -501,7 +501,7 @@
501501
el-bounds (tool/bounds el)]
502502
(or
503503
(some #(when (bounds/contained? el-bounds (:bounds %)) %) svgs)
504-
(some #(when (bounds/intersected? el-bounds (:bounds %)) %) svgs)
504+
(some #(when (bounds/intersect? el-bounds (:bounds %)) %) svgs)
505505
(element db :canvas))))
506506

507507
(defn create

src/renderer/tool/transform/select.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
(let [{{:keys [x y width height]} :attrs} (element.h/get-temp db)
7070
selection-bounds [x y (+ x width) (+ y height)]]
7171
(if intersecting?
72-
(bounds/intersected? (:bounds el) selection-bounds)
72+
(bounds/intersect? (:bounds el) selection-bounds)
7373
(bounds/contained? (:bounds el) selection-bounds))))
7474

7575
(defn reduce-by-area

src/renderer/utils/bounds.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[clojure.core.matrix :as mat]))
44

55
(defn from-bbox
6-
"Experimental way of getting the bounds of uknown or complicated elements
6+
"Experimental way of getting the bounds of uknown or complicated elements
77
using the getBBox method.
88
https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox"
99
[el]
@@ -30,7 +30,7 @@
3030
(let [[x1 y1 _x2 _y2] bounds]
3131
(mat/add [x1 y1] (mat/div (->dimensions bounds) 2))))
3232

33-
(defn intersected?
33+
(defn intersect?
3434
[a-bounds b-bounds]
3535
(when (and a-bounds b-bounds)
3636
(let [[a-left a-top a-right a-bottom] a-bounds
@@ -50,7 +50,7 @@
5050
(< a-right b-right)
5151
(< a-bottom b-bottom)))))
5252

53-
(defn contained-point?
53+
(defn contain-point?
5454
[[left top right bottom] [x y]]
5555
(and (<= left x)
5656
(<= top y)

test/bounds_test.cljs

+10-10
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@
1010
(is (= (bounds/union [11 11 11 11] [0 0 0 0]) [0 0 11 11]))))
1111

1212

13-
(deftest test-intersected?
13+
(deftest test-intersect?
1414
(testing "bounds are intesrecting"
15-
(is (= (bounds/intersected? [0 0 10 10] [11 11 20 20]) false))
16-
(is (= (bounds/intersected? [0 0 10 10] [9 9 20 20]) true))
17-
(is (= (bounds/intersected? [0 0 10 10] [10 10 11 11]) true))))
15+
(is (= (bounds/intersect? [0 0 10 10] [11 11 20 20]) false))
16+
(is (= (bounds/intersect? [0 0 10 10] [9 9 20 20]) true))
17+
(is (= (bounds/intersect? [0 0 10 10] [10 10 11 11]) true))))
1818

1919
(deftest test-contained?
2020
(testing "bounds are contained"
2121
(is (= (bounds/contained? [0 0 10 10] [0 0 10 10]) false))
2222
(is (= (bounds/contained? [5 5 10 10] [0 0 20 20]) true))
2323
(is (= (bounds/contained? [0 0 10 10] [1 1 10 10]) false))))
2424

25-
(deftest test-contained-point?
25+
(deftest test-contain-point?
2626
(testing "bounds contain point"
27-
(is (= (bounds/contained-point? [0 0 10 10] [0 0]) true))
28-
(is (= (bounds/contained-point? [0 0 10 10] [5 5]) true))
29-
(is (= (bounds/contained-point? [0 0 10 10] [10 10]) true))
30-
(is (= (bounds/contained-point? [0 0 10 10] [-5 5]) false))
31-
(is (= (bounds/contained-point? [0 0 10 10] [5 -5]) false))))
27+
(is (= (bounds/contain-point? [0 0 10 10] [0 0]) true))
28+
(is (= (bounds/contain-point? [0 0 10 10] [5 5]) true))
29+
(is (= (bounds/contain-point? [0 0 10 10] [10 10]) true))
30+
(is (= (bounds/contain-point? [0 0 10 10] [-5 5]) false))
31+
(is (= (bounds/contain-point? [0 0 10 10] [5 -5]) false))))
3232

3333
(deftest test-center
3434
(testing "center of bounds"

0 commit comments

Comments
 (0)