Fix problem with rotated layers

This commit is contained in:
alonso.torres 2023-06-21 15:24:49 +02:00
parent a70d909a25
commit ecc3b29996
2 changed files with 18 additions and 7 deletions

View file

@ -25,6 +25,8 @@
:box-shadow :shadows :box-shadow :shadows
:filter :blur :filter :blur
:gap :size-array :gap :size-array
:row-gap :size-array
:column-gap :size-array
:padding :size-array :padding :size-array
:grid-template-rows :tracks :grid-template-rows :tracks
:grid-template-columns :tracks :grid-template-columns :tracks

View file

@ -9,8 +9,7 @@
(:require (:require
[app.common.data.macros :as dm] [app.common.data.macros :as dm]
[app.common.geom.matrix :as gmt] [app.common.geom.matrix :as gmt]
;;[app.common.geom.point :as gpt] [app.common.geom.shapes :as gsh]
;;[app.common.geom.shapes.points :as gpo]
[app.common.pages.helpers :as cph] [app.common.pages.helpers :as cph]
[app.common.types.shape.layout :as ctl])) [app.common.types.shape.layout :as ctl]))
@ -49,11 +48,21 @@
(defn get-shape-position (defn get-shape-position
[shape objects coord] [shape objects coord]
(let [shape-value (-> shape :selrect coord) (let [
parent-value (dm/get-in objects [(:parent-id shape) :selrect coord])] parent (get objects (:parent-id shape))
(when-not (or (cph/root-frame? shape) parent-value (dm/get-in parent [:selrect coord])
(ctl/any-layout-immediate-child? objects shape)
(ctl/layout-absolute? shape)) [selrect _ _]
(-> (:points shape)
(gsh/transform-points (gsh/center-shape parent) (:transform-inverse parent))
(gsh/calculate-geometry))
;;shape (gsh/transform-shape)
shape-value (get selrect coord)
]
(when (and (not (cph/root-frame? shape))
(or (not (ctl/any-layout-immediate-child? objects shape))
(ctl/layout-absolute? shape)))
(- shape-value parent-value)))) (- shape-value parent-value))))
#_(defn get-shape-position #_(defn get-shape-position