From b616efd75c02c02886f6a1aa9687e0594b441b2b Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 13 Jan 2021 15:04:22 +0100 Subject: [PATCH 01/15] :bug: Fixes comments styles --- frontend/resources/styles/main/partials/comments.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/resources/styles/main/partials/comments.scss b/frontend/resources/styles/main/partials/comments.scss index 161c109bb..bec73296e 100644 --- a/frontend/resources/styles/main/partials/comments.scss +++ b/frontend/resources/styles/main/partials/comments.scss @@ -77,6 +77,7 @@ width: 100%; border-radius: 2px; border: 1px solid $color-gray-10; + max-height: 4rem; } .buttons { @@ -427,6 +428,11 @@ .section-title { color: $color-black; } + + .threads { + max-height: 25rem; + overflow: auto; + } } .comment { From 292faec46f91ac65ffd70f3afeae874cb1d01992 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 13 Jan 2021 15:04:34 +0100 Subject: [PATCH 02/15] :bug: Fixes paste in workspace inputs --- frontend/src/app/main/ui/workspace/viewport.cljs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/viewport.cljs b/frontend/src/app/main/ui/workspace/viewport.cljs index a0c70c56a..ff7ecc093 100644 --- a/frontend/src/app/main/ui/workspace/viewport.cljs +++ b/frontend/src/app/main/ui/workspace/viewport.cljs @@ -544,8 +544,9 @@ (fn [event] ;; We disable the paste just after mouse-up of a middle button so when panning won't ;; paste the content into the workspace - (when (not @disable-paste) - (st/emit! (dw/paste-from-event event))))) + (let [tag-name (-> event dom/get-target dom/get-tag-name)] + (when (and (not (#{"INPUT" "TEXTAREA"} tag-name)) (not @disable-paste)) + (st/emit! (dw/paste-from-event event)))))) on-resize (mf/use-callback From 4e7a3c09a677094700ae004c91467e4c4a2cb814 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 13 Jan 2021 19:07:21 +0100 Subject: [PATCH 03/15] :bug: Fixed problem with filters clipping --- frontend/src/app/main/ui/shapes/filters.cljs | 60 ++++++++++++++++++-- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/main/ui/shapes/filters.cljs b/frontend/src/app/main/ui/shapes/filters.cljs index 9b3457a37..72badd7ad 100644 --- a/frontend/src/app/main/ui/shapes/filters.cljs +++ b/frontend/src/app/main/ui/shapes/filters.cljs @@ -9,12 +9,12 @@ (ns app.main.ui.shapes.filters (:require + [rumext.alpha :as mf] + [cuerdas.core :as str] + [app.util.color :as color] [app.common.data :as d] [app.common.math :as mth] - [app.common.uuid :as uuid] - [app.util.color :as color] - [cuerdas.core :as str] - [rumext.alpha :as mf])) + [app.common.uuid :as uuid])) (defn get-filter-id [] (str "filter_" (uuid/next))) @@ -109,6 +109,49 @@ :in2 filter-in :result filter-id}]) +(defn filter-bounds [shape filter-entry] + (let [{:keys [x y width height]} (:selrect shape) + {:keys [offset-x offset-y blur spread] :or {offset-x 0 offset-y 0 blur 0 spread 0}} (:params filter-entry) + filter-x (min x (+ x offset-x (- spread) (- blur) -5)) + filter-y (min y (+ y offset-y (- spread) (- blur) -5)) + filter-width (+ width (mth/abs offset-x) (* spread 2) (* blur 2) 10) + filter-height (+ height (mth/abs offset-x) (* spread 2) (* blur 2) 10)] + {:x1 filter-x + :y1 filter-y + :x2 (+ filter-x filter-width) + :y2 (+ filter-y filter-height)})) + +(defn get-filters-bounds + [shape filters blur-value] + + (if (and (= :svg-raw (:type shape)) + (not= :svg (get-in shape [:content :tag]))) + + ;; When is a raw-svg but not the root we use the whole svg as bound for the filter. Is the maximum + ;; we're allowed to display + {:x 0 :y 0 :width (get-in shape [:selrect :width]) :height (get-in shape [:selrect :height])} + + ;; Otherwise we calculate the bound + (let [filter-bounds (->> filters + (filter #(= :drop-shadow (:type %))) + (map (partial filter-bounds shape) )) + ;; We add the selrect so the minimum size will be the selrect + filter-bounds (conj filter-bounds (:selrect shape)) + x1 (apply min (map :x1 filter-bounds)) + y1 (apply min (map :y1 filter-bounds)) + x2 (apply max (map :x2 filter-bounds)) + y2 (apply max (map :y2 filter-bounds)) + + x1 (- x1 (* blur-value 2)) + x2 (+ x2 (* blur-value 2)) + y1 (- y1 (* blur-value 2)) + y2 (+ y2 (* blur-value 2))] + + {:x x1 + :y y1 + :width (- x2 x1) + :height (- y2 y1)}))) + (defn blur-filters [type value] (->> [value] (remove :hidden) @@ -154,11 +197,18 @@ (->> shape :blur (blur-filters :layer-blur))) ;; Adds the previous filter as `filter-in` parameter - filters (map #(assoc %1 :filter-in %2) filters (cons nil (map :id filters)))] + filters (map #(assoc %1 :filter-in %2) filters (cons nil (map :id filters))) + + bounds (get-filters-bounds shape filters (or (-> shape :blur :value) 0))] [:* (when (> (count filters) 2) [:filter {:id filter-id + :x (:x bounds) + :y (:y bounds) + :width (:width bounds) + :height (:height bounds) + :filterUnits "userSpaceOnUse" :color-interpolation-filters "sRGB"} (for [entry filters] From 55a7a34a1d67cfeb4d3dc72148c849cc48f0bf13 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 13 Jan 2021 19:13:46 +0100 Subject: [PATCH 04/15] :bug: Scroll in pages list when more than 4 elements --- frontend/resources/styles/main/partials/sidebar.scss | 4 ++++ frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/resources/styles/main/partials/sidebar.scss b/frontend/resources/styles/main/partials/sidebar.scss index f474c2364..e93c5b4d4 100644 --- a/frontend/resources/styles/main/partials/sidebar.scss +++ b/frontend/resources/styles/main/partials/sidebar.scss @@ -211,3 +211,7 @@ $width-settings-bar: 16rem; } } } + +.element-list.pages-list { + max-height: 10rem; +} diff --git a/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs b/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs index dc3ec8b11..b7e99fbc6 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs @@ -136,7 +136,7 @@ (let [pages (:pages file) deletable? (> (count pages) 1) current-page-id (mf/use-ctx ctx/current-page-id)] - [:ul.element-list + [:ul.element-list.pages-list [:& hooks/sortable-container {} (for [[index page-id] (d/enumerate pages)] [:& page-item-wrapper From a450dee7cf17f40480e7ccd756b1cff5c224e5cc Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 13 Jan 2021 19:19:51 +0100 Subject: [PATCH 05/15] :bug: New paths over shapes --- frontend/src/app/main/ui/workspace/effects.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/main/ui/workspace/effects.cljs b/frontend/src/app/main/ui/workspace/effects.cljs index 668de1b2f..f35dc62c4 100644 --- a/frontend/src/app/main/ui/workspace/effects.cljs +++ b/frontend/src/app/main/ui/workspace/effects.cljs @@ -56,7 +56,7 @@ (dom/prevent-default event) (when-not blocked (cond - (or (not= 1 button) drawing? ctrl?) + (or (not= 1 button) drawing? ctrl? edition) nil (= type :frame) From a14686c9f3d8e17a38d59e808a63ad65e4eab695 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 13 Jan 2021 20:25:24 +0100 Subject: [PATCH 06/15] :bug: Hides grid when moving a frame --- frontend/src/app/main/ui/workspace/frame_grid.cljs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/frame_grid.cljs b/frontend/src/app/main/ui/workspace/frame_grid.cljs index 88b200096..eb4e3a4d3 100644 --- a/frontend/src/app/main/ui/workspace/frame_grid.cljs +++ b/frontend/src/app/main/ui/workspace/frame_grid.cljs @@ -10,6 +10,7 @@ (ns app.main.ui.workspace.frame-grid (:require [rumext.alpha :as mf] + [okulary.core :as l] [app.main.refs :as refs] [app.common.math :as mth] [app.common.pages :as cp] @@ -81,10 +82,17 @@ :row [:> layout-grid props])))))) +(def shapes-moving-ref + (let [moving-shapes (fn [local] + (when (= :move (:transform local)) + (:selected local)))] + (l/derived moving-shapes refs/workspace-local))) + (mf/defc frame-grid [{:keys [zoom]}] - (let [frames (mf/deref refs/workspace-frames)] + (let [frames (mf/deref refs/workspace-frames) + shapes-moving (mf/deref shapes-moving-ref)] [:g.grid-display {:style {:pointer-events "none"}} - (for [frame frames] + (for [frame (->> frames (remove #(contains? shapes-moving (:id %))))] [:& grid-display-frame {:key (str "grid-" (:id frame)) :zoom zoom :frame (gsh/transform-shape frame)}])])) From ba7b2fd270488d982c34269787b159345d7a918a Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Jan 2021 08:20:56 +0100 Subject: [PATCH 07/15] :bug: Fixed problems with lines selrect --- common/app/common/geom/shapes/path.cljc | 8 +- .../src/app/main/ui/workspace/selection.cljs | 100 +++++++++++------- 2 files changed, 67 insertions(+), 41 deletions(-) diff --git a/common/app/common/geom/shapes/path.cljc b/common/app/common/geom/shapes/path.cljc index 08378b220..92553088a 100644 --- a/common/app/common/geom/shapes/path.cljc +++ b/common/app/common/geom/shapes/path.cljc @@ -120,9 +120,13 @@ extremities (mapcat calc-extremities content - (d/concat [nil] content))] + (d/concat [nil] content)) - (gpr/points->selrect extremities))) + selrect (gpr/points->selrect extremities)] + + (-> selrect + (update :width #(if (mth/almost-zero? %) 1 %)) + (update :height #(if (mth/almost-zero? %) 1 %))))) (defn transform-content [content transform] (let [set-tr (fn [params px py] diff --git a/frontend/src/app/main/ui/workspace/selection.cljs b/frontend/src/app/main/ui/workspace/selection.cljs index 117f53a4b..911db1deb 100644 --- a/frontend/src/app/main/ui/workspace/selection.cljs +++ b/frontend/src/app/main/ui/workspace/selection.cljs @@ -42,6 +42,7 @@ (def selection-rect-color-normal "#1FDEA7") (def selection-rect-color-component "#00E0FF") (def selection-rect-width 1) +(def min-selrect-side 10) (mf/defc selection-rect [{:keys [transform rect zoom color]}] (when rect @@ -57,56 +58,65 @@ :fill "transparent"}}]))) (defn- handlers-for-selection [{:keys [x y width height]}] - [;; TOP-LEFT - {:type :rotation - :position :top-left - :props {:cx x :cy y}} + (->> + [ ;; TOP-LEFT + {:type :rotation + :position :top-left + :props {:cx x :cy y}} - {:type :resize-point - :position :top-left - :props {:cx x :cy y}} + (when (and (> width min-selrect-side) (> height min-selrect-side)) + {:type :resize-point + :position :top-left + :props {:cx x :cy y}}) - {:type :rotation - :position :top-right - :props {:cx (+ x width) :cy y}} + {:type :rotation + :position :top-right + :props {:cx (+ x width) :cy y}} - {:type :resize-point - :position :top-right - :props {:cx (+ x width) :cy y}} + (when (and (> width min-selrect-side) (> height min-selrect-side)) + {:type :resize-point + :position :top-right + :props {:cx (+ x width) :cy y}}) - {:type :rotation - :position :bottom-right - :props {:cx (+ x width) :cy (+ y height)}} + {:type :rotation + :position :bottom-right + :props {:cx (+ x width) :cy (+ y height)}} - {:type :resize-point - :position :bottom-right - :props {:cx (+ x width) :cy (+ y height)}} + (when (and (> width min-selrect-side) (> height min-selrect-side)) + {:type :resize-point + :position :bottom-right + :props {:cx (+ x width) :cy (+ y height)}}) - {:type :rotation - :position :bottom-left - :props {:cx x :cy (+ y height)}} + {:type :rotation + :position :bottom-left + :props {:cx x :cy (+ y height)}} - {:type :resize-point - :position :bottom-left - :props {:cx x :cy (+ y height)}} + (when (and (> width min-selrect-side) (> height min-selrect-side)) + {:type :resize-point + :position :bottom-left + :props {:cx x :cy (+ y height)}}) - {:type :resize-side - :position :top - :props {:x x :y y :length width :angle 0 }} + (when (> height min-selrect-side) + {:type :resize-side + :position :top + :props {:x x :y y :length width :angle 0 }}) - {:type :resize-side - :position :right - :props {:x (+ x width) :y y :length height :angle 90 }} + (when (> width min-selrect-side) + {:type :resize-side + :position :right + :props {:x (+ x width) :y y :length height :angle 90 }}) - {:type :resize-side - :position :bottom - :props {:x (+ x width) :y (+ y height) :length width :angle 180 }} + (when (> height min-selrect-side) + {:type :resize-side + :position :bottom + :props {:x (+ x width) :y (+ y height) :length width :angle 180 }}) - {:type :resize-side - :position :left - :props {:x x :y (+ y height) :length height :angle 270 }} + (when (> width min-selrect-side) + {:type :resize-side + :position :left + :props {:x x :y (+ y height) :length height :angle 270 }})] - ]) + (filterv (comp not nil?)))) (mf/defc rotation-handler [{:keys [cx cy transform position rotation zoom on-rotate]}] (let [size (/ rotation-handler-size zoom) @@ -171,6 +181,17 @@ :cursor (if (#{:left :right} position) (cur/resize-ew rotation) (cur/resize-ns rotation)) }}])) + +(defn minimum-selrect [{:keys [x y width height] :as selrect}] + (let [final-width (max width min-selrect-side) + final-height (max height min-selrect-side) + offset-x (/ (- final-width width) 2) + offset-y (/ (- final-height height) 2)] + {:x (- x offset-x) + :y (- y offset-y) + :width final-width + :height final-height})) + (mf/defc controls {::mf/wrap-props false} [props] @@ -181,7 +202,8 @@ on-rotate (obj/get props "on-rotate") current-transform (mf/deref refs/current-transform) - selrect (:selrect shape) + selrect (-> (:selrect shape) + minimum-selrect) transform (geom/transform-matrix shape {:no-flip true})] (when (not (#{:move :rotate} current-transform)) From 28658cae7390c108a1a04a6d3f13d3eb303e3845 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Jan 2021 08:21:05 +0100 Subject: [PATCH 08/15] :bug: Fixed remove fill to transparent color --- frontend/src/app/main/ui/shapes/attrs.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/main/ui/shapes/attrs.cljs b/frontend/src/app/main/ui/shapes/attrs.cljs index e536ea6e4..500b7396d 100644 --- a/frontend/src/app/main/ui/shapes/attrs.cljs +++ b/frontend/src/app/main/ui/shapes/attrs.cljs @@ -34,7 +34,7 @@ (:fill-color-gradient shape) (obj/merge! attrs #js {:fill (str/format "url(#%s)" fill-color-gradient-id)}) - (or (:fill-color shape) (:fill-opacity shape)) + (not (:fill-color-gradient shape)) (obj/merge! attrs #js {:fill (or (:fill-color shape) "transparent") :fillOpacity (:fill-opacity shape nil)}) From cb7499c10abda594b190a314ee85a114c72f2115 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Jan 2021 11:19:59 +0100 Subject: [PATCH 09/15] :bug: Fixes path/curve position for frame --- common/app/common/pages/helpers.cljc | 2 +- .../src/app/main/data/workspace/common.cljs | 5 ++++- .../main/data/workspace/drawing/curve.cljs | 18 +++++++++++++--- .../app/main/data/workspace/drawing/path.cljs | 21 +++++++++++++++---- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/common/app/common/pages/helpers.cljc b/common/app/common/pages/helpers.cljc index f9ce2b24c..c27f68103 100644 --- a/common/app/common/pages/helpers.cljc +++ b/common/app/common/pages/helpers.cljc @@ -299,7 +299,7 @@ (let [frames (select-frames objects)] (or (->> frames - (d/seek #(gsh/has-point? % position)) + (d/seek #(and position (gsh/has-point? % position))) :id) uuid/zero))) diff --git a/frontend/src/app/main/data/workspace/common.cljs b/frontend/src/app/main/data/workspace/common.cljs index 153b51d82..eddb1e4b2 100644 --- a/frontend/src/app/main/data/workspace/common.cljs +++ b/frontend/src/app/main/data/workspace/common.cljs @@ -16,6 +16,7 @@ [app.common.spec :as us] [app.common.uuid :as uuid] [app.main.worker :as uw] + [app.main.streams :as ms] [app.util.logging :as log] [app.util.timers :as ts] [beicon.core :as rx] @@ -558,10 +559,12 @@ name (-> objects (retrieve-used-names) (generate-unique-name (:name attrs))) + + position @ms/mouse-position frame-id (if (= :frame (:type attrs)) uuid/zero (or (:frame-id attrs) - (cp/frame-id-by-position objects attrs))) + (cp/frame-id-by-position objects position))) [rchanges uchanges] (add-shape-changes page-id (assoc attrs :id id diff --git a/frontend/src/app/main/data/workspace/drawing/curve.cljs b/frontend/src/app/main/data/workspace/drawing/curve.cljs index 6edb5390d..a5f028a45 100644 --- a/frontend/src/app/main/data/workspace/drawing/curve.cljs +++ b/frontend/src/app/main/data/workspace/drawing/curve.cljs @@ -16,7 +16,9 @@ [app.common.geom.shapes.path :as gsp] [app.main.streams :as ms] [app.util.geom.path :as path] - [app.main.data.workspace.drawing.common :as common])) + [app.main.data.workspace.drawing.common :as common] + [app.main.data.workspace.common :as dwc] + [app.common.pages :as cp])) (def simplify-tolerance 0.3) @@ -27,7 +29,6 @@ (assoc-in state [:workspace-drawing :object :initialized?] true)) (defn insert-point-segment [state point] - (let [segments (-> state (get-in [:workspace-drawing :object :segments]) (or []) @@ -42,7 +43,17 @@ :selrect selrect :points points)))) +(defn setup-frame-curve [] + (ptk/reify ::setup-frame-path + ptk/UpdateEvent + (update [_ state] + (let [objects (dwc/lookup-page-objects state) + content (get-in state [:workspace-drawing :object :content] []) + position (get-in content [0 :params] nil) + frame-id (cp/frame-id-by-position objects position)] + (-> state + (assoc-in [:workspace-drawing :object :frame-id] frame-id)))))) (defn curve-to-path [{:keys [segments] :as shape}] (let [content (gsp/segments->content segments) @@ -74,5 +85,6 @@ (->> mouse (rx/map (fn [pt] #(insert-point-segment % pt))) (rx/take-until stoper)) - (rx/of finish-drawing-curve + (rx/of (setup-frame-curve) + finish-drawing-curve common/handle-finish-drawing)))))) diff --git a/frontend/src/app/main/data/workspace/drawing/path.cljs b/frontend/src/app/main/data/workspace/drawing/path.cljs index 25515a45c..a26fde33e 100644 --- a/frontend/src/app/main/data/workspace/drawing/path.cljs +++ b/frontend/src/app/main/data/workspace/drawing/path.cljs @@ -24,7 +24,8 @@ [app.main.store :as st] [app.main.data.workspace.common :as dwc] [app.main.data.workspace.drawing.common :as common] - [app.common.geom.shapes.path :as gsp])) + [app.common.geom.shapes.path :as gsp] + [app.common.pages :as cp])) ;; SCHEMAS @@ -269,8 +270,7 @@ fix-angle? shift? {:keys [last-point prev-handler]} (get-in state [:workspace-local :edit-path id]) position (cond-> (gpt/point x y) - fix-angle? (position-fixed-angle last-point)) - ] + fix-angle? (position-fixed-angle last-point))] (if-not (= last-point position) (-> state (assoc-in [:workspace-local :edit-path id :last-point] position) @@ -809,6 +809,18 @@ (assoc-in [:workspace-local :edit-path id :selected-handlers] #{}) (assoc-in [:workspace-local :edit-path id :selected-points] #{})))))) +(defn setup-frame-path [] + (ptk/reify ::setup-frame-path + ptk/UpdateEvent + (update [_ state] + + (let [objects (dwc/lookup-page-objects state) + content (get-in state [:workspace-drawing :object :content] []) + position (get-in content [0 :params] nil) + frame-id (cp/frame-id-by-position objects position)] + (-> state + (assoc-in [:workspace-drawing :object :frame-id] frame-id)))))) + (defn handle-new-shape-result [shape-id] (ptk/reify ::handle-new-shape-result ptk/UpdateEvent @@ -821,7 +833,8 @@ ptk/WatchEvent (watch [_ state stream] - (->> (rx/of common/handle-finish-drawing + (->> (rx/of (setup-frame-path) + common/handle-finish-drawing (dwc/start-edition-mode shape-id) (start-path-edit shape-id) (change-edit-mode :draw)))))) From 356572c21b32aa321f8121eef8fe7b92085c7443 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Jan 2021 11:48:06 +0100 Subject: [PATCH 10/15] :bug: Copy for delete page dialog --- frontend/resources/locales.json | 76 +++++++++++-------- .../main/ui/workspace/sidebar/sitemap.cljs | 15 +++- 2 files changed, 55 insertions(+), 36 deletions(-) diff --git a/frontend/resources/locales.json b/frontend/resources/locales.json index f9ef9d997..e725683ab 100644 --- a/frontend/resources/locales.json +++ b/frontend/resources/locales.json @@ -18,7 +18,7 @@ } }, "auth.create-demo-account" : { - "used-in" : [ "src/app/main/ui/auth/register.cljs:136", "src/app/main/ui/auth/login.cljs:160" ], + "used-in" : [ "src/app/main/ui/auth/login.cljs:160", "src/app/main/ui/auth/register.cljs:136" ], "translations" : { "en" : "Create demo account", "fr" : "Vous voulez juste essayer?", @@ -27,7 +27,7 @@ } }, "auth.create-demo-profile" : { - "used-in" : [ "src/app/main/ui/auth/register.cljs:133", "src/app/main/ui/auth/login.cljs:157" ], + "used-in" : [ "src/app/main/ui/auth/login.cljs:157", "src/app/main/ui/auth/register.cljs:133" ], "translations" : { "en" : "Just wanna try it?", "fr" : "Vous voulez juste essayer?", @@ -45,7 +45,7 @@ } }, "auth.email" : { - "used-in" : [ "src/app/main/ui/auth/register.cljs:101", "src/app/main/ui/auth/recovery_request.cljs:47", "src/app/main/ui/auth/login.cljs:99" ], + "used-in" : [ "src/app/main/ui/auth/login.cljs:99", "src/app/main/ui/auth/register.cljs:101", "src/app/main/ui/auth/recovery_request.cljs:47" ], "translations" : { "en" : "Email", "fr" : "Adresse email", @@ -196,7 +196,7 @@ } }, "auth.password" : { - "used-in" : [ "src/app/main/ui/auth/register.cljs:106", "src/app/main/ui/auth/login.cljs:106" ], + "used-in" : [ "src/app/main/ui/auth/login.cljs:106", "src/app/main/ui/auth/register.cljs:106" ], "translations" : { "en" : "Password", "fr" : "Mot de passe", @@ -259,7 +259,7 @@ } }, "auth.register-submit" : { - "used-in" : [ "src/app/main/ui/auth/register.cljs:110", "src/app/main/ui/auth/login.cljs:134" ], + "used-in" : [ "src/app/main/ui/auth/login.cljs:134", "src/app/main/ui/auth/register.cljs:110" ], "translations" : { "en" : "Create an account", "fr" : "Créer un compte", @@ -674,7 +674,7 @@ } }, "dashboard.update-settings" : { - "used-in" : [ "src/app/main/ui/settings/profile.cljs:82", "src/app/main/ui/settings/password.cljs:96", "src/app/main/ui/settings/options.cljs:72" ], + "used-in" : [ "src/app/main/ui/settings/options.cljs:72", "src/app/main/ui/settings/profile.cljs:82", "src/app/main/ui/settings/password.cljs:96" ], "translations" : { "en" : "Update settings", "fr" : "Mettre à jour les paramètres", @@ -796,7 +796,7 @@ } }, "errors.clipboard-not-implemented" : { - "used-in" : [ "src/app/main/data/workspace.cljs:1248" ], + "used-in" : [ "src/app/main/data/workspace.cljs:1251" ], "translations" : { "en" : "Your browser cannot do this operation, please use Ctrl-V", "fr" : "", @@ -805,7 +805,7 @@ } }, "errors.email-already-exists" : { - "used-in" : [ "src/app/main/ui/auth/verify_token.cljs:80", "src/app/main/ui/settings/change_email.cljs:47" ], + "used-in" : [ "src/app/main/ui/settings/change_email.cljs:47", "src/app/main/ui/auth/verify_token.cljs:80" ], "translations" : { "en" : "Email already used", "fr" : "Adresse e-mail déjà utilisée", @@ -832,7 +832,7 @@ } }, "errors.generic" : { - "used-in" : [ "src/app/main/ui/auth/verify_token.cljs:89", "src/app/main/ui/settings/profile.cljs:42", "src/app/main/ui/settings/options.cljs:32" ], + "used-in" : [ "src/app/main/ui/settings/options.cljs:32", "src/app/main/ui/settings/profile.cljs:42", "src/app/main/ui/auth/verify_token.cljs:89" ], "translations" : { "en" : "Something wrong has happened.", "fr" : "Quelque chose c'est mal passé.", @@ -859,7 +859,7 @@ } }, "errors.media-type-mismatch" : { - "used-in" : [ "src/app/main/data/workspace/persistence.cljs:393", "src/app/main/data/media.cljs:78" ], + "used-in" : [ "src/app/main/data/media.cljs:78", "src/app/main/data/workspace/persistence.cljs:394" ], "translations" : { "en" : "Seems that the contents of the image does not match the file extension.", "fr" : "", @@ -868,7 +868,7 @@ } }, "errors.media-type-not-allowed" : { - "used-in" : [ "src/app/main/data/workspace/persistence.cljs:390", "src/app/main/data/media.cljs:75" ], + "used-in" : [ "src/app/main/data/media.cljs:75", "src/app/main/data/workspace/persistence.cljs:391" ], "translations" : { "en" : "Seems that this is not a valid image.", "fr" : "", @@ -913,7 +913,7 @@ } }, "errors.unexpected-error" : { - "used-in" : [ "src/app/main/data/media.cljs:81", "src/app/main/ui/workspace/sidebar/options/exports.cljs:66", "src/app/main/ui/auth/register.cljs:45", "src/app/main/ui/handoff/exports.cljs:41" ], + "used-in" : [ "src/app/main/data/media.cljs:81", "src/app/main/ui/auth/register.cljs:45", "src/app/main/ui/workspace/sidebar/options/exports.cljs:66", "src/app/main/ui/handoff/exports.cljs:41" ], "translations" : { "en" : "An unexpected error occurred.", "fr" : "Une erreur inattendue c'est produite", @@ -1414,7 +1414,7 @@ } }, "labels.delete" : { - "used-in" : [ "src/app/main/ui/dashboard/grid.cljs:177", "src/app/main/ui/dashboard/files.cljs:85" ], + "used-in" : [ "src/app/main/ui/dashboard/files.cljs:85", "src/app/main/ui/dashboard/grid.cljs:177" ], "translations" : { "en" : "Delete", "fr" : "Supprimer", @@ -1478,7 +1478,7 @@ } }, "labels.hide-resolved-comments" : { - "used-in" : [ "src/app/main/ui/workspace/comments.cljs:129", "src/app/main/ui/viewer/header.cljs:175" ], + "used-in" : [ "src/app/main/ui/viewer/header.cljs:175", "src/app/main/ui/workspace/comments.cljs:129" ], "translations" : { "en" : "Hide resolved comments", "es" : "Ocultar comentarios resueltos" @@ -1503,7 +1503,7 @@ } }, "labels.members" : { - "used-in" : [ "src/app/main/ui/dashboard/team.cljs:60", "src/app/main/ui/dashboard/team.cljs:66", "src/app/main/ui/dashboard/sidebar.cljs:297" ], + "used-in" : [ "src/app/main/ui/dashboard/sidebar.cljs:297", "src/app/main/ui/dashboard/team.cljs:60", "src/app/main/ui/dashboard/team.cljs:66" ], "translations" : { "en" : "Members", "es" : "Integrantes" @@ -1615,7 +1615,7 @@ } }, "labels.rename" : { - "used-in" : [ "src/app/main/ui/dashboard/grid.cljs:176", "src/app/main/ui/dashboard/sidebar.cljs:300", "src/app/main/ui/dashboard/files.cljs:84" ], + "used-in" : [ "src/app/main/ui/dashboard/sidebar.cljs:300", "src/app/main/ui/dashboard/files.cljs:84", "src/app/main/ui/dashboard/grid.cljs:176" ], "translations" : { "en" : "Rename", "es" : "Renombrar" @@ -1629,7 +1629,7 @@ } }, "labels.settings" : { - "used-in" : [ "src/app/main/ui/settings/sidebar.cljs:80", "src/app/main/ui/dashboard/team.cljs:61", "src/app/main/ui/dashboard/team.cljs:68", "src/app/main/ui/dashboard/sidebar.cljs:298" ], + "used-in" : [ "src/app/main/ui/settings/sidebar.cljs:80", "src/app/main/ui/dashboard/sidebar.cljs:298", "src/app/main/ui/dashboard/team.cljs:61", "src/app/main/ui/dashboard/team.cljs:68" ], "translations" : { "en" : "Settings", "fr" : "Settings", @@ -1647,14 +1647,14 @@ } }, "labels.show-all-comments" : { - "used-in" : [ "src/app/main/ui/workspace/comments.cljs:117", "src/app/main/ui/viewer/header.cljs:163" ], + "used-in" : [ "src/app/main/ui/viewer/header.cljs:163", "src/app/main/ui/workspace/comments.cljs:117" ], "translations" : { "en" : "Show all comments", "es" : "Mostrar todos los comentarios" } }, "labels.show-your-comments" : { - "used-in" : [ "src/app/main/ui/workspace/comments.cljs:122", "src/app/main/ui/viewer/header.cljs:168" ], + "used-in" : [ "src/app/main/ui/viewer/header.cljs:168", "src/app/main/ui/workspace/comments.cljs:122" ], "translations" : { "en" : "Show only yours comments", "es" : "Mostrar sólo tus comentarios" @@ -1684,7 +1684,7 @@ } }, "media.loading" : { - "used-in" : [ "src/app/main/data/workspace/persistence.cljs:471", "src/app/main/data/workspace/persistence.cljs:526", "src/app/main/data/media.cljs:60" ], + "used-in" : [ "src/app/main/data/media.cljs:60", "src/app/main/data/workspace/persistence.cljs:472", "src/app/main/data/workspace/persistence.cljs:527" ], "translations" : { "en" : "Loading image...", "fr" : "Chargement de l'image...", @@ -1851,6 +1851,18 @@ "es" : "Eliminando archivo" } }, + "modals.delete-page.body" : { + "used-in" : [ "src/app/main/ui/workspace/sidebar/sitemap.cljs:45" ], + "translations" : { + "en" : "Are you sure you want to delete this page?" + } + }, + "modals.delete-page.title" : { + "used-in" : [ "src/app/main/ui/workspace/sidebar/sitemap.cljs:44" ], + "translations" : { + "en" : "Delete page" + } + }, "modals.delete-project-confirm.accept" : { "used-in" : [ "src/app/main/ui/dashboard/files.cljs:58" ], "translations" : { @@ -2035,7 +2047,7 @@ } }, "notifications.profile-saved" : { - "used-in" : [ "src/app/main/ui/settings/profile.cljs:38", "src/app/main/ui/settings/options.cljs:36" ], + "used-in" : [ "src/app/main/ui/settings/options.cljs:36", "src/app/main/ui/settings/profile.cljs:38" ], "translations" : { "en" : "Profile saved successfully!", "fr" : "Profil enregistré avec succès!", @@ -2044,7 +2056,7 @@ } }, "notifications.validation-email-sent" : { - "used-in" : [ "src/app/main/ui/auth/register.cljs:54", "src/app/main/ui/settings/change_email.cljs:56" ], + "used-in" : [ "src/app/main/ui/settings/change_email.cljs:56", "src/app/main/ui/auth/register.cljs:54" ], "translations" : { "en" : "Verification email sent to %s. Check your email!", "es" : "Verificación de email enviada a %s. Comprueba tu correo." @@ -2060,7 +2072,7 @@ } }, "settings.multiple" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/options/stroke.cljs:154", "src/app/main/ui/workspace/sidebar/options/rows/color_row.cljs:161", "src/app/main/ui/workspace/sidebar/options/rows/color_row.cljs:170", "src/app/main/ui/workspace/sidebar/options/typography.cljs:99", "src/app/main/ui/workspace/sidebar/options/typography.cljs:149", "src/app/main/ui/workspace/sidebar/options/typography.cljs:162", "src/app/main/ui/workspace/sidebar/options/shadow.cljs:213", "src/app/main/ui/workspace/sidebar/options/blur.cljs:79" ], + "used-in" : [ "src/app/main/ui/workspace/sidebar/options/shadow.cljs:213", "src/app/main/ui/workspace/sidebar/options/rows/color_row.cljs:161", "src/app/main/ui/workspace/sidebar/options/rows/color_row.cljs:170", "src/app/main/ui/workspace/sidebar/options/typography.cljs:99", "src/app/main/ui/workspace/sidebar/options/typography.cljs:149", "src/app/main/ui/workspace/sidebar/options/typography.cljs:162", "src/app/main/ui/workspace/sidebar/options/blur.cljs:79", "src/app/main/ui/workspace/sidebar/options/stroke.cljs:154" ], "translations" : { "en" : "Mixed", "fr" : null, @@ -3239,7 +3251,7 @@ } }, "workspace.options.position" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/options/measures.cljs:146", "src/app/main/ui/workspace/sidebar/options/frame.cljs:118" ], + "used-in" : [ "src/app/main/ui/workspace/sidebar/options/frame.cljs:118", "src/app/main/ui/workspace/sidebar/options/measures.cljs:146" ], "translations" : { "en" : "Position", "fr" : "Position", @@ -3372,7 +3384,7 @@ } }, "workspace.options.size" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/options/measures.cljs:118", "src/app/main/ui/workspace/sidebar/options/frame.cljs:93" ], + "used-in" : [ "src/app/main/ui/workspace/sidebar/options/frame.cljs:93", "src/app/main/ui/workspace/sidebar/options/measures.cljs:118" ], "translations" : { "en" : "Size", "fr" : "Taille", @@ -3582,7 +3594,7 @@ } }, "workspace.options.text-options.none" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/options/text.cljs:153", "src/app/main/ui/workspace/sidebar/options/typography.cljs:176" ], + "used-in" : [ "src/app/main/ui/workspace/sidebar/options/typography.cljs:176", "src/app/main/ui/workspace/sidebar/options/text.cljs:153" ], "translations" : { "en" : "None", "fr" : "Aucune", @@ -3721,7 +3733,7 @@ } }, "workspace.shape.menu.detach-instance" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/options/component.cljs:79", "src/app/main/ui/workspace/sidebar/options/component.cljs:84", "src/app/main/ui/workspace/context_menu.cljs:163", "src/app/main/ui/workspace/context_menu.cljs:173" ], + "used-in" : [ "src/app/main/ui/workspace/context_menu.cljs:163", "src/app/main/ui/workspace/context_menu.cljs:173", "src/app/main/ui/workspace/sidebar/options/component.cljs:79", "src/app/main/ui/workspace/sidebar/options/component.cljs:84" ], "translations" : { "en" : "Detach instance", "es" : "Desacoplar instancia" @@ -3749,7 +3761,7 @@ } }, "workspace.shape.menu.go-master" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/options/component.cljs:86", "src/app/main/ui/workspace/context_menu.cljs:177" ], + "used-in" : [ "src/app/main/ui/workspace/context_menu.cljs:177", "src/app/main/ui/workspace/sidebar/options/component.cljs:86" ], "translations" : { "en" : "Go to master component file", "es" : "Ir al archivo del componente maestro" @@ -3791,7 +3803,7 @@ } }, "workspace.shape.menu.reset-overrides" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/options/component.cljs:80", "src/app/main/ui/workspace/sidebar/options/component.cljs:85", "src/app/main/ui/workspace/context_menu.cljs:165", "src/app/main/ui/workspace/context_menu.cljs:175" ], + "used-in" : [ "src/app/main/ui/workspace/context_menu.cljs:165", "src/app/main/ui/workspace/context_menu.cljs:175", "src/app/main/ui/workspace/sidebar/options/component.cljs:80", "src/app/main/ui/workspace/sidebar/options/component.cljs:85" ], "translations" : { "en" : "Reset overrides", "es" : "Deshacer modificaciones" @@ -3805,7 +3817,7 @@ } }, "workspace.shape.menu.show-master" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/options/component.cljs:82", "src/app/main/ui/workspace/context_menu.cljs:169" ], + "used-in" : [ "src/app/main/ui/workspace/context_menu.cljs:169", "src/app/main/ui/workspace/sidebar/options/component.cljs:82" ], "translations" : { "en" : "Show master component", "es" : "Ver componente maestro" @@ -3833,7 +3845,7 @@ } }, "workspace.shape.menu.update-master" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/options/component.cljs:81", "src/app/main/ui/workspace/context_menu.cljs:167" ], + "used-in" : [ "src/app/main/ui/workspace/context_menu.cljs:167", "src/app/main/ui/workspace/sidebar/options/component.cljs:81" ], "translations" : { "en" : "Update master component", "es" : "Actualizar componente maestro" @@ -3849,7 +3861,7 @@ "unused" : true }, "workspace.sidebar.sitemap" : { - "used-in" : [ "src/app/main/ui/workspace/sidebar/sitemap.cljs:164" ], + "used-in" : [ "src/app/main/ui/workspace/sidebar/sitemap.cljs:171" ], "translations" : { "en" : "Pages", "fr" : "Pages", diff --git a/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs b/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs index b7e99fbc6..4380d9619 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs @@ -19,7 +19,7 @@ [app.main.ui.icons :as i] [app.main.ui.keyboard :as kbd] [app.util.dom :as dom] - [app.util.i18n :as i18n :refer [t]] + [app.util.i18n :as i18n :refer [tr]] [app.util.router :as rt] [cuerdas.core :as str] [okulary.core :as l] @@ -34,9 +34,17 @@ id (:id page) delete-fn (mf/use-callback (mf/deps id) #(st/emit! (dw/delete-page id))) - on-delete (mf/use-callback (mf/deps id) #(modal/show! :confirm {:on-accept delete-fn})) navigate-fn (mf/use-callback (mf/deps id) #(st/emit! (dw/go-to-page id))) + on-delete + (mf/use-callback + (mf/deps id) + (st/emitf (modal/show + {:type :confirm + :title (tr "modals.delete-page.title") + :message (tr "modals.delete-page.body") + :on-accept delete-fn}))) + on-double-click (mf/use-callback (fn [event] @@ -151,7 +159,6 @@ (mf/defc sitemap [{:keys [layout] :as props}] (let [create (mf/use-callback #(st/emit! dw/create-empty-page)) - locale (mf/deref i18n/locale) show-pages? (mf/use-state true) file (mf/deref refs/workspace-file) @@ -161,7 +168,7 @@ [:div.sitemap.tool-window [:div.tool-window-bar - [:span (t locale "workspace.sidebar.sitemap")] + [:span (tr "workspace.sidebar.sitemap")] [:div.add-page {:on-click create} i/close] [:div.collapse-pages {:on-click toggle-pages} i/arrow-slide]] From 3b6c9f95113276aa491f6601d5b8c922c82b65d3 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Jan 2021 11:48:32 +0100 Subject: [PATCH 11/15] :bug: Fixes issues with horizontal scroll with trackpad --- frontend/src/app/main/ui/handoff.cljs | 6 ++++-- frontend/src/app/main/ui/viewer.cljs | 5 +++-- .../app/main/ui/workspace/colorpalette.cljs | 7 ++++--- .../src/app/main/ui/workspace/viewport.cljs | 21 ++++++++++++------- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/frontend/src/app/main/ui/handoff.cljs b/frontend/src/app/main/ui/handoff.cljs index f2d2ebb44..98f416e0f 100644 --- a/frontend/src/app/main/ui/handoff.cljs +++ b/frontend/src/app/main/ui/handoff.cljs @@ -77,8 +77,10 @@ (fn [event] (when (kbd/ctrl? event) (dom/prevent-default event) - (let [event (.getBrowserEvent ^js event)] - (if (pos? (.-deltaY ^js event)) + (let [event (.getBrowserEvent ^js event) + delta (+ (.-deltaY ^js event) + (.-deltaX ^js event))] + (if (pos? delta) (st/emit! dv/decrease-zoom) (st/emit! dv/increase-zoom)))))) diff --git a/frontend/src/app/main/ui/viewer.cljs b/frontend/src/app/main/ui/viewer.cljs index 94cefd316..4ce5db478 100644 --- a/frontend/src/app/main/ui/viewer.cljs +++ b/frontend/src/app/main/ui/viewer.cljs @@ -215,8 +215,9 @@ (fn [event] (when (kbd/ctrl? event) (dom/prevent-default event) - (let [event (.getBrowserEvent ^js event)] - (if (pos? (.-deltaY ^js event)) + (let [event (.getBrowserEvent ^js event) + delta (+ (.-deltaY ^js event) (.-deltaX ^js event))] + (if (pos? delta) (st/emit! dv/decrease-zoom) (st/emit! dv/increase-zoom))))) diff --git a/frontend/src/app/main/ui/workspace/colorpalette.cljs b/frontend/src/app/main/ui/workspace/colorpalette.cljs index 7d3f37862..641fd3467 100644 --- a/frontend/src/app/main/ui/workspace/colorpalette.cljs +++ b/frontend/src/app/main/ui/workspace/colorpalette.cljs @@ -103,9 +103,10 @@ (mf/use-callback (mf/deps max-offset) (fn [event] - (if (pos? (.. event -nativeEvent -deltaY)) - (on-right-arrow-click event) - (on-left-arrow-click event)))) + (let [delta (+ (.. event -nativeEvent -deltaY) (.. event -nativeEvent -deltaX))] + (if (pos? delta) + (on-right-arrow-click event) + (on-left-arrow-click event))))) on-resize (mf/use-callback diff --git a/frontend/src/app/main/ui/workspace/viewport.cljs b/frontend/src/app/main/ui/workspace/viewport.cljs index ff7ecc093..bd17c15f6 100644 --- a/frontend/src/app/main/ui/workspace/viewport.cljs +++ b/frontend/src/app/main/ui/workspace/viewport.cljs @@ -427,9 +427,11 @@ pos @ms/mouse-position] (dom/prevent-default event) (dom/stop-propagation event) - (if (pos? (.-deltaY event)) - (st/emit! (dw/decrease-zoom pos)) - (st/emit! (dw/increase-zoom pos)))) + (let [delta (+ (.-deltaY ^js event) + (.-deltaX ^js event))] + (if (pos? delta) + (st/emit! (dw/decrease-zoom pos)) + (st/emit! (dw/increase-zoom pos))))) (.contains ^js node target) (let [event (.getBrowserEvent ^js event) @@ -440,13 +442,18 @@ (= delta-mode WheelEvent.DeltaMode.LINE) 16 (= delta-mode WheelEvent.DeltaMode.PAGE) 100) - delta (* (.-deltaY ^js event) unit) - delta (/ delta @refs/selected-zoom)] + delta-y (-> (.-deltaY ^js event) + (* unit) + (/ @refs/selected-zoom)) + delta-x (-> (.-deltaX ^js event) + (* unit) + (/ @refs/selected-zoom))] (dom/prevent-default event) (dom/stop-propagation event) (if (kbd/shift? event) - (st/emit! (dw/update-viewport-position {:x #(+ % delta)})) - (st/emit! (dw/update-viewport-position {:y #(+ % delta)})))))))) + (st/emit! (dw/update-viewport-position {:x #(+ % delta-y)})) + (st/emit! (dw/update-viewport-position {:x #(+ % delta-x) + :y #(+ % delta-y)})))))))) on-drag-enter (mf/use-callback From cf4a4b2b25a77d7c9f9e112fa0650be358638cc5 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Jan 2021 12:16:30 +0100 Subject: [PATCH 12/15] :bug: Fixed search that displays deprecated materials --- backend/src/app/rpc/queries/files.clj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/backend/src/app/rpc/queries/files.clj b/backend/src/app/rpc/queries/files.clj index fca4e92eb..ee75e2ca8 100644 --- a/backend/src/app/rpc/queries/files.clj +++ b/backend/src/app/rpc/queries/files.clj @@ -111,11 +111,6 @@ and (ppr.is_admin = true or ppr.is_owner = true or ppr.can_edit = true) - union - select p.* - from project as p - where p.team_id = uuid_nil() - and p.deleted_at is null ) select distinct f.* from file as f From 9ee54d6267f70f7a9cdfd908298cc916adb697ad Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Jan 2021 12:33:43 +0100 Subject: [PATCH 13/15] :bug: Fixes issue with showing interactions on click --- frontend/src/app/main/ui/viewer.cljs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/main/ui/viewer.cljs b/frontend/src/app/main/ui/viewer.cljs index 4ce5db478..b6297e819 100644 --- a/frontend/src/app/main/ui/viewer.cljs +++ b/frontend/src/app/main/ui/viewer.cljs @@ -207,6 +207,7 @@ (let [on-click (fn [event] (dom/stop-propagation event) + (st/emit! (dcm/close-thread)) (let [mode (get state :interactions-mode)] (when (= mode :show-on-click) (st/emit! dv/flash-interactions)))) @@ -221,10 +222,6 @@ (st/emit! dv/decrease-zoom) (st/emit! dv/increase-zoom))))) - on-click - (fn [event] - (st/emit! (dcm/close-thread))) - on-key-down (fn [event] (when (kbd/esc? event) @@ -235,8 +232,8 @@ ;; bind with passive=false to allow the event to be cancelled ;; https://stackoverflow.com/a/57582286/3219895 (let [key1 (events/listen goog/global "wheel" on-mouse-wheel #js {"passive" false}) - key2 (events/listen js/document "keydown" on-key-down) - key3 (events/listen js/document "click" on-click)] + key2 (events/listen js/window "keydown" on-key-down) + key3 (events/listen js/window "click" on-click)] (fn [] (events/unlistenByKey key1) (events/unlistenByKey key2) From a3d8af9a966d1f8301aaa6d83189e97a00fb3220 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Jan 2021 12:47:09 +0100 Subject: [PATCH 14/15] :bug: Fixes measurements with with scroll --- frontend/src/app/main/ui/measurements.cljs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/measurements.cljs b/frontend/src/app/main/ui/measurements.cljs index 808548d6c..63f91e931 100644 --- a/frontend/src/app/main/ui/measurements.cljs +++ b/frontend/src/app/main/ui/measurements.cljs @@ -148,9 +148,9 @@ :else 0) offset-y (cond (< rect-y (:y bounds)) (- (:y bounds) rect-y) - (> (+ rect-y distance-pill-height) (+ (:y bounds) bounds-height)) - (- (+ (:y bounds) bounds-height) (+ rect-y distance-pill-height)) - :else 0)] + (> (+ rect-y distance-pill-height) (+ (:y bounds) bounds-height)) + (- (+ (:y bounds) bounds-height) (+ rect-y distance-pill-height (/ distance-pill-height 2))) + :else 0)] [:g.distance-pill [:rect {:x (+ rect-x offset-x) :y (+ rect-y offset-y) @@ -197,7 +197,9 @@ h-lines (->> (calculate-distance-lines (:x1 from) (:x2 from) (:x1 to) (:x2 to)) (map (fn [[start end]] [start fixed-y end fixed-y]))) - lines (d/concat [] v-lines h-lines)] + lines (d/concat [] v-lines h-lines) + + distance-line-stroke (/ distance-line-stroke zoom)] (for [[x1 y1 x2 y2] lines] (let [center-x (+ x1 (/ (- x2 x1) 2)) From 767f1c7b3d3f0fb63ff97acf1be4d858c8f515ea Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 14 Jan 2021 14:14:55 +0100 Subject: [PATCH 15/15] :sparkles: Center content on load --- frontend/src/app/main/data/workspace.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 600157360..4fe933772 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -366,8 +366,8 @@ :else (assoc local :vbox (assoc size - :x (- (:x srect) 40) - :y (- (:y srect) 40)))))) + :x (+ (:x srect) (/ (- (:width srect) width) 2)) + :y (+ (:y srect) (/ (- (:height srect) height) 2))))))) (setup [state local] (if (:vbox local)