ui.gadgets.incremental: trivial scrolling, maybe solves ?

db4
Björn Lindqvist 2015-10-16 10:55:48 +02:00
parent 4812cec634
commit d2181a9e71
1 changed files with 10 additions and 2 deletions
basis/ui/gadgets/incremental

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors combinators kernel math.vectors namespaces
ui.gadgets ui.gadgets.packs ui.gadgets.private ;
USING: accessors combinators kernel math math.vectors namespaces
sequences ui.gadgets ui.gadgets.packs ui.gadgets.private ;
IN: ui.gadgets.incremental
TUPLE: incremental < pack cursor ;
@ -34,8 +34,16 @@ M: incremental pref-dim*
M: incremental dim-changed drop ;
: scroll-children ( incremental -- )
dup children>> length 200,000 > [
! We let the length oscillate between 100k-200k, so we don't
! have to tail* the sequence on every gadget add.
[ 100,000 short tail* ] change-children drop
] [ drop ] if ;
: add-incremental ( gadget incremental -- )
not-in-layout
dup scroll-children
2dup (add-gadget)
t in-layout? [
{