mirror of
https://github.com/penpot/penpot.git
synced 2025-08-04 12:08:23 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
0268964f36
33 changed files with 480 additions and 304 deletions
|
@ -323,3 +323,13 @@
|
|||
:rfn (fn [^Reader rdr]
|
||||
(let [^List x (read-object! rdr)]
|
||||
(Matrix. (.get x 0) (.get x 1) (.get x 2) (.get x 3) (.get x 4) (.get x 5))))})
|
||||
|
||||
|
||||
;; Backward compatibility for 1.19 with v1.20;
|
||||
|
||||
(add-handlers!
|
||||
{:name "penpot/geom/rect"
|
||||
:rfn read-map-like}
|
||||
{:name "penpot/shape"
|
||||
:rfn read-map-like})
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@
|
|||
(make-selrect (min xp1 xp2) (min yp1 yp2) (abs (- xp1 xp2)) (abs (- yp1 yp2)))))
|
||||
|
||||
(defn clip-selrect
|
||||
[{:keys [x1 y1 x2 y2] :as sr} bounds]
|
||||
[{:keys [x1 y1 x2 y2] :as sr} clip-rect]
|
||||
(when (some? sr)
|
||||
(let [{bx1 :x1 by1 :y1 bx2 :x2 by2 :y2} (rect->selrect bounds)]
|
||||
(let [{bx1 :x1 by1 :y1 bx2 :x2 by2 :y2 :as sr2} (rect->selrect clip-rect)]
|
||||
(corners->selrect (max bx1 x1) (max by1 y1) (min bx2 x2) (min by2 y2)))))
|
||||
|
|
|
@ -96,22 +96,25 @@
|
|||
"Get the parent shape linked to a component for this shape, if any"
|
||||
([objects shape] (get-component-shape objects shape nil))
|
||||
([objects shape {:keys [allow-main?] :or {allow-main? false} :as options}]
|
||||
(cond
|
||||
(nil? shape)
|
||||
nil
|
||||
(cond
|
||||
(nil? shape)
|
||||
nil
|
||||
|
||||
(and (not (ctk/in-component-copy? shape)) (not allow-main?))
|
||||
nil
|
||||
(= uuid/zero (:id shape))
|
||||
nil
|
||||
|
||||
(ctk/instance-root? shape)
|
||||
shape
|
||||
(and (not (ctk/in-component-copy? shape)) (not allow-main?))
|
||||
nil
|
||||
|
||||
:else
|
||||
(get-component-shape objects (get objects (:parent-id shape)) options))))
|
||||
(ctk/instance-root? shape)
|
||||
shape
|
||||
|
||||
:else
|
||||
(get-component-shape objects (get objects (:parent-id shape)) options))))
|
||||
|
||||
(defn in-component-main?
|
||||
"Check if the shape is inside a component non-main instance.
|
||||
|
||||
|
||||
Note that we must iterate on the parents because non-root shapes in
|
||||
a main component have not any discriminating attribute."
|
||||
[objects shape]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue