WIP: simplify $anchorScroll offset feature #1
+34
−59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @gkalpak
I had a chat with Igor last night about this. He agreed that we should go ahead and implement your solution.
I did a bit of simplification of the feature in this PR. Obviously it is not complete with tests and docs but I think that it is easier to maintain and use in this form. Apart from anything it makes writing the directive to make use of it trivial!
I don't think we need to expose a new constant, since we can just hang the offset as a property off the
$anchorScroll
service.We need to be aware that in the future we may need to support horizontal scrolling too so I changed the name to
scroll.yOffset
so that we could add inxOffset
if required in the future without a breaking change.I see what you mean about multiple scrolling containers. A comprehensive solution would handle this by additional properties and directives to define the scroll container for any anchor but I believe that for this release we should not try to support this but instead just document that we only scroll the main window.
I didn't quite see what your extra fix to do with items towards the bottom of the page did. It might have been a result of your specific implementation of the offset scrolling. In this modified version items towards the bottom of the page seem to be scrolled to OK. For instance try http://localhost:8000/build/docs/api/ng/service/$animate#setClass
I just noticed that my version breaks on travis - scrollBy doesn't exist on FF and IE... I will take a look now.
Do you want to review these changes, then if you are happy, knock up some tests and docs for this new feature? The aim is to get it into the next RC release, due on 6th October. If you haven't the time then I am happy to move it forward.