This commit is contained in:
@@ -186,10 +186,9 @@ export default {
|
||||
onMediaChange: async (oMedia) => {
|
||||
this.hash.items = [this.project.codename, 'media', oMedia.id];
|
||||
if(oMedia.set == 'post-medias') {
|
||||
(await this.feed.goToPost('media', oMedia.id))?.panMapToMarker();
|
||||
(await this.feed.findPost('media', oMedia.id))?.panMapToMarker();
|
||||
if(!this.lightbox.hasMediaAfterCurrent()) {
|
||||
await this.feed.getNextFeed();
|
||||
await this.$nextTick();
|
||||
this.lightbox.refreshAlbum();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export default {
|
||||
|
||||
//Direct link post action
|
||||
await(this.hash.items.length == 3
|
||||
? this.findPost(this.hash.items[1], this.hash.items[2], pMapIsReady)
|
||||
? this.findLinkedPost(this.hash.items[1], this.hash.items[2], pMapIsReady)
|
||||
: this.getNextFeed()
|
||||
);
|
||||
|
||||
@@ -91,42 +91,46 @@ export default {
|
||||
getScrollElement() {
|
||||
return this.$refs.feedSimpleBar?.scrollElement;
|
||||
},
|
||||
async findPost(sPostType, iPostId, pMapIsReady = Promise.resolve()) {
|
||||
this.loadingPost = true;
|
||||
let vPost = await this.goToPost(sPostType, iPostId);
|
||||
async findLinkedPost(sPostType, iPostId, pMapIsReady) {
|
||||
let vPost = await this.findPost(sPostType, iPostId, true);
|
||||
if(vPost) {
|
||||
await pMapIsReady;
|
||||
await vPost.executeMainAction(0);
|
||||
return vPost;
|
||||
}
|
||||
else return null;
|
||||
},
|
||||
async findPost(sPostType, iPostId, bHidePosts=false) {
|
||||
if(bHidePosts) this.loadingPost = true;
|
||||
|
||||
let avPosts = this.$refs?.posts?.filter((post) => {return post.postId == sPostType+'-'+iPostId;});
|
||||
if(avPosts && avPosts.length > 0) {
|
||||
let vPost = avPosts[0];
|
||||
this.loadingPost = false;
|
||||
|
||||
//Force next update to have enough subsequent elements to position the post on top of the page
|
||||
await this.getNextFeed();
|
||||
|
||||
//Position the post on top of the page
|
||||
const $ScrollElement = this.getScrollElement();
|
||||
$ScrollElement.scrollTop += Math.round(
|
||||
vPost.$el.getBoundingClientRect().top
|
||||
- $ScrollElement.getBoundingClientRect().top
|
||||
- parseFloat(getComputedStyle(this.$refs.feedSimpleBar.$el).paddingTop)
|
||||
);
|
||||
|
||||
return vPost;
|
||||
}
|
||||
else if(!this.outOfData) {
|
||||
await this.getNextFeed();
|
||||
await this.$nextTick();
|
||||
return this.findPost(sPostType, iPostId, pMapIsReady);
|
||||
return this.findPost(sPostType, iPostId);
|
||||
}
|
||||
else {
|
||||
console.log('Missing element ID "'+iPostId+'" of type "'+sPostType+'"');
|
||||
this.loadingPost = false;
|
||||
console.log('Missing element ID "'+iPostId+'" of type "'+sPostType+'"');
|
||||
return null;
|
||||
}
|
||||
},
|
||||
async goToPost(sPostType, iPostId) {
|
||||
let avPosts = this.$refs?.posts?.filter((post) => {return post.postId == sPostType+'-'+iPostId;});
|
||||
if(!avPosts || avPosts.length == 0) return null;
|
||||
|
||||
//Force next update to have enough subsequent elements to position the post on top of the page
|
||||
await this.getNextFeed();
|
||||
|
||||
let vPost = avPosts[0];
|
||||
this.getScrollElement().scrollTop += Math.round(
|
||||
vPost.$el.getBoundingClientRect().top
|
||||
+ window.pageYOffset
|
||||
- parseFloat(getComputedStyle(this.$refs.feedSimpleBar.$el).paddingTop)
|
||||
);
|
||||
|
||||
return vPost;
|
||||
},
|
||||
async getNextFeed() {
|
||||
if(!this.project || this.outOfData || this.loadingFeed) return true;
|
||||
|
||||
@@ -148,6 +152,7 @@ export default {
|
||||
this.loadingFeed = false;
|
||||
this.firstChunk = false;
|
||||
|
||||
await this.$nextTick();
|
||||
return true;
|
||||
},
|
||||
onFeedScroll(oEvent) {
|
||||
|
||||
Reference in New Issue
Block a user