FIX: More incorrect scrollbar positions on the timeline
This commit is contained in:
parent
dd036b73bf
commit
1ed2723986
|
@ -8,6 +8,7 @@ export default MountWidget.extend(Docking, {
|
||||||
buildArgs() {
|
buildArgs() {
|
||||||
return { topic: this.get('topic'),
|
return { topic: this.get('topic'),
|
||||||
topicTrackingState: this.topicTrackingState,
|
topicTrackingState: this.topicTrackingState,
|
||||||
|
enteredIndex: this.get('enteredIndex'),
|
||||||
dockAt: this.dockAt };
|
dockAt: this.dockAt };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||||
queryParams: ['filter', 'username_filters', 'show_deleted'],
|
queryParams: ['filter', 'username_filters', 'show_deleted'],
|
||||||
loadedAllPosts: Ember.computed.or('model.postStream.loadedAllPosts', 'model.postStream.loadingLastPost'),
|
loadedAllPosts: Ember.computed.or('model.postStream.loadedAllPosts', 'model.postStream.loadingLastPost'),
|
||||||
enteredAt: null,
|
enteredAt: null,
|
||||||
|
enteredIndex: null,
|
||||||
retrying: false,
|
retrying: false,
|
||||||
|
|
||||||
topicDelegated: [
|
topicDelegated: [
|
||||||
|
|
|
@ -32,6 +32,7 @@ export default Discourse.Route.extend({
|
||||||
|
|
||||||
topicController.setProperties({
|
topicController.setProperties({
|
||||||
'model.currentPost': closest,
|
'model.currentPost': closest,
|
||||||
|
enteredIndex: postStream.get('stream').indexOf(closestPost.get('id')),
|
||||||
enteredAt: new Date().getTime().toString(),
|
enteredAt: new Date().getTime().toString(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,10 @@
|
||||||
<div class="posts-wrapper">
|
<div class="posts-wrapper">
|
||||||
|
|
||||||
{{#if showTimeline}}
|
{{#if showTimeline}}
|
||||||
{{topic-timeline topic=model loading=model.postStream.loading delegated=topicDelegated}}
|
{{topic-timeline topic=model
|
||||||
|
enteredIndex=enteredIndex
|
||||||
|
loading=model.postStream.loading
|
||||||
|
delegated=topicDelegated}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{topic-progress topic=model delegated=topicDelegated}}
|
{{topic-progress topic=model delegated=topicDelegated}}
|
||||||
{{topic-admin-menu-button topic=model fixed="true" delegated=topicDelegated}}
|
{{topic-admin-menu-button topic=model fixed="true" delegated=topicDelegated}}
|
||||||
|
|
|
@ -87,7 +87,7 @@ createWidget('timeline-scrollarea', {
|
||||||
},
|
},
|
||||||
|
|
||||||
defaultState(attrs) {
|
defaultState(attrs) {
|
||||||
return { percentage: this._percentFor(attrs.topic, attrs.topic.currentPost), scrolledPost: 1 };
|
return { percentage: this._percentFor(attrs.topic, attrs.enteredIndex + 1), scrolledPost: 1 };
|
||||||
},
|
},
|
||||||
|
|
||||||
position() {
|
position() {
|
||||||
|
@ -174,7 +174,12 @@ createWidget('timeline-scrollarea', {
|
||||||
|
|
||||||
_percentFor(topic, postNumber) {
|
_percentFor(topic, postNumber) {
|
||||||
const total = topic.get('postStream.filteredPostsCount');
|
const total = topic.get('postStream.filteredPostsCount');
|
||||||
return postNumber === 1 ? 0.0 : parseFloat(postNumber) / total;
|
console.log(postNumber, total);
|
||||||
|
let result = (postNumber === 1) ? 0.0 : parseFloat(postNumber) / total;
|
||||||
|
|
||||||
|
if (result < 0) { return 0.0; }
|
||||||
|
if (result > 1.0) { return 1.0; }
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue