UX: Don't animate timeline when first entering a topic
This commit is contained in:
parent
c046b003db
commit
4963d4d624
|
@ -1,4 +1,5 @@
|
||||||
import loadScript from 'discourse/lib/load-script';
|
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.
|
// Use the message bus for live reloading of components for faster development.
|
||||||
export default {
|
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
|
// Observe file changes
|
||||||
messageBus.subscribe("/file-change", function(data) {
|
messageBus.subscribe("/file-change", function(data) {
|
||||||
if (Handlebars.compile && !Ember.TEMPLATES.empty) {
|
if (Handlebars.compile && !Ember.TEMPLATES.empty) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ createWidget('timeline-scrollarea', {
|
||||||
},
|
},
|
||||||
|
|
||||||
defaultState() {
|
defaultState() {
|
||||||
return { percentage: 0, scrolledPost: 1 };
|
return { percentage: null, scrolledPost: 1 };
|
||||||
},
|
},
|
||||||
|
|
||||||
position() {
|
position() {
|
||||||
|
@ -124,6 +124,8 @@ createWidget('timeline-scrollarea', {
|
||||||
|
|
||||||
state.scrolledPost = position.current;
|
state.scrolledPost = position.current;
|
||||||
const percentage = state.percentage;
|
const percentage = state.percentage;
|
||||||
|
if (percentage === null) { return; }
|
||||||
|
|
||||||
const before = SCROLLAREA_REMAINING * percentage;
|
const before = SCROLLAREA_REMAINING * percentage;
|
||||||
const after = (SCROLLAREA_HEIGHT - before) - SCROLLER_HEIGHT;
|
const after = (SCROLLAREA_HEIGHT - before) - SCROLLER_HEIGHT;
|
||||||
|
|
||||||
|
@ -133,7 +135,6 @@ createWidget('timeline-scrollarea', {
|
||||||
this.attach('timeline-padding', { height: after })
|
this.attach('timeline-padding', { height: after })
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
if (position.lastRead && position.lastRead < attrs.topic.posts_count) {
|
if (position.lastRead && position.lastRead < attrs.topic.posts_count) {
|
||||||
const lastReadTop = Math.round(position.lastReadPercentage * SCROLLAREA_HEIGHT);
|
const lastReadTop = Math.round(position.lastReadPercentage * SCROLLAREA_HEIGHT);
|
||||||
if (lastReadTop > (before + SCROLLER_HEIGHT)) {
|
if (lastReadTop > (before + SCROLLER_HEIGHT)) {
|
||||||
|
|
Loading…
Reference in New Issue