🐛 Fix nil error on panning (#11856)

This commit is contained in:
Eva Marco 2026-09-23 15:06:16 +02:00 committed by GitHub
parent e46a4d8dc9
commit 065f4eb401
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,7 +51,7 @@
vbox-x (:x vbox) vbox-x (:x vbox)
vbox-y (:y vbox) vbox-y (:y vbox)
base-objects-rect (mf/with-memo [objects] shapes-rect (mf/with-memo [objects]
(-> objects (-> objects
(cfh/get-immediate-children) (cfh/get-immediate-children)
(gsh/shapes->rect))) (gsh/shapes->rect)))
@ -65,6 +65,11 @@
vbox-height (- (:height vbox) (* inv-zoom scroll-height)) vbox-height (- (:height vbox) (* inv-zoom scroll-height))
vbox-width (- (:width vbox) (* inv-zoom scroll-width)) 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 space hidden because of the scroll
top-offset (-> (- vbox-y (:y base-objects-rect)) top-offset (-> (- vbox-y (:y base-objects-rect))
(max 0) (max 0)