ui.gadgets.incremental: trivial scrolling, maybe solves #1488?
parent
4812cec634
commit
d2181a9e71
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2005, 2009 Slava Pestov.
|
! Copyright (C) 2005, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors combinators kernel math.vectors namespaces
|
USING: accessors combinators kernel math math.vectors namespaces
|
||||||
ui.gadgets ui.gadgets.packs ui.gadgets.private ;
|
sequences ui.gadgets ui.gadgets.packs ui.gadgets.private ;
|
||||||
IN: ui.gadgets.incremental
|
IN: ui.gadgets.incremental
|
||||||
|
|
||||||
TUPLE: incremental < pack cursor ;
|
TUPLE: incremental < pack cursor ;
|
||||||
|
@ -34,8 +34,16 @@ M: incremental pref-dim*
|
||||||
|
|
||||||
M: incremental dim-changed drop ;
|
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 -- )
|
: add-incremental ( gadget incremental -- )
|
||||||
not-in-layout
|
not-in-layout
|
||||||
|
dup scroll-children
|
||||||
2dup (add-gadget)
|
2dup (add-gadget)
|
||||||
t in-layout? [
|
t in-layout? [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue