0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

Merge pull request #2028 from penpot/alotor-frames

 Improved nested boards thumbnail handling
This commit is contained in:
Alejandro 2022-06-24 11:49:58 +02:00 committed by GitHub
commit dc7464220d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -69,7 +69,7 @@
wrapper-props
(-> (obj/clone props)
(obj/without ["shape" "children"])
(obj/without ["shape" "children" "disable-shadows?"])
(obj/set! "ref" ref)
(obj/set! "id" (dm/fmt "shape-%" (:id shape)))
(obj/set! "style" styles))

View file

@ -229,10 +229,12 @@
(defn setup-active-frames
[objects hover-ids selected active-frames zoom transform vbox]
(let [frame? #(= :frame (get-in objects [% :type]))
all-frames (mf/use-memo (mf/deps objects) #(cph/get-root-frames-ids objects))
(let [all-frames (mf/use-memo (mf/deps objects) #(cph/get-root-frames-ids objects))
selected-frames (mf/use-memo (mf/deps selected) #(->> all-frames (filter selected)))
xf-selected-frame (comp (remove frame?) (map #(get-in objects [% :frame-id])))
xf-selected-frame (comp (remove cph/root-frame?)
(map #(cph/get-shape-id-root-frame objects %)))
selected-shapes-frames (mf/use-memo (mf/deps selected) #(into #{} xf-selected-frame selected))
active-selection (when (and (not= transform :move) (= (count selected-frames) 1)) (first selected-frames))
@ -255,7 +257,7 @@
;; - If no hovering over any frames we keep the previous active one
;; - Check always that the active frames are inside the vbox
(let [hover-ids? (set @hover-ids)
(let [hover-ids? (set (->> @hover-ids (map #(cph/get-shape-id-root-frame objects %))))
is-active-frame?
(fn [id]