mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
🐛 Fix problem in viewer with hidden elements
This commit is contained in:
parent
844634e8c8
commit
02044a8153
3 changed files with 22 additions and 19 deletions
|
@ -140,40 +140,41 @@
|
|||
(update :width + (* 2 h-padding))
|
||||
(update :height + (* 2 v-padding)))))
|
||||
|
||||
(defn calculate-base-bounds
|
||||
[shape]
|
||||
(-> (get-shape-filter-bounds shape)
|
||||
(add-padding (calculate-padding shape true))))
|
||||
|
||||
(defn get-object-bounds
|
||||
[objects shape]
|
||||
(let [calculate-base-bounds
|
||||
(fn [shape]
|
||||
(-> (get-shape-filter-bounds shape)
|
||||
(add-padding (calculate-padding shape true))))
|
||||
|
||||
(let [base-bounds (calculate-base-bounds shape)
|
||||
bounds
|
||||
(cond
|
||||
(empty? (:shapes shape))
|
||||
[(calculate-base-bounds shape)]
|
||||
|
||||
(or (:masked-group shape) (= :bool (:type shape)))
|
||||
[(calculate-base-bounds shape)]
|
||||
|
||||
(and (cfh/frame-shape? shape) (not (:show-content shape)))
|
||||
[(calculate-base-bounds shape)]
|
||||
(or (empty? (:shapes shape))
|
||||
(or (:masked-group shape) (= :bool (:type shape)))
|
||||
(and (cfh/frame-shape? shape) (not (:show-content shape))))
|
||||
[base-bounds]
|
||||
|
||||
:else
|
||||
(cfh/reduce-objects
|
||||
objects
|
||||
|
||||
(fn [shape]
|
||||
(and (d/not-empty? (:shapes shape))
|
||||
(and (not (:hidden shape))
|
||||
(d/not-empty? (:shapes shape))
|
||||
(or (not (cfh/frame-shape? shape))
|
||||
(:show-content shape))
|
||||
|
||||
(or (not (cfh/group-shape? shape))
|
||||
(not (:masked-group shape)))))
|
||||
(:id shape)
|
||||
(fn [result child]
|
||||
(conj result (calculate-base-bounds child)))
|
||||
|
||||
[(calculate-base-bounds shape)]))
|
||||
(fn [result child]
|
||||
(cond-> result
|
||||
(not (:hidden child))
|
||||
(conj (calculate-base-bounds child))))
|
||||
|
||||
[base-bounds]))
|
||||
|
||||
children-bounds
|
||||
(cond->> (grc/join-rects bounds)
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
[{:keys [shape]}]
|
||||
[:*
|
||||
(when ^boolean (dbg/enabled? :bounding-boxes)
|
||||
[:& debug-bounding-boxes])
|
||||
[:& debug-bounding-boxes {:shape shape}])
|
||||
|
||||
(when (and ^boolean (cfh/text-shape? shape)
|
||||
^boolean (dbg/enabled? :text-outline)
|
||||
|
|
|
@ -44,7 +44,9 @@
|
|||
childs (mf/deref childs-ref)]
|
||||
|
||||
[:& shape-container {:shape shape :ref ref :disable-shadows? (cfh/is-direct-child-of-root? shape)}
|
||||
[:& frame-shape {:shape shape :childs childs}]]))))
|
||||
[:& frame-shape {:shape shape :childs childs}]
|
||||
(when *assert*
|
||||
[:& wsd/shape-debug {:shape shape}])]))))
|
||||
|
||||
(defn check-props
|
||||
[new-props old-props]
|
||||
|
|
Loading…
Add table
Reference in a new issue