mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 16:00:19 -05:00
🎉 Dynamic alignment only in sight
This commit is contained in:
parent
e8d561ac7f
commit
b5e53b57d1
3 changed files with 17 additions and 8 deletions
|
@ -10,6 +10,7 @@
|
|||
- Better overlays interactions on boards inside boards [Taiga #4386](https://tree.taiga.io/project/penpot/us/4386)
|
||||
- Show board miniature in manual overlay setting [Taiga #4475](https://tree.taiga.io/project/penpot/issue/4475)
|
||||
- Handoff visual improvements [Taiga #3124](https://tree.taiga.io/project/penpot/us/3124)
|
||||
- Dynamic alignment only in sight [Github 1971](https://github.com/penpot/penpot/issues/1971)
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
|
|
|
@ -79,11 +79,13 @@
|
|||
:else zero)))
|
||||
|
||||
(defn get-snap-points [page-id frame-id remove-snap? zoom point coord]
|
||||
(let [value (get point coord)]
|
||||
(let [value (get point coord)
|
||||
vbox @refs/vbox]
|
||||
(->> (uw/ask! {:cmd :snaps/range-query
|
||||
:page-id page-id
|
||||
:frame-id frame-id
|
||||
:axis coord
|
||||
:bounds vbox
|
||||
:ranges [[(- value (/ 0.5 zoom)) (+ value (/ 0.5 zoom))]]})
|
||||
(rx/take 1)
|
||||
(rx/map (remove-from-snap-points remove-snap?)))))
|
||||
|
@ -94,11 +96,13 @@
|
|||
ranges (->> points
|
||||
(map coord)
|
||||
(mapv #(vector (- % snap-accuracy)
|
||||
(+ % snap-accuracy))))]
|
||||
(+ % snap-accuracy))))
|
||||
vbox @refs/vbox]
|
||||
(->> (uw/ask! {:cmd :snaps/range-query
|
||||
:page-id page-id
|
||||
:frame-id frame-id
|
||||
:axis coord
|
||||
:bounds vbox
|
||||
:ranges ranges})
|
||||
(rx/take 1)
|
||||
(rx/map (remove-from-snap-points remove-snap?))
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
(ns app.worker.snaps
|
||||
(:require
|
||||
[app.common.geom.shapes.rect :as gpr]
|
||||
[app.util.snap-data :as sd]
|
||||
[app.worker.impl :as impl]
|
||||
[okulary.core :as l]))
|
||||
|
@ -24,11 +25,14 @@
|
|||
nil)
|
||||
|
||||
(defmethod impl/handler :snaps/range-query
|
||||
[{:keys [page-id frame-id axis ranges] :as message}]
|
||||
|
||||
(into []
|
||||
(comp (mapcat #(sd/query @state page-id frame-id axis %))
|
||||
(distinct))
|
||||
ranges))
|
||||
[{:keys [page-id frame-id axis ranges bounds] :as message}]
|
||||
(let [match-bounds?
|
||||
(fn [[_ data]]
|
||||
(some #(gpr/contains-point? bounds %) (map :pt data)))]
|
||||
(->> (into []
|
||||
(comp (mapcat #(sd/query @state page-id frame-id axis %))
|
||||
(distinct))
|
||||
ranges)
|
||||
(filter match-bounds?))))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue