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