diff --git a/frontend/src/uxbox/main/ui/workspace/drawarea.cljs b/frontend/src/uxbox/main/ui/workspace/drawarea.cljs index ab64024243..d5d088019f 100644 --- a/frontend/src/uxbox/main/ui/workspace/drawarea.cljs +++ b/frontend/src/uxbox/main/ui/workspace/drawarea.cljs @@ -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?))) diff --git a/frontend/src/uxbox/util/geom/snap.cljs b/frontend/src/uxbox/util/geom/snap.cljs index 0a882d0931..90ce9afcb4 100644 --- a/frontend/src/uxbox/util/geom/snap.cljs +++ b/frontend/src/uxbox/util/geom/snap.cljs @@ -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))))) diff --git a/frontend/src/uxbox/util/range_tree.js b/frontend/src/uxbox/util/range_tree.js index 5910e34927..bc16a6a8f4 100644 --- a/frontend/src/uxbox/util/range_tree.js +++ b/frontend/src/uxbox/util/range_tree.js @@ -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); diff --git a/frontend/tests/uxbox/test_util_range_tree.cljs b/frontend/tests/uxbox/test_util_range_tree.cljs index 56769b677c..ba0c82ac47 100644 --- a/frontend/tests/uxbox/test_util_range_tree.cljs +++ b/frontend/tests/uxbox/test_util_range_tree.cljs @@ -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"