mirror of
https://github.com/penpot/penpot.git
synced 2025-07-24 05:47:19 +02:00
🐛 Fix cursor overlap query (#6530)
* 🐛 Fix cursor overlap query. Closes #4472 * 📎 Update CHANGES.md --------- Signed-off-by: Miguel de Benito Delgado <m.debenito.d@gmail.com>
This commit is contained in:
parent
413fc6de16
commit
7fc0d15418
2 changed files with 11 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
(ns app.worker.selection
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.files.helpers :as cfh]
|
||||
[app.common.files.indices :as cfi]
|
||||
[app.common.geom.point :as gpt]
|
||||
|
@ -189,8 +190,16 @@
|
|||
(let [padding (->> (:strokes shape)
|
||||
(map :stroke-width)
|
||||
(reduce d/max 5))
|
||||
;; For paths that fit within a 5x5 box, there won't be any intersection
|
||||
;; when the cursor is around the center. We need to adjust the padding
|
||||
;; to make a narrower box in that case.
|
||||
;; FIXME: this should be a function of the zoom level as well, or use
|
||||
;; pixel distances
|
||||
width (dm/get-in shape [:selrect :width] 1)
|
||||
height (dm/get-in shape [:selrect :height] 1)
|
||||
padding (min padding (/ (max width height) 2))
|
||||
center (grc/rect->center rect)
|
||||
rect (grc/center->rect center padding)]
|
||||
rect (grc/center->rect center padding)]
|
||||
(gsh/overlaps-path? shape rect false)))
|
||||
|
||||
overlaps?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue