Skip to content

Commit 314bbba

Browse files
committed
improving controls, implementing playback
1 parent 07619e2 commit 314bbba

File tree

5 files changed

+148
-39
lines changed

5 files changed

+148
-39
lines changed

backend/model/threading/DiskMangerWorker.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,7 @@ export class DiskMangerWorker {
5252
});
5353

5454
try {
55-
const exif_obj = exif_parser.create(data);
56-
57-
exif_obj.enableTagNames(true);
58-
exif_obj.enableImageSize(true);
59-
exif_obj.enableReturnTags(true);
60-
const exif = exif_obj.parse();
61-
62-
Logger.debug(LOG_TAG, "exif data", exif);
55+
const exif = exif_parser.create(data).parse();
6356
metadata.cameraData = <CameraMetadata> {
6457
ISO: exif.tags.ISO,
6558
model: exif.tags.Model,

frontend/app/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ <h1>Info</h1>
8181
[disableDefaultUI]="true"
8282
[zoomControl]="false"
8383
[streetViewControl]="false"
84-
[zoom]="5"
84+
[zoom]="6"
8585
[latitude]="photo.metadata.positionData.GPSData.latitude"
8686
[longitude]="photo.metadata.positionData.GPSData.longitude">
8787
<agm-marker

frontend/app/gallery/lightbox/lightbox.gallery.component.css

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ gallery-lightbox-photo {
2929

3030
.navigation-arrow {
3131
width: 30%;
32-
height: 100%;
32+
height: calc(100% - 75px);
3333
position: static;
3434
display: inline-block;
3535
padding: 15px;
3636
cursor: pointer;
37-
font-size: x-large;
37+
font-size: xx-large;
3838
}
3939

4040
.navigation-arrow span {
@@ -47,34 +47,53 @@ gallery-lightbox-photo {
4747
height: 100%;
4848
left: 0;
4949
top: 0;
50+
opacity: 1.0;
5051
position: fixed;
5152
color: white;
52-
transition: all 0.3s ease-in-out;
53+
transition: width 0.3s ease-in-out, opacity 1s;
54+
}
55+
56+
#controllers-container.dim-controls {
57+
opacity: 0.1;
5358
}
5459

5560
#rightArrow {
5661
float: right;
5762
text-align: right;
5863
}
5964

60-
#controls {
61-
top: 0;
65+
.controls {
6266
height: initial;
6367
text-align: right;
6468
width: 100%;
6569
padding: 5px;
6670
font-size: large;
6771
}
6872

69-
#controls span {
73+
.controls .control-button {
7074
margin-left: 6px;
7175
margin-right: 6px;
7276
color: white;
7377
cursor: pointer;
7478
}
7579

80+
.controls .button-disabled {
81+
color: #888;
82+
}
83+
84+
.controls-top {
85+
top: 0;
86+
87+
}
88+
89+
.controls-playback {
90+
padding-right: 15px;
91+
bottom: 0;
92+
position: absolute;
93+
}
94+
7695
.highlight {
77-
opacity: 0.4;
96+
opacity: 0.5;
7897
transition: opacity .2s ease-out;
7998
-moz-transition: opacity .2s ease-out;
8099
-webkit-transition: opacity .2s ease-out;
@@ -85,6 +104,25 @@ gallery-lightbox-photo {
85104
opacity: 1.0;
86105
}
87106

107+
@-webkit-keyframes blink {
108+
0% {
109+
opacity: 0.5;
110+
}
111+
25% {
112+
opacity: 1.0;
113+
}
114+
75% {
115+
opacity: 1.0;
116+
}
117+
100% {
118+
opacity: 0.5;
119+
}
120+
}
121+
122+
.button-active {
123+
animation: blink 3s ease-in-out infinite;
124+
}
125+
88126
info-panel {
89127
z-index: 1100; /* Sit on top */
90128
position: fixed;

frontend/app/gallery/lightbox/lightbox.gallery.component.html

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,54 @@
1010
</gallery-lightbox-photo>
1111
</div>
1212

13-
<!--
14-
[@photoState]="{value:visible?'active':'inactive',
15-
params:{
16-
startWidth:startPhotoDimension.width,
17-
startHeight:startPhotoDimension.height,
18-
startTop:startPhotoDimension.top,
19-
startLeft:startPhotoDimension.left,
20-
endWidth:photoDimension.width,
21-
endHeight:photoDimension.height,
22-
endTop:photoDimension.top,
23-
endLeft:photoDimension.left}}"
24-
-->
25-
<div id="controllers-container" #controls
26-
[style.width.px]="getScreenWidth()">
27-
<div id="controls">
13+
<div
14+
*ngIf="controllersVisible"
15+
id="controllers-container" #controls [style.width.px]="getScreenWidth()"
16+
[ngClass]="!controllersDimmed ? 'dim-controls': ''">
17+
<div class="controls controls-top">
2818
<a *ngIf="activePhoto" [href]="activePhoto.gridPhoto.getPhotoPath()"
29-
[download]="activePhoto.gridPhoto.photo.name"><span class="glyphicon glyphicon-download-alt highlight"
30-
title="download"></span></a>
31-
<span class="glyphicon glyphicon-info-sign highlight" (click)="toggleInfoPanel()" title="info"></span>
19+
[download]="activePhoto.gridPhoto.photo.name">
20+
<span class="glyphicon glyphicon-download-alt highlight control-button"
21+
title="download"></span>
22+
</a>
23+
<span class="glyphicon glyphicon-info-sign highlight control-button" (click)="toggleInfoPanel()"
24+
title="info"></span>
3225

33-
<span class=" glyphicon glyphicon-resize-small highlight"
26+
<span class=" glyphicon glyphicon-resize-small highlight control-button"
3427
*ngIf="fullScreenService.isFullScreenEnabled()"
3528
(click)="fullScreenService.exitFullScreen()" title="toggle fullscreen"></span>
3629

37-
<span class="glyphicon glyphicon-fullscreen highlight"
30+
<span class="glyphicon glyphicon-fullscreen highlight control-button"
3831
*ngIf="!fullScreenService.isFullScreenEnabled()"
3932
(click)="fullScreenService.showFullScreen(root)" title="toggle fullscreen"></span>
4033

4134
<span class="glyphicon glyphicon-remove highlight" (click)="hide()" title="close"></span>
4235
</div>
4336

44-
<div class="navigation-arrow highlight" *ngIf="navigation.hasPrev" title="key: left arrow" id="leftArrow"
37+
<div class="navigation-arrow highlight"
38+
*ngIf="navigation.hasPrev" title="key: left arrow" id="leftArrow"
4539
(click)="prevImage()"><span
4640
class="glyphicon glyphicon-chevron-left"></span></div>
47-
<div class="navigation-arrow highlight" *ngIf="navigation.hasNext" title="key: right arrow" id="rightArrow"
41+
<div class="navigation-arrow highlight"
42+
*ngIf="navigation.hasNext" title="key: right arrow" id="rightArrow"
4843
(click)="nextImage()"><span
4944
class="glyphicon glyphicon-chevron-right"></span></div>
45+
46+
<div class="controls controls-playback">
47+
<span class="glyphicon glyphicon-pause highlight control-button"
48+
[ngClass]="playBackState == 0 ? 'button-disabled':''"
49+
(click)="pause()"
50+
title="pause"></span>
51+
<span
52+
class="glyphicon glyphicon-play highlight control-button"
53+
[ngClass]="playBackState == 1 ? 'button-active':''"
54+
(click)="play()"
55+
title="auto play"></span>
56+
<span class="glyphicon glyphicon-forward highlight control-button"
57+
[ngClass]="playBackState == 2 ? 'button-active':''"
58+
(click)="fastForward()"
59+
title="fast auto play"></span>
60+
</div>
5061
</div>
5162
<info-panel *ngIf="activePhoto && infoPanelVisible"
5263
id="info-panel"

frontend/app/gallery/lightbox/lightbox.gallery.component.ts

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {OverlayService} from "../overlay.service";
1717
import {Subscription} from "rxjs";
1818
import {animate, AnimationBuilder, style} from "@angular/animations";
1919
import {GalleryLightboxPhotoComponent} from "./photo/photo.lightbox.gallery.component";
20+
import {Observable} from "rxjs/Observable";
2021

2122
@Component({
2223
selector: 'gallery-lightbox',
@@ -37,7 +38,11 @@ export class GalleryLightboxComponent implements OnDestroy {
3738

3839
public visible = false;
3940
private changeSubscription: Subscription = null;
40-
41+
private timer: Observable<number>;
42+
private timerSub: Subscription;
43+
public playBackState: number = 0;
44+
public controllersDimmed = true;
45+
public controllersVisible = true;
4146

4247
public infoPanelVisible = false;
4348
public infoPanelWidth = 0;
@@ -48,8 +53,12 @@ export class GalleryLightboxComponent implements OnDestroy {
4853
private _builder: AnimationBuilder) {
4954
}
5055

56+
ngOnInit(): void {
57+
this.timer = Observable.timer(1000, 2000);
58+
}
5159

5260
ngOnDestroy(): void {
61+
this.pause();
5362
if (this.changeSubscription != null) {
5463
this.changeSubscription.unsubscribe();
5564
}
@@ -76,6 +85,7 @@ export class GalleryLightboxComponent implements OnDestroy {
7685
}
7786

7887
public prevImage() {
88+
this.pause();
7989
if (this.activePhotoId > 0) {
8090
this.showPhoto(this.activePhotoId - 1);
8191
return;
@@ -87,6 +97,7 @@ export class GalleryLightboxComponent implements OnDestroy {
8797
activePhotoId: number = null;
8898

8999
private showPhoto(photoIndex: number, resize: boolean = true) {
100+
console.log("showing photo");
90101
this.activePhoto = null;
91102
this.changeDetector.detectChanges();
92103
this.updateActivePhoto(photoIndex, resize);
@@ -120,6 +131,8 @@ export class GalleryLightboxComponent implements OnDestroy {
120131
startPhotoDimension: Dimension = <Dimension>{top: 0, left: 0, width: 0, height: 0};
121132

122133
public show(photo: PhotoDTO) {
134+
this.controllersVisible = true;
135+
this.showControls();
123136
console.log(this.photoElement);
124137
this.visible = true;
125138
let selectedPhoto = this.findPhotoComponent(photo);
@@ -149,6 +162,7 @@ export class GalleryLightboxComponent implements OnDestroy {
149162
}
150163

151164
public hide() {
165+
this.controllersVisible = false;
152166
this.fullScreenService.exitFullScreen();
153167

154168
const lightboxDimension = this.activePhoto.getDimension();
@@ -343,5 +357,58 @@ export class GalleryLightboxComponent implements OnDestroy {
343357

344358
return <Dimension>{top: top, left: left, width: width, height: height};
345359
}
360+
361+
visibilityTimer = null;
362+
363+
@HostListener('mousemove')
364+
onMousemove() {
365+
this.showControls();
366+
}
367+
368+
private showControls() {
369+
this.controllersDimmed = true;
370+
if (this.visibilityTimer != null) {
371+
clearTimeout(this.visibilityTimer);
372+
}
373+
this.visibilityTimer = setTimeout(this.hideControls, 2000);
374+
}
375+
376+
private hideControls = () => {
377+
378+
this.controllersDimmed = false;
379+
};
380+
381+
public pause() {
382+
if (this.timerSub != null) {
383+
this.timerSub.unsubscribe();
384+
}
385+
this.playBackState = 0;
386+
}
387+
388+
public play() {
389+
console.log("play");
390+
this.pause();
391+
this.timerSub = this.timer.filter(t => t % 2 == 0).subscribe(() => {
392+
if (this.navigation.hasNext) {
393+
this.nextImage();
394+
} else {
395+
this.showPhoto(0);
396+
}
397+
});
398+
this.playBackState = 1;
399+
}
400+
401+
public fastForward() {
402+
console.log("fastForward");
403+
this.pause();
404+
this.timerSub = this.timer.subscribe(() => {
405+
if (this.navigation.hasNext) {
406+
this.nextImage();
407+
} else {
408+
this.showPhoto(0);
409+
}
410+
});
411+
this.playBackState = 2;
412+
}
346413
}
347414

0 commit comments

Comments
 (0)