🐛 Fixes problems with snaps

This commit is contained in:
alonso.torres 2020-05-07 12:22:39 +02:00
parent dc97056fcf
commit b8d30466bb
4 changed files with 12 additions and 4 deletions

View file

@ -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?)))

View file

@ -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)))))

View file

@ -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);