diff --git a/src/uxbox/main/data/shapes.cljs b/src/uxbox/main/data/shapes.cljs index 9e26bcda0..e439e9e94 100644 --- a/src/uxbox/main/data/shapes.cljs +++ b/src/uxbox/main/data/shapes.cljs @@ -8,20 +8,18 @@ (ns uxbox.main.data.shapes (:require [beicon.core :as rx] [uxbox.util.uuid :as uuid] - [uxbox.main.constants :as c] [uxbox.util.rstore :as rs] [uxbox.util.router :as r] [uxbox.util.schema :as sc] - [uxbox.main.geom :as geom] - [uxbox.util.geom.point :as gpt] [uxbox.util.workers :as uw] + [uxbox.main.constants :as c] + [uxbox.main.geom :as geom] [uxbox.main.state :as st] - [uxbox.main.state.shapes :as stsh] [uxbox.main.data.core :refer (worker)] + [uxbox.main.data.shapes-impl :as impl] [uxbox.main.data.pages :as udp] [uxbox.util.rlocks :as rlocks] - [uxbox.util.geom.point :as gpt] - [uxbox.util.data :refer (index-of)])) + [uxbox.util.geom.point :as gpt])) ;; --- Shapes CRUD @@ -34,7 +32,7 @@ (-apply-update [_ state] (let [page (get-in state [:workspace :page]) shape (geom/setup-proportions shape)] - (stsh/assoc-shape-to-page state shape page))))) + (impl/assoc-shape-to-page state shape page))))) (defn delete-shape "Remove the shape using its id." @@ -44,7 +42,7 @@ rs/UpdateEvent (-apply-update [_ state] (let [shape (get-in state [:shapes-by-id id])] - (stsh/dissoc-shape state shape))))) + (impl/dissoc-shape state shape))))) (defn update-shape "Just updates in place the shape." @@ -369,7 +367,7 @@ udp/IPageUpdate rs/UpdateEvent (-apply-update [_ state] - (stsh/drop-shape state sid tid loc)))) + (impl/drop-shape state sid tid loc)))) (defn select-first-shape "Mark a shape selected for drawing in the canvas." @@ -399,7 +397,7 @@ rs/UpdateEvent (-apply-update [_ state] (let [page (get-in state [:workspace :page]) - shapes (stsh/match-by-selrect state page selrect)] + shapes (impl/match-by-selrect state page selrect)] (assoc-in state [:workspace :selected] shapes)))) (defn select-shapes @@ -511,7 +509,7 @@ (-apply-update [_ state] (let [pid (get-in state [:workspace :page]) selected (get-in state [:workspace :selected])] - (stsh/group-shapes state selected pid))))) + (impl/group-shapes state selected pid))))) (defn degroup-selected [] @@ -521,7 +519,7 @@ (-apply-update [_ state] (let [pid (get-in state [:workspace :page]) selected (get-in state [:workspace :selected])] - (stsh/degroup-shapes state selected pid))))) + (impl/degroup-shapes state selected pid))))) ;; TODO: maybe split in two separate events (defn duplicate-selected @@ -531,7 +529,7 @@ rs/UpdateEvent (-apply-update [_ state] (let [selected (get-in state [:workspace :selected])] - (stsh/duplicate-shapes state selected))))) + (impl/duplicate-shapes state selected))))) (defn delete-selected "Deselect all and remove all selected shapes." @@ -590,7 +588,7 @@ rs/UpdateEvent (-apply-update [_ state] (let [selected (get-in state [:workspace :selected])] - (stsh/move-layer state selected loc))))) + (impl/move-layer state selected loc))))) ;; --- Point Alignment (with Grid) diff --git a/src/uxbox/main/state/shapes.cljs b/src/uxbox/main/data/shapes_impl.cljs similarity index 97% rename from src/uxbox/main/state/shapes.cljs rename to src/uxbox/main/data/shapes_impl.cljs index 84a9119a3..eac3d07e6 100644 --- a/src/uxbox/main/state/shapes.cljs +++ b/src/uxbox/main/data/shapes_impl.cljs @@ -1,5 +1,10 @@ -(ns uxbox.main.state.shapes - "A collection of functions for manage shapes insinde the state." +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) 2015-2016 Andrey Antukh + +(ns uxbox.main.data.shapes-impl (:require [uxbox.util.uuid :as uuid] [uxbox.util.data :refer (index-of)] [uxbox.main.geom :as geom])) @@ -372,3 +377,4 @@ (as-> state $ (empty-groups $ page groups-ids) (update $ :workspace assoc :selected (set groups-items)))))) + diff --git a/src/uxbox/main/data/workspace.cljs b/src/uxbox/main/data/workspace.cljs index 5c92ab932..3e6973f24 100644 --- a/src/uxbox/main/data/workspace.cljs +++ b/src/uxbox/main/data/workspace.cljs @@ -3,7 +3,6 @@ ;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; ;; Copyright (c) 2015-2016 Andrey Antukh -;; Copyright (c) 2015-2016 Juan de la Cruz (ns uxbox.main.data.workspace (:require [beicon.core :as rx] @@ -14,11 +13,11 @@ [uxbox.util.geom.point :as gpt] [uxbox.util.workers :as uw] [uxbox.main.state :as st] - [uxbox.main.state.shapes :as stsh] [uxbox.main.data.core :refer (worker)] [uxbox.main.data.projects :as dp] [uxbox.main.data.pages :as udp] [uxbox.main.data.shapes :as uds] + [uxbox.main.data.shapes-impl :as shimpl] [uxbox.main.data.forms :as udf] [uxbox.main.data.lightbox :as udl] [uxbox.main.data.history :as udh] @@ -158,7 +157,7 @@ (->> (:clipboard state) (filter #(= id (:id %))) (first)))] - (stsh/duplicate-shapes state (:items selected) page)))) + (shimpl/duplicate-shapes state (:items selected) page)))) (defn paste-from-clipboard "Copy selected shapes to clipboard."