mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 04:49:03 -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 :width + (* 2 h-padding))
|
||||||
(update :height + (* 2 v-padding)))))
|
(update :height + (* 2 v-padding)))))
|
||||||
|
|
||||||
(defn get-object-bounds
|
(defn calculate-base-bounds
|
||||||
[objects shape]
|
[shape]
|
||||||
(let [calculate-base-bounds
|
|
||||||
(fn [shape]
|
|
||||||
(-> (get-shape-filter-bounds shape)
|
(-> (get-shape-filter-bounds shape)
|
||||||
(add-padding (calculate-padding shape true))))
|
(add-padding (calculate-padding shape true))))
|
||||||
|
|
||||||
|
(defn get-object-bounds
|
||||||
|
[objects shape]
|
||||||
|
(let [base-bounds (calculate-base-bounds shape)
|
||||||
bounds
|
bounds
|
||||||
(cond
|
(cond
|
||||||
(empty? (:shapes shape))
|
(or (empty? (:shapes shape))
|
||||||
[(calculate-base-bounds shape)]
|
|
||||||
|
|
||||||
(or (:masked-group shape) (= :bool (:type shape)))
|
(or (:masked-group shape) (= :bool (:type shape)))
|
||||||
[(calculate-base-bounds shape)]
|
(and (cfh/frame-shape? shape) (not (:show-content shape))))
|
||||||
|
[base-bounds]
|
||||||
(and (cfh/frame-shape? shape) (not (:show-content shape)))
|
|
||||||
[(calculate-base-bounds shape)]
|
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(cfh/reduce-objects
|
(cfh/reduce-objects
|
||||||
objects
|
objects
|
||||||
|
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(and (d/not-empty? (:shapes shape))
|
(and (not (:hidden shape))
|
||||||
|
(d/not-empty? (:shapes shape))
|
||||||
(or (not (cfh/frame-shape? shape))
|
(or (not (cfh/frame-shape? shape))
|
||||||
(:show-content shape))
|
(:show-content shape))
|
||||||
|
|
||||||
(or (not (cfh/group-shape? shape))
|
(or (not (cfh/group-shape? shape))
|
||||||
(not (:masked-group shape)))))
|
(not (:masked-group shape)))))
|
||||||
(:id 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
|
children-bounds
|
||||||
(cond->> (grc/join-rects bounds)
|
(cond->> (grc/join-rects bounds)
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
[{:keys [shape]}]
|
[{:keys [shape]}]
|
||||||
[:*
|
[:*
|
||||||
(when ^boolean (dbg/enabled? :bounding-boxes)
|
(when ^boolean (dbg/enabled? :bounding-boxes)
|
||||||
[:& debug-bounding-boxes])
|
[:& debug-bounding-boxes {:shape shape}])
|
||||||
|
|
||||||
(when (and ^boolean (cfh/text-shape? shape)
|
(when (and ^boolean (cfh/text-shape? shape)
|
||||||
^boolean (dbg/enabled? :text-outline)
|
^boolean (dbg/enabled? :text-outline)
|
||||||
|
|
|
@ -44,7 +44,9 @@
|
||||||
childs (mf/deref childs-ref)]
|
childs (mf/deref childs-ref)]
|
||||||
|
|
||||||
[:& shape-container {:shape shape :ref ref :disable-shadows? (cfh/is-direct-child-of-root? shape)}
|
[:& 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
|
(defn check-props
|
||||||
[new-props old-props]
|
[new-props old-props]
|
||||||
|
|
Loading…
Add table
Reference in a new issue