Migrate pages in the backend

This commit is contained in:
alonso.torres 2020-05-25 09:55:56 +02:00
parent e06d8e754f
commit 593d1cdd39
15 changed files with 95 additions and 62 deletions

View file

@ -17,7 +17,6 @@
[uxbox.common.data :as d]
[uxbox.common.exceptions :as ex]
[uxbox.common.pages :as cp]
[uxbox.common.migrations :as mg]
[uxbox.common.spec :as us]
[uxbox.common.uuid :as uuid]
[uxbox.config :as cfg]
@ -151,7 +150,6 @@
ptk/UpdateEvent
(update [_ state]
(let [page (get-in state [:workspace-pages page-id])
page (mg/migrate-page page)
local (get-in state [:workspace-cache page-id] workspace-default)]
(-> state
(assoc :current-page-id page-id ; mainly used by events

View file

@ -210,8 +210,7 @@
params {:name name
:file-id file-id
:ordering ordering
:data cp/default-page-data
:version cp/page-version}]
:data cp/default-page-data}]
(->> (rp/mutation :create-page params)
(rx/map page-created))))))

View file

@ -131,15 +131,13 @@
ptk/WatchEvent
(watch [_ state stream]
(let [;;shape (gsh/shape->rect-shape shape)
initial @ms/mouse-position
(let [initial @ms/mouse-position
stoper (rx/filter ms/mouse-up? stream)
page-id (get state :current-page-id)
resizing-shapes (map #(get-in state [:workspace-data page-id :objects %]) ids)
layout (get state :workspace-layout)]
(rx/concat
(->> ms/mouse-position
;; (rx/mapcat apply-grid-alignment)
(rx/with-latest vector ms/mouse-position-ctrl)
(rx/map normalize-proportion-lock)
(rx/switch-map (fn [[point :as current]]

View file

@ -21,16 +21,16 @@
(when num (.toFixed num 2)))
(mf/defc cross-point [{:keys [point zoom color]}]
(let [width (/ 10 zoom)]
(let [width (/ 5 zoom)]
[:g.point
[:line {:x1 (- (:x point) 10) :y1 (- (:y point) 10)
:x2 (+ (:x point) 10) :y2 (+ (:y point) 10)
[:line {:x1 (- (:x point) width) :y1 (- (:y point) width)
:x2 (+ (:x point) width) :y2 (+ (:y point) width)
:stroke color
:stroke-width "1px"
:stroke-opacity 0.5}]
[:line {:x1 (+ (:x point) 10) :y1 (- (:y point) 10)
:x2 (- (:x point) 10) :y2 (+ (:y point) 10)
[:line {:x1 (+ (:x point) width) :y1 (- (:y point) width)
:x2 (- (:x point) width) :y2 (+ (:y point) width)
:stroke color
:stroke-width "1px"
:stroke-opacity 0.5}]]))

View file

@ -3,7 +3,7 @@
(def debug-options #{:bounding-boxes :group :events :rotation-handler :resize-handler :selection-center #_:simple-selection })
(defonce ^:dynamic *debug* (atom #{:bounding-boxes}))
(defonce ^:dynamic *debug* (atom #{}))
(defn debug-all! [] (reset! *debug* debug-options))
(defn debug-none! [] (reset! *debug* #{}))