mirror of
https://github.com/penpot/penpot.git
synced 2025-05-20 19:26:11 +02:00
🐛 Improve deeps selection of nested arboards
This commit is contained in:
parent
c3ce0eb794
commit
f3f611848c
4 changed files with 28 additions and 12 deletions
|
@ -22,6 +22,7 @@
|
||||||
- Fix problem when undoing multiple selected colors [Taiga #4920](https://tree.taiga.io/project/penpot/issue/4920)
|
- Fix problem when undoing multiple selected colors [Taiga #4920](https://tree.taiga.io/project/penpot/issue/4920)
|
||||||
- Allow selection of empty board by partial rect [Taiga #4806](https://tree.taiga.io/project/penpot/issue/4806)
|
- Allow selection of empty board by partial rect [Taiga #4806](https://tree.taiga.io/project/penpot/issue/4806)
|
||||||
- Improve behavior for undo on text edition [Taiga #4693](https://tree.taiga.io/project/penpot/issue/4693)
|
- Improve behavior for undo on text edition [Taiga #4693](https://tree.taiga.io/project/penpot/issue/4693)
|
||||||
|
- Improve deeps selection of nested arboards [Taiga #4913](https://tree.taiga.io/project/penpot/issue/4913)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,11 @@
|
||||||
(and (= type :frame) (= id uuid/zero)))
|
(and (= type :frame) (= id uuid/zero)))
|
||||||
|
|
||||||
(defn root-frame?
|
(defn root-frame?
|
||||||
[{:keys [frame-id type]}]
|
([objects id]
|
||||||
|
(root-frame? (get objects id)))
|
||||||
|
([{:keys [frame-id type]}]
|
||||||
(and (= type :frame)
|
(and (= type :frame)
|
||||||
(= frame-id uuid/zero)))
|
(= frame-id uuid/zero))))
|
||||||
|
|
||||||
(defn frame-shape?
|
(defn frame-shape?
|
||||||
([objects id]
|
([objects id]
|
||||||
|
|
|
@ -179,18 +179,22 @@
|
||||||
|
|
||||||
([objects ids {:keys [bottom-frames?] :as options}]
|
([objects ids {:keys [bottom-frames?] :as options}]
|
||||||
(letfn [(comp [id-a id-b]
|
(letfn [(comp [id-a id-b]
|
||||||
(let [type-a (dm/get-in objects [id-a :type])
|
(let [frame-a? (= :frame (dm/get-in objects [id-a :type]))
|
||||||
type-b (dm/get-in objects [id-b :type])]
|
frame-b? (= :frame (dm/get-in objects [id-b :type]))]
|
||||||
(cond
|
(cond
|
||||||
(and (not= :frame type-a) (= :frame type-b))
|
|
||||||
(if bottom-frames? -1 1)
|
|
||||||
|
|
||||||
(and (= :frame type-a) (not= :frame type-b))
|
|
||||||
(if bottom-frames? 1 -1)
|
|
||||||
|
|
||||||
(= id-a id-b)
|
(= id-a id-b)
|
||||||
0
|
0
|
||||||
|
|
||||||
|
(and (not frame-a?) frame-b?)
|
||||||
|
(if bottom-frames? -1 1)
|
||||||
|
|
||||||
|
(and frame-a? (not frame-b?))
|
||||||
|
(if bottom-frames? 1 -1)
|
||||||
|
|
||||||
|
;; When comparing frames we invert the order if the flag `bottom-frames?` is on
|
||||||
|
(and frame-a? frame-b? bottom-frames?)
|
||||||
|
(if (is-shape-over-shape? objects id-b id-a) 1 -1)
|
||||||
|
|
||||||
(is-shape-over-shape? objects id-b id-a)
|
(is-shape-over-shape? objects id-b id-a)
|
||||||
-1
|
-1
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
(ns app.main.ui.workspace.viewport.hooks
|
(ns app.main.ui.workspace.viewport.hooks
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
|
[app.common.data.macros :as dm]
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
[app.common.pages :as cp]
|
[app.common.pages :as cp]
|
||||||
[app.common.pages.helpers :as cph]
|
[app.common.pages.helpers :as cph]
|
||||||
|
@ -169,7 +170,8 @@
|
||||||
;; but the mouse has not been moved from its position.
|
;; but the mouse has not been moved from its position.
|
||||||
(->> mod-str
|
(->> mod-str
|
||||||
(rx/observe-on :async)
|
(rx/observe-on :async)
|
||||||
(rx/map #(deref last-point-ref)))
|
(rx/map #(deref last-point-ref))
|
||||||
|
(rx/merge-map query-point))
|
||||||
|
|
||||||
(->> move-stream
|
(->> move-stream
|
||||||
(rx/tap #(reset! last-point-ref %))
|
(rx/tap #(reset! last-point-ref %))
|
||||||
|
@ -241,10 +243,17 @@
|
||||||
remove-id?
|
remove-id?
|
||||||
(into selected-with-parents remove-id-xf ids)
|
(into selected-with-parents remove-id-xf ids)
|
||||||
|
|
||||||
|
no-fill-nested-frames?
|
||||||
|
(fn [id]
|
||||||
|
(and (cph/frame-shape? objects id)
|
||||||
|
(not (cph/root-frame? objects id))
|
||||||
|
(empty? (dm/get-in objects [id :fills]))))
|
||||||
|
|
||||||
hover-shape
|
hover-shape
|
||||||
(->> ids
|
(->> ids
|
||||||
(remove remove-id?)
|
(remove remove-id?)
|
||||||
(remove (partial cph/hidden-parent? objects))
|
(remove (partial cph/hidden-parent? objects))
|
||||||
|
(remove no-fill-nested-frames?)
|
||||||
(filter #(or (empty? focus) (cp/is-in-focus? objects focus %)))
|
(filter #(or (empty? focus) (cp/is-in-focus? objects focus %)))
|
||||||
(first)
|
(first)
|
||||||
(get objects))]
|
(get objects))]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue