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)
|
- 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)
|
- 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)
|
- 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
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
|
|
@ -79,11 +79,13 @@
|
||||||
:else zero)))
|
:else zero)))
|
||||||
|
|
||||||
(defn get-snap-points [page-id frame-id remove-snap? zoom point coord]
|
(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
|
(->> (uw/ask! {:cmd :snaps/range-query
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
:frame-id frame-id
|
:frame-id frame-id
|
||||||
:axis coord
|
:axis coord
|
||||||
|
:bounds vbox
|
||||||
:ranges [[(- value (/ 0.5 zoom)) (+ value (/ 0.5 zoom))]]})
|
:ranges [[(- value (/ 0.5 zoom)) (+ value (/ 0.5 zoom))]]})
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map (remove-from-snap-points remove-snap?)))))
|
(rx/map (remove-from-snap-points remove-snap?)))))
|
||||||
|
@ -94,11 +96,13 @@
|
||||||
ranges (->> points
|
ranges (->> points
|
||||||
(map coord)
|
(map coord)
|
||||||
(mapv #(vector (- % snap-accuracy)
|
(mapv #(vector (- % snap-accuracy)
|
||||||
(+ % snap-accuracy))))]
|
(+ % snap-accuracy))))
|
||||||
|
vbox @refs/vbox]
|
||||||
(->> (uw/ask! {:cmd :snaps/range-query
|
(->> (uw/ask! {:cmd :snaps/range-query
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
:frame-id frame-id
|
:frame-id frame-id
|
||||||
:axis coord
|
:axis coord
|
||||||
|
:bounds vbox
|
||||||
:ranges ranges})
|
:ranges ranges})
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map (remove-from-snap-points remove-snap?))
|
(rx/map (remove-from-snap-points remove-snap?))
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
(ns app.worker.snaps
|
(ns app.worker.snaps
|
||||||
(:require
|
(:require
|
||||||
|
[app.common.geom.shapes.rect :as gpr]
|
||||||
[app.util.snap-data :as sd]
|
[app.util.snap-data :as sd]
|
||||||
[app.worker.impl :as impl]
|
[app.worker.impl :as impl]
|
||||||
[okulary.core :as l]))
|
[okulary.core :as l]))
|
||||||
|
@ -24,11 +25,14 @@
|
||||||
nil)
|
nil)
|
||||||
|
|
||||||
(defmethod impl/handler :snaps/range-query
|
(defmethod impl/handler :snaps/range-query
|
||||||
[{:keys [page-id frame-id axis ranges] :as message}]
|
[{:keys [page-id frame-id axis ranges bounds] :as message}]
|
||||||
|
(let [match-bounds?
|
||||||
(into []
|
(fn [[_ data]]
|
||||||
(comp (mapcat #(sd/query @state page-id frame-id axis %))
|
(some #(gpr/contains-point? bounds %) (map :pt data)))]
|
||||||
(distinct))
|
(->> (into []
|
||||||
ranges))
|
(comp (mapcat #(sd/query @state page-id frame-id axis %))
|
||||||
|
(distinct))
|
||||||
|
ranges)
|
||||||
|
(filter match-bounds?))))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue