mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
UX: Don't animate timeline when first entering a topic
This commit is contained in:
parent
c046b003db
commit
4963d4d624
2 changed files with 9 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import loadScript from 'discourse/lib/load-script';
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
|
||||
// Use the message bus for live reloading of components for faster development.
|
||||
export default {
|
||||
|
@ -30,6 +31,11 @@ export default {
|
|||
});
|
||||
});
|
||||
|
||||
// Useful to export this for debugging purposes
|
||||
if (Discourse.Environment === 'development' && !Ember.testing) {
|
||||
window.DiscourseURL = DiscourseURL;
|
||||
}
|
||||
|
||||
// Observe file changes
|
||||
messageBus.subscribe("/file-change", function(data) {
|
||||
if (Handlebars.compile && !Ember.TEMPLATES.empty) {
|
||||
|
|
|
@ -83,7 +83,7 @@ createWidget('timeline-scrollarea', {
|
|||
},
|
||||
|
||||
defaultState() {
|
||||
return { percentage: 0, scrolledPost: 1 };
|
||||
return { percentage: null, scrolledPost: 1 };
|
||||
},
|
||||
|
||||
position() {
|
||||
|
@ -124,6 +124,8 @@ createWidget('timeline-scrollarea', {
|
|||
|
||||
state.scrolledPost = position.current;
|
||||
const percentage = state.percentage;
|
||||
if (percentage === null) { return; }
|
||||
|
||||
const before = SCROLLAREA_REMAINING * percentage;
|
||||
const after = (SCROLLAREA_HEIGHT - before) - SCROLLER_HEIGHT;
|
||||
|
||||
|
@ -133,7 +135,6 @@ createWidget('timeline-scrollarea', {
|
|||
this.attach('timeline-padding', { height: after })
|
||||
];
|
||||
|
||||
|
||||
if (position.lastRead && position.lastRead < attrs.topic.posts_count) {
|
||||
const lastReadTop = Math.round(position.lastReadPercentage * SCROLLAREA_HEIGHT);
|
||||
if (lastReadTop > (before + SCROLLER_HEIGHT)) {
|
||||
|
|
Loading…
Reference in a new issue