mirror of
https://github.com/penpot/penpot.git
synced 2026-09-23 20:36:15 +00:00
🐛 Fix nil error on panning (#11856)
This commit is contained in:
parent
e46a4d8dc9
commit
065f4eb401
@ -51,7 +51,7 @@
|
||||
vbox-x (:x vbox)
|
||||
vbox-y (:y vbox)
|
||||
|
||||
base-objects-rect (mf/with-memo [objects]
|
||||
shapes-rect (mf/with-memo [objects]
|
||||
(-> objects
|
||||
(cfh/get-immediate-children)
|
||||
(gsh/shapes->rect)))
|
||||
@ -65,6 +65,11 @@
|
||||
vbox-height (- (:height vbox) (* inv-zoom scroll-height))
|
||||
vbox-width (- (:width vbox) (* inv-zoom scroll-width))
|
||||
|
||||
;; When there are no shapes there is no content to scroll to, so use a
|
||||
;; rect matching the viewport itself, which keeps every offset below at 0
|
||||
base-objects-rect (or shapes-rect
|
||||
(grc/make-rect vbox-x vbox-y vbox-width vbox-height))
|
||||
|
||||
;; top space hidden because of the scroll
|
||||
top-offset (-> (- vbox-y (:y base-objects-rect))
|
||||
(max 0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user