From 1cda61e230dd7b91b2a865c5a6d0d5fae7886c49 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 4 Nov 2024 11:02:04 +0100 Subject: [PATCH] :bug: Fix problem with plugins path positioning --- frontend/src/app/plugins/shape.cljs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/plugins/shape.cljs b/frontend/src/app/plugins/shape.cljs index c480b6b0a..0245e9c63 100644 --- a/frontend/src/app/plugins/shape.cljs +++ b/frontend/src/app/plugins/shape.cljs @@ -952,7 +952,7 @@ ;; Geometry properties {:name "x" - :get #(-> % u/proxy->shape :x) + :get #(-> % u/proxy->shape :points grc/points->rect :x) :set (fn [self value] (let [id (obj/get self "$id")] @@ -967,7 +967,7 @@ (st/emit! (dw/update-position id {:x value})))))} {:name "y" - :get #(-> % u/proxy->shape :y) + :get #(-> % u/proxy->shape :points grc/points->rect :y) :set (fn [self value] (let [id (obj/get self "$id")] @@ -991,9 +991,10 @@ {:name "parentX" :get (fn [self] (let [shape (u/proxy->shape self) + shape-x (-> shape :points grc/points->rect :x) parent-id (:parent-id shape) parent (u/locate-shape (obj/get self "$file") (obj/get self "$page") parent-id)] - (- (:x shape) (:x parent)))) + (- shape-x (:x parent)))) :set (fn [self value] (cond @@ -1013,10 +1014,11 @@ {:name "parentY" :get (fn [self] (let [shape (u/proxy->shape self) + shape-y (-> shape :points grc/points->rect :y) parent-id (:parent-id shape) parent (u/locate-shape (obj/get self "$file") (obj/get self "$page") parent-id) parent-y (:y parent)] - (- (:y shape) parent-y))) + (- shape-y parent-y))) :set (fn [self value] (cond @@ -1036,10 +1038,11 @@ {:name "boardX" :get (fn [self] (let [shape (u/proxy->shape self) + shape-x (-> shape :points grc/points->rect :x) frame-id (:parent-id shape) frame (u/locate-shape (obj/get self "$file") (obj/get self "$page") frame-id) frame-x (:x frame)] - (- (:x shape) frame-x))) + (- shape-x frame-x))) :set (fn [self value] (cond @@ -1059,10 +1062,11 @@ {:name "boardY" :get (fn [self] (let [shape (u/proxy->shape self) + shape-y (-> shape :points grc/points->rect :y) frame-id (:parent-id shape) frame (u/locate-shape (obj/get self "$file") (obj/get self "$page") frame-id) frame-y (:y frame)] - (- (:y shape) frame-y))) + (- shape-y frame-y))) :set (fn [self value] (cond @@ -1080,10 +1084,10 @@ (st/emit! (dw/update-position id {:y (+ frame-y value)})))))} {:name "width" - :get #(-> % u/proxy->shape :width)} + :get #(-> % u/proxy->shape :selrect :width)} {:name "height" - :get #(-> % u/proxy->shape :height)} + :get #(-> % u/proxy->shape :selrect :height)} {:name "bounds" :get #(-> % u/proxy->shape :points grc/points->rect format/format-bounds)}