mirror of
https://github.com/penpot/penpot.git
synced 2025-03-28 15:41:25 -05:00
🐛 Fix drag guides to delete target area
This commit is contained in:
parent
af22fee0c1
commit
6780d17d2e
2 changed files with 11 additions and 9 deletions
|
@ -66,6 +66,7 @@
|
|||
- Improved command support for MacOS [Taiga #2789](https://tree.taiga.io/project/penpot/issue/2789)
|
||||
- Fix shift+2 shortcut in MacOS with non-english keyboards [Taiga #3038](https://tree.taiga.io/project/penpot/issue/3038)
|
||||
- Some fixes to SVG imports [Taiga #3122](https://tree.taiga.io/project/penpot/issue/3122) [#1720](https://github.com/penpot/penpot/issues/1720) [Taiga #2884](https://tree.taiga.io/project/penpot/issue/2884)
|
||||
- Fix drag guides to delete target area [#1679](https://github.com/penpot/penpot/issues/1679)
|
||||
|
||||
### :arrow_up: Deps updates
|
||||
### :heart: Community contributions by (Thank you!)
|
||||
|
|
|
@ -215,18 +215,19 @@
|
|||
:text-y pos})))
|
||||
|
||||
(defn guide-inside-vbox?
|
||||
([vbox]
|
||||
(partial guide-inside-vbox? vbox))
|
||||
([zoom vbox]
|
||||
(partial guide-inside-vbox? zoom vbox))
|
||||
|
||||
([{:keys [x y width height]} {:keys [axis position]}]
|
||||
(let [x1 x
|
||||
([zoom {:keys [x y width height]} {:keys [axis position]}]
|
||||
(let [rule-area-size (/ rules/rule-area-size zoom)
|
||||
x1 x
|
||||
x2 (+ x width)
|
||||
y1 y
|
||||
y2 (+ y height)]
|
||||
(if (= axis :x)
|
||||
(and (>= position x1)
|
||||
(and (>= position (+ x1 rule-area-size))
|
||||
(<= position x2))
|
||||
(and (>= position y1)
|
||||
(and (>= position (+ y1 rule-area-size))
|
||||
(<= position y2))))))
|
||||
|
||||
(defn guide-creation-area
|
||||
|
@ -383,7 +384,7 @@
|
|||
(let [guide (-> guide
|
||||
(assoc :id (uuid/next)
|
||||
:axis axis))]
|
||||
(when (guide-inside-vbox? vbox guide)
|
||||
(when (guide-inside-vbox? zoom vbox guide)
|
||||
(st/emit! (dw/update-guides guide))))))
|
||||
|
||||
{:keys [on-pointer-enter
|
||||
|
@ -431,7 +432,7 @@
|
|||
(mf/deps page vbox)
|
||||
#(->> (get-in page [:options :guides] {})
|
||||
(vals)
|
||||
(filter (guide-inside-vbox? vbox))))
|
||||
(filter (guide-inside-vbox? zoom vbox))))
|
||||
|
||||
focus (mf/deref refs/workspace-focus-selected)
|
||||
|
||||
|
@ -448,7 +449,7 @@
|
|||
(mf/use-callback
|
||||
(mf/deps vbox)
|
||||
(fn [guide]
|
||||
(if (guide-inside-vbox? vbox guide)
|
||||
(if (guide-inside-vbox? zoom vbox guide)
|
||||
(st/emit! (dw/update-guides guide))
|
||||
(st/emit! (dw/remove-guide guide)))))]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue