From 3bda4f6de3beb1c66d7173e9af1a1bda10e3d80d Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 20 Jan 2016 22:47:29 +0200 Subject: [PATCH] Fix selrect and options positions for groped shapes. --- src/uxbox/ui/workspace/options.cljs | 12 +++++++----- src/uxbox/ui/workspace/selrect.cljs | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/uxbox/ui/workspace/options.cljs b/src/uxbox/ui/workspace/options.cljs index 19919a1d7c..287811e04e 100644 --- a/src/uxbox/ui/workspace/options.cljs +++ b/src/uxbox/ui/workspace/options.cljs @@ -2,7 +2,8 @@ (:require [sablono.core :as html :refer-macros [html]] [rum.core :as rum] [uxbox.rstore :as rs] - [uxbox.shapes :as shapes] + [uxbox.state :as st] + [uxbox.shapes :as sh] [uxbox.data.workspace :as dw] [uxbox.ui.icons :as i] [uxbox.ui.mixins :as mx] @@ -28,16 +29,17 @@ :icon i/fill :id :menu/fill}}) -(defn viewportcoord->clientcoord +(defn- viewportcoord->clientcoord [pageid viewport-x viewport-y] (let [[offset-x offset-y] (get @wb/bounding-rect pageid) new-x (+ viewport-x offset-x) new-y (+ viewport-y offset-y)] [new-x new-y])) -(defn get-position - [{:keys [x y width page]}] - (let [vx (+ x width 50) +(defn- get-position + [{:keys [page width] :as shape}] + (let [{:keys [x y]} (sh/resolve-position shape) + vx (+ x width 50) vy (- y 50)] (viewportcoord->clientcoord page vx vy))) diff --git a/src/uxbox/ui/workspace/selrect.cljs b/src/uxbox/ui/workspace/selrect.cljs index 074f2f05b1..9650478bc1 100644 --- a/src/uxbox/ui/workspace/selrect.cljs +++ b/src/uxbox/ui/workspace/selrect.cljs @@ -49,7 +49,8 @@ (defn shapes-selrect-render [own shapes] (when (seq shapes) - (let [{:keys [width height x y]} (sh/group-size-and-position shapes)] + (let [shapes (map sh/resolve-position shapes) + {:keys [width height x y]} (sh/group-size-and-position shapes)] (html [:g.controls [:rect {:x x :y y :width width :height height