mirror of
https://github.com/penpot/penpot.git
synced 2025-04-13 15:31:26 -05:00
🐛 Fixes problems with snaps
This commit is contained in:
parent
dc97056fcf
commit
b8d30466bb
4 changed files with 12 additions and 4 deletions
|
@ -167,7 +167,7 @@
|
|||
(rx/concat
|
||||
(->> mouse
|
||||
(rx/take 1)
|
||||
(rx/map (fn [pt] #(initialize-drawing % pt frame-id))))
|
||||
(rx/map (fn [pt] #(initialize-drawing % pt (or frame-id uuid/zero)))))
|
||||
(->> mouse
|
||||
(rx/with-latest vector ms/mouse-position-ctrl)
|
||||
(rx/map (fn [[pt ctrl?]] #(update-drawing % initial snap-data pt ctrl?)))
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
(let [modified-path (gsh/transform-apply-modifiers shape)
|
||||
shape-center (gsh/center modified-path)]
|
||||
(case (:type shape)
|
||||
:frame (frame-snap-points shape)
|
||||
:frame (-> modified-path gsh/shape->rect-shape frame-snap-points)
|
||||
(:path :curve) (into #{shape-center} (-> modified-path gsh/shape->rect-shape :segments))
|
||||
(into #{shape-center} (-> modified-path :segments)))))
|
||||
|
||||
|
|
|
@ -358,7 +358,12 @@ goog.scope(function() {
|
|||
}
|
||||
return vec(result);
|
||||
};
|
||||
self.range_query = (tree, from_value, to_value) => vec(tree.rangeQuery(from_value, to_value));
|
||||
self.range_query = (tree, from_value, to_value) => {
|
||||
if (!tree) {
|
||||
return vec();
|
||||
}
|
||||
return vec(tree.rangeQuery(from_value, to_value))
|
||||
};
|
||||
self.empty_QMARK_ = (tree) => tree.isEmpty();
|
||||
self.height = (tree) => tree.height();
|
||||
self.print = (tree) => printTree(tree.root);
|
||||
|
|
|
@ -173,7 +173,10 @@
|
|||
(rt/insert 175 :g))]
|
||||
(t/is (= (rt/range-query tree -100 0) []))
|
||||
(t/is (= (rt/range-query tree 200 300) []))
|
||||
(t/is (= (rt/range-query tree 200 0) [])))))
|
||||
(t/is (= (rt/range-query tree 200 0) []))))
|
||||
|
||||
(t/testing "Range query over null should return empty"
|
||||
(t/is (= (rt/range-query nil 0 100) []))))
|
||||
|
||||
(t/deftest test-balanced-tree
|
||||
(t/testing "Creates a worst-case BST and probes for a balanced height"
|
||||
|
|
Loading…
Add table
Reference in a new issue