@@ -154,7 +154,9 @@ lddatetimepicker.prototype = Object.create(Object.prototype) <<< do
154154
155155 while n and n .getAttribute
156156 s = getComputedStyle(n )
157- if n .nodeName == \BODY or <[overflow overflow -y overflow -x ]>.filter(-> s [it ] != \visible ).length =>
157+ if n .nodeName == \BODY =>
158+ if !nscroll => nscroll = document .scrollingElement
159+ if <[overflow overflow -y overflow -x ]>.filter(-> s [it ] != \visible ).length =>
158160 if !nscroll => nscroll = n
159161 # TODO (should we consider opacity, transform and filter? )
160162 if n .nodeName == \BODY or s .position != \static =>
@@ -167,16 +169,15 @@ lddatetimepicker.prototype = Object.create(Object.prototype) <<< do
167169 n = n .parentNode
168170 stackb = nstack .getBoundingClientRect!
169171 scrollb = nscroll .getBoundingClientRect!
170- scroll = if count - scroll => {left : nscroll .scrollLeft, top : nscroll .scrollTop} else { left : 0 , top : 0 }
171- if hb .y + hb .height + cb .height > scrollb .y + scrollb .height =>
172- y = hb .y - stackb .y - cb .height + scroll .top - 2
172+ scroll = {left : nscroll .scrollLeft, top : nscroll .scrollTop}
173+ if hb .y + hb .height + cb .height > scrollb .y + scrollb .height + scroll .top =>
174+ y = hb .y - stackb .y - cb .height + ( if count - scroll => scroll .top else 0 ) - 2
173175 else
174- y = hb .y - stackb .y + hb .height + scroll .top + 2
175- if hb .x + cb .width > scrollb .x + scrollb .width =>
176- x = hb .x - stackb .x + hb .width - cb .width + scroll .left
176+ y = hb .y - stackb .y + hb .height + ( if count - scroll => scroll .top else 0 ) + 2
177+ if hb .x + cb .width > scrollb .x + scrollb .width + scroll .left =>
178+ x = hb .x - stackb .x + hb .width - cb .width + ( if count - scroll => scroll .left else 0 )
177179 else
178- x = hb .x - stackb .x + scroll .left
179-
180+ x = hb .x - stackb .x + (if count -scroll => scroll .left else 0 )
180181 c .style.transform = "translate(#{x}px, #{y}px)"
181182 c .style <<< top : 0 , left : 0
182183
0 commit comments