@@ -366,17 +366,24 @@ real list::scroll_by(real delta)
366366
367367 real scrolled_by = 0 ;
368368
369+ std::cout << " delta = " << delta << std::endl;
370+
369371 if (delta >= 0 ) {
372+ std::cout << " delta >= 0" << std::endl;
373+
370374 // go through visible widgets first
371375 for (auto & c : this ->children ()) {
372376 auto wd = c.get ().rect ().d [long_index] - this ->pos_offset ;
373377 if (wd > delta) {
378+ std::cout << " wd > delta, delta = " << delta << " , wd = " << wd << std::endl;
374379 this ->pos_offset += delta;
375380 delta -= wd;
376381 scrolled_by += delta;
377382 break ;
378383 }
379384
385+ std::cout << " wd <= delta, delta = " << delta << " , wd = " << wd << std::endl;
386+
380387 delta -= wd;
381388 scrolled_by += wd;
382389 this ->pos_offset = 0 ;
@@ -385,6 +392,7 @@ real list::scroll_by(real delta)
385392
386393 // if there is still distance to scroll, then go through the rest of the widgets
387394 if (delta > 0 ) {
395+ std::cout << " delta > 0: delta = " << delta << std::endl;
388396 utki::assert (
389397 this ->pos_index > this ->added_index + this ->children ().size (),
390398 [&](auto & o) {
@@ -411,8 +419,10 @@ real list::scroll_by(real delta)
411419 }
412420 }
413421 } else {
422+ utki::assert (delta < 0 , SL);
414423 delta = -delta;
415424 if (delta <= this ->pos_offset ) {
425+ std::cout << " delta <= this->pos_offset" << std::endl;
416426 this ->pos_offset -= delta;
417427 scrolled_by -= delta;
418428 } else {
@@ -433,10 +443,13 @@ real list::scroll_by(real delta)
433443 );
434444
435445 --this ->added_index ;
436- if (d[long_index] > delta) {
446+ if (delta <= d[long_index]) {
447+ std::cout << " delta <= d[long_index]: delta = " << delta << std::endl;
437448 this ->pos_offset = d[long_index] - delta;
449+ scrolled_by -= delta;
438450 break ;
439451 }
452+ std::cout << " delta > d[long_index]: delta = " << delta << std::endl;
440453 delta -= d[long_index];
441454 scrolled_by -= d[long_index];
442455 }
0 commit comments