Commit Graph

7 Commits

Author SHA1 Message Date
Zev Benjamin 62f607fd5e Debounce fading on the leading instead of the trailing edge
(imported from commit 11d0e8938c1f29cfea0678330e7af9884844af21)
2013-08-12 18:07:30 -04:00
Steve Howell c4e168254c Fix too-much-fading regression and remove spurious classes.
To get to the bottom of the too-much-fading regression,
it was necessary to clean up the code, which was overly
complicated by multi-purposed functions.

The API for compose_fade now has these functions:

    set_focused_recipient
    start_compose
    clear_compose
    update_message_list
    update_faded_messages

Internally there is now a notion of "normal display",
so e.g. when you want a normal display, we call
_diplay_messages_normally() internally, which removes the
faded/unfaded classes from all messages.

(imported from commit 7eb2b0a163f29d9ebae26661f432fecc7c331e4c)
2013-08-12 11:54:27 -04:00
Steve Howell e720737cb5 Tune fade/unfade bouncing from 150ms to 50ms.
This makes fade/unfade start sooner (good), but it might
re-introduce some typing sluggishness (bad).

(imported from commit 4e3112ed1ac931f2931182f91b60567ef2d72695)
2013-08-11 18:18:01 -04:00
Steve Howell 6591c79184 Un-debounce fade/unfade when starting a compose.
When starting a compose, call compose_fade.set_faded_messages,
which will immediately do fade/unfade logic, whereas before
the code path went thru debouncing logic.

(imported from commit 7d0b30435be32a7132dbf05bf064b03b925a2d42)
2013-08-11 18:08:36 -04:00
Steve Howell 6cc5c43e59 Move code into compose_fade.set_focused_recipient().
Move code from compose.update_fade() into
compose_fade.set_focused_recipient(), which makes it
so that we only have to send the msg_type.

(imported from commit c17665d9f34f525bdedcd36d39d3a112fa36a914)
2013-08-11 17:54:50 -04:00
Steve Howell 8190cdc9fb Avoid redundant O(N) work in unfade_messages()..
The code in unfade_messages() is O(N) over the number of
messages, but a simple flag allows us to track the fact that
all messages are unfaded, so we can short circuit the O(N)
logic in many cases.

A typical scenario now would be that you start typing a
stream while the topic is still empty.  Modulo debouncing,
every keystroke now leads to a call to unfade_messages(),
but this change only does real work the first time.

(imported from commit da07cf408bbdbf5b381ff3ec33a5e05e34eef5b5)
2013-08-11 17:05:13 -04:00
Steve Howell 37f8cc9294 Extracted code into compose_fade.js.
The compose_fade has three public exports:

    set_focused_recipient
    unfade_messages
    update_faded_messages

All code was pulled directly from compose.js, except for the
one-line setter of set_focused_recipient.  The focused_recipients
variable that used to be in compose.js was moved to compose_fade.js,
hence the need for the setter.

(imported from commit 462ca5d0d0bd58612d0197f3734a8c78de8c6d30)
2013-08-11 17:05:13 -04:00