mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
sorting photo to creation data and scrolling to image with lightbox close
This commit is contained in:
parent
676f8601ff
commit
c3b5a3139e
@ -1,6 +1,3 @@
|
|||||||
<!--<a md-raised-button class="md-raised " [routerLink]="['Gallery',{directory: getDirectoryPath()}]" aria-label="More">
|
|
||||||
<i md-icon>folder</i> {{directory.name}}
|
|
||||||
</a>-->
|
|
||||||
<a class="button " [routerLink]="['Gallery',{directory: getDirectoryPath()}]" >
|
<a class="button " [routerLink]="['Gallery',{directory: getDirectoryPath()}]" >
|
||||||
{{directory.name}}
|
{{directory.name}}
|
||||||
</a>
|
</a>
|
||||||
|
@ -91,6 +91,17 @@ export class GalleryGridComponent implements OnChanges,AfterViewInit {
|
|||||||
let containerWidth = this.getContainerWidth();
|
let containerWidth = this.getContainerWidth();
|
||||||
this.renderedContainerWidth = containerWidth;
|
this.renderedContainerWidth = containerWidth;
|
||||||
|
|
||||||
|
this.photos.sort((a:Photo, b:Photo) => {
|
||||||
|
if (a.metadata.creationDate > b.metadata.creationDate) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (a.metadata.creationDate < b.metadata.creationDate) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// a must be equal to b
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
this.photosToRender = [];
|
this.photosToRender = [];
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
font-size: x-large;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation-arrow span {
|
.navigation-arrow span {
|
||||||
@ -44,7 +45,6 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
position: fixed;;
|
position: fixed;;
|
||||||
color: white;
|
color: white;
|
||||||
font-size: x-large;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#rightArrow {
|
#rightArrow {
|
||||||
@ -58,11 +58,12 @@
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
font-size: large;
|
||||||
}
|
}
|
||||||
|
|
||||||
#controls span {
|
#controls span {
|
||||||
margin-left: 2px;
|
margin-left: 6px;
|
||||||
margin-right: 2px;
|
margin-right: 6px;
|
||||||
color: white;
|
color: white;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
@ -136,6 +136,10 @@ export class GalleryLightboxComponent {
|
|||||||
public hide() {
|
public hide() {
|
||||||
console.log("hiding");
|
console.log("hiding");
|
||||||
let to = this.activePhoto.getDimension();
|
let to = this.activePhoto.getDimension();
|
||||||
|
//iff target image out of screen -> scroll to there
|
||||||
|
if (this.getBodyScrollTop() > to.top || this.getBodyScrollTop() + this.getScreenHeight() < to.top) {
|
||||||
|
this.setBodyScrollTop(to.top);
|
||||||
|
}
|
||||||
to.top -= this.getBodyScrollTop();
|
to.top -= this.getBodyScrollTop();
|
||||||
|
|
||||||
|
|
||||||
@ -163,6 +167,7 @@ export class GalleryLightboxComponent {
|
|||||||
let fromImage = this.calcLightBoxPhotoDimension(this.activePhoto.gridPhoto.photo).toStyle();
|
let fromImage = this.calcLightBoxPhotoDimension(this.activePhoto.gridPhoto.photo).toStyle();
|
||||||
let toImage = {width: to.width + "px", height: to.height + "px", top: "0px", left: "0px"};
|
let toImage = {width: to.width + "px", height: to.height + "px", top: "0px", left: "0px"};
|
||||||
|
|
||||||
|
|
||||||
this.forceAnimateTo(fromImage,
|
this.forceAnimateTo(fromImage,
|
||||||
toImage,
|
toImage,
|
||||||
this.imgContainer.nativeElement.nativeElement);
|
this.imgContainer.nativeElement.nativeElement);
|
||||||
@ -220,6 +225,10 @@ export class GalleryLightboxComponent {
|
|||||||
return this.dom.getProperty(this.dom.query('body'), 'scrollTop');
|
return this.dom.getProperty(this.dom.query('body'), 'scrollTop');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private setBodyScrollTop(value) {
|
||||||
|
return this.dom.setProperty(this.dom.query('body'), 'scrollTop', value);
|
||||||
|
}
|
||||||
|
|
||||||
private getScreenWidth() {
|
private getScreenWidth() {
|
||||||
return window.innerWidth;
|
return window.innerWidth;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user