WIP Overhaul view and sort behavior

Bring the view and sort controls closer in line with the latest
design decisions.

- Start in Document view and Location sort.
- When in Document view and Location sort, use dynamic bucket.
- When in any sort other than location, disable dynamic bucket.
- When in Location sort, all comments always appear at the bottom.
- Remove the Screen and Comment views.
- Remove the focus annotation state that was triggered by expanding
  a top level annotation; there is only hover emphasis now.
- The `showViewer` call always goes to Selection view.
- Using multi-select (Cmd or Ctrl Click on tabs and highlights) will
  trigger the Selection view, or switch back to the Document view
  if the selection is empty.
- Page search always searches the whole document.
- Leaving the page search switches back to the Document view.

Additionally, many cleanups were made as a result.

- No need to track focused state or comments in the client frames.
- No need to pass the view name in `updateViewer` or `showViewer`.
- No need to pass the focus purpose in `updateViewer`, `showViewer`,
  or `toggleViewerSelection`.
- Drop various helper functions around focus.
- No need to manually unshift or push newly created or streamed
  annotations into the view.
- The viewer template uses threads at the top repeater, like the
  page search template.
- The app controller maintains all the annotations on the root scope,
  the current selection shadowing it on the application scope, and
  a cheap, identity watch that retreives the threads.
- The page search can use a cheap watch on the threads to refresh.
- The reply list of each annotation is no longer set on the annotation
  object.
- The thread directive now watches the thread children and keeps them
  sorted, rather than the annotation directive.
- The recursive `buildReplyList` function is no longer needed.
- Scattered use of the root scope is much reduced.
- Drop requestAnimationFrame polyfill because angular has its own.
- Drop the recursive directive, splitting out thread.html and using
  using ng-include for recursion.
- Use a single render queue for all threads and sequence updates on
  animation frames, resulting in smooth, progressive rendering.
- Combine the viewer and page_search templates.
Good catch.


On Mon, Aug 25, 2014 at 2:01 AM, Aron Carroll <notifications@github.com>
wrote:

> In h/static/scripts/directives.coffee:
>
> >
> >      scope.toggleCollapsed = (event) ->
> >        event.stopPropagation()
> >        return if (ignoreClick event) or Object.keys(childrenEditing).length
> >        scope.collapsed = !scope.collapsed
> > -      # XXX: This not needed to be done when the viewer and search will be unified
> > -      ann = scope.annotation ? scope.thread.message
> > -      if scope.collapsed
> > -        $rootScope.unFocus ann, true
> > -      else
> > -        scope.openDetails ann
> > -        $rootScope.focus ann, true
> > +
> > +    scope.$on 'destroy', ->
> > +      renderQueue = ([s, _] for [s, _] in renderQueue is s isnt scope)
>
> Typo? is -> if?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/hypothesis/h/pull/1436/files#r16647112>.
>