Compare commits

...

1 Commits

Author SHA1 Message Date
Elena Torro
6ede83d6af 🐛 Fix lazy load intersection on dragging at the beginning 2026-02-03 09:23:55 +01:00
3 changed files with 16 additions and 13 deletions

View File

@@ -299,7 +299,7 @@
on-drop
(mf/use-fn
(mf/deps id index objects expanded? selected)
(mf/deps id objects expanded? selected)
(fn [side _data]
(let [single? (= (count selected) 1)
same? (and single? (= (first selected) id))]
@@ -320,14 +320,18 @@
[parent-id _] (ctn/find-valid-parent-and-frame-ids parent-id objects (map #(get objects %) selected) false files)
parent (get objects parent-id)
parent (get objects parent-id)
current-index (d/index-of (:shapes parent) id)
to-index (cond
(= side :center) 0
(and expanded? (= side :bot) (d/not-empty? (:shapes shape))) (count (:shapes parent))
(= side :top) (inc index)
:else index)]
(st/emit! (dw/relocate-selected-shapes parent-id to-index)))))))
;; target not found in parent (while lazy loading)
(neg? current-index) nil
(= side :top) (inc current-index)
:else current-index)]
(when (some? to-index)
(st/emit! (dw/relocate-selected-shapes parent-id to-index))))))))
on-hold
(mf/use-fn
@@ -416,11 +420,7 @@
current @children-count*
new-count (min total (max current chunk-size min-count))]
(reset! children-count* new-count))
(reset! children-count* 0)))
(fn []
(when-let [obs ^js @observer-var]
(.disconnect obs)
(reset! observer-var nil))))
(reset! children-count* 0))))
;; Re-observe sentinel whenever children-count changes (sentinel moves)
;; and (shapes item) to reconnect observer after shape changes
@@ -501,4 +501,4 @@
:component-child? component-tree?}])))
(when (< children-count (count (:shapes item)))
[:div {:ref lazy-ref
:style {:min-height 1}}])])]))
:class (stl/css :lazy-load-sentinel)}])])]))

View File

@@ -298,3 +298,7 @@
.filtered {
min-inline-size: $sz-12;
}
.lazy-load-sentinel {
min-height: 1px;
pointer-events: none;
}

View File

@@ -521,8 +521,7 @@
[:& filters-tree {:objects filtered-objects
:key (dm/str (:id page))
:parent-size size-parent}]
[:div {:ref lazy-load-ref
:style {:min-height 16}}]]
[:div {:ref lazy-load-ref}]]
[:div {:on-scroll on-scroll
:class (stl/css :tool-window-content)
:data-scroll-container true