Commit Graph

14 Commits

Author SHA1 Message Date
Kevin Mehall e6b2acefe2 Move message_is_visible to viewport.js
(imported from commit 9f05f8f2f00badb67325994825a904bde6958d73)
2013-07-03 17:10:15 -04:00
Zev Benjamin 418c8c2deb viewport.js: Use its own proxy functions internally instead of directly calling $(window) methods
(imported from commit 89e90d30ee41b63f1f8ca7e3d0d92b682a97583d)
2013-06-19 16:35:35 -04:00
Zev Benjamin 338a0fb4ce Reduce code duplication in viewport.js
This also gets rid of an inconsistency in the use of jwindow vs. $(window).

(imported from commit a42e47ef0dd9eaf9aaa4d4e2eedb466d77ec3385)
2013-06-19 16:35:35 -04:00
Steve Howell 224fcebfc9 Extract viewport.is_below_visible_bottom().
This encapsulates logic about things covering the viewport
inside of viewport.js.

(imported from commit 429e979fb0ab288d94064b75280a8b053f9a2aa4)
2013-06-07 12:03:07 -04:00
Steve Howell 1cd113db10 Move message_viewport_info() from ui.js to viewport.js
The message_viewport_info() function encapsulates our logic
around the compose box and other elements blocking the viewport,
so viewport.js seems like a more logical home for it.  It also
makes ui.js, one of our largest modules, a little bit smaller.

(imported from commit 7838668b28175e161b87a6d7a8124b73012f0ff3)
2013-06-06 11:59:45 -04:00
Steve Howell 042cd8f222 Handle large/gigantic messages when recentering.
(imported from commit d57e702f504a9a3e6b7049a19217671902df4ab7)
2013-06-05 13:50:01 -04:00
Steve Howell 40ce4e0acc Streamline recentering code.
When you make a call to set_message_position(), you already
know that the pointer is gonna be onscreen, so set the flag
to suppress scroll pointer updates.  This should be faster and
also avoid future confusing bugs where recenter_view() and
keep_pointer_in_view() run for the same event.

(Both callers to recenter_view pass in the selected message,
and then the calls to set_message_position() set the scrollTop
so that the selected message shows onscreen.)

(imported from commit f1a6f189b7899b280a6316ea7eb03f015d3d4ae3)
2013-06-03 10:41:04 -04:00
Steve Howell e558b5bf23 Fix whitespace in code.
(imported from commit 4bb750f886ccffc22d54140c10d39f0f91725156)
2013-05-31 14:19:47 -04:00
Steve Howell 66b93d5cfd Fix barnowl style scrolling w/r/t fixed elements.
This change fixes the barnowl scrolling so that the ratios of
1/5, 1/2, and 2/3 are all relative to the visible viewport.

The core part of the fix is that we need to call
ui.message_viewport_info() to get the correct offsets for
the top/height of the actually visible viewport  Because
this function is fairly expensive, I didn't want the
helper functions needlessly re-calling it.  I could
have passed the helper functions the structure, but at
that point it was simpler to inline their functionality.

(imported from commit fb10d99313d568e85acfa70703c4651466acbc21)
2013-05-31 12:51:50 -04:00
Steve Howell b34fc4d78f Fix intermittent bug w/page downs at bottom of feed.
There was an off-by-one error in how we determine when
the message list was scrolled all the way to the bottom,
and this undermined our handlers for page down and scrolling
to get the pointer all the way to the bottom.

(imported from commit f80d11582b40726246e69c817a502b311081c730)
2013-05-29 18:42:38 -04:00
Steve Howell b3cb196452 Stabilize pointer after reply-to clicks..
The reply-to autoscroll was using a flag that was redundant
to suppress_scroll_pointer_update and then updating it prematurely,
which caused the pointer to move when you clicked on a message to
reply to it.  Now the pointer goes to the message you replied to.

(imported from commit e2f49fd6bd0da9a3f4b58c0eb08192ef0ee9abf0)
2013-05-29 10:11:39 -04:00
Steve Howell 975b984aee Slow down pointer adjustments at the bottom of the messages.
The main point of this fix is to move some more scroll-related code
into viewport.js, but it also fixes a bug where the size of #main_div
was not accurately representing the full height of the message list.
Making the calculation more accurate narrows the window where we
do pointer adjustements on mousewheel moves.

(imported from commit 5d821f459284c4dbd5ff8056001e54caf4355f1d)
2013-05-28 17:23:22 -04:00
Steve Howell 9cedca4dc5 Don't stop the autoscrolls for reply-to. Refactored.
The functional change here is that our code to stop
autoscrolling on certain events, particularly mousemove,
now only runs during system initiated autoscroll events.
If the user had been replying to a message, then the feature
to stop autoscroll was too aggressive.

This patch also starts to put more scrolling-related code
into viewport.js, which will hopefully prevent some code
duplication and give us a single place to control things like
stopping animated scrolls.

(imported from commit e7d5946b0ac7fcfda2eff1d0e2b58a78b44ecc1a)
2013-05-28 10:25:06 -04:00
Zev Benjamin 1b5fb31b2c Make viewport a module that caches height and width values
The .height() and .width() functions are actually pretty expensive for
the number of times we call them.  The viewport height and width
don't change often, though, so we can just cache them and recalculate
them on window resize.

(imported from commit 129fb8c058144125e2974f6b7967cd9f1a5c9ead)
2013-05-09 10:35:47 -04:00