mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
implementing lightroom fullscreenmode
This commit is contained in:
parent
869a92e24c
commit
8c04f56c52
@ -13,6 +13,7 @@ import {AdminComponent} from "./admin/admin.component";
|
|||||||
import {NetworkService} from "./model/network/network.service";
|
import {NetworkService} from "./model/network/network.service";
|
||||||
import {ThumbnailLoaderService} from "./gallery/grid/thumnailLoader.service";
|
import {ThumbnailLoaderService} from "./gallery/grid/thumnailLoader.service";
|
||||||
import {GalleryCacheService} from "./gallery/cache.gallery.service";
|
import {GalleryCacheService} from "./gallery/cache.gallery.service";
|
||||||
|
import {FullScreenService} from "./gallery/fullscreen.service";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -27,7 +28,8 @@ import {GalleryCacheService} from "./gallery/cache.gallery.service";
|
|||||||
GalleryCacheService,
|
GalleryCacheService,
|
||||||
GalleryService,
|
GalleryService,
|
||||||
AuthenticationService,
|
AuthenticationService,
|
||||||
ThumbnailLoaderService]
|
ThumbnailLoaderService,
|
||||||
|
FullScreenService]
|
||||||
})
|
})
|
||||||
@RouteConfig([
|
@RouteConfig([
|
||||||
{
|
{
|
||||||
|
43
frontend/app/gallery/fullscreen.service.ts
Normal file
43
frontend/app/gallery/fullscreen.service.ts
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
///<reference path="../../browser.d.ts"/>
|
||||||
|
|
||||||
|
import {Injectable} from "@angular/core";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class FullScreenService {
|
||||||
|
|
||||||
|
|
||||||
|
public isFullScreenEnabled():boolean {
|
||||||
|
return !!(document.fullscreenElement || document['mozFullScreenElement'] || document.webkitFullscreenElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
public showFullScreen(element:any) {
|
||||||
|
if (this.isFullScreenEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.requestFullscreen) {
|
||||||
|
element.requestFullscreen();
|
||||||
|
} else if (element.mozRequestFullScreen) {
|
||||||
|
element.mozRequestFullScreen();
|
||||||
|
} else if (element.webkitRequestFullscreen) {
|
||||||
|
element.webkitRequestFullscreen();
|
||||||
|
} else if (element.msRequestFullscreen) {
|
||||||
|
element.msRequestFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public exitFullScreen() {
|
||||||
|
if (!this.isFullScreenEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.exitFullscreen) {
|
||||||
|
document.exitFullscreen();
|
||||||
|
} else if (document['mozCancelFullScreen']) {
|
||||||
|
document['mozCancelFullScreen']();
|
||||||
|
} else if (document.webkitExitFullscreen) {
|
||||||
|
document.webkitExitFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -43,6 +43,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
top: 0;
|
||||||
position: fixed;;
|
position: fixed;;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div [hidden]="!visible">
|
<div [hidden]="!visible" #root>
|
||||||
|
|
||||||
<div class="blackCanvas">
|
<div class="blackCanvas">
|
||||||
</div>
|
</div>
|
||||||
@ -19,7 +19,15 @@
|
|||||||
[download]="activePhoto.gridPhoto.photo.name"><span class="glyphicon glyphicon-download-alt highlight"
|
[download]="activePhoto.gridPhoto.photo.name"><span class="glyphicon glyphicon-download-alt highlight"
|
||||||
title="download"></span></a>
|
title="download"></span></a>
|
||||||
<span class="glyphicon glyphicon-info-sign highlight" title="info"></span>
|
<span class="glyphicon glyphicon-info-sign highlight" title="info"></span>
|
||||||
<span class="glyphicon glyphicon-fullscreen highlight" title="toggle fullscreen"></span>
|
|
||||||
|
<span class=" glyphicon glyphicon-resize-small highlight"
|
||||||
|
*ngIf="fullScreenService.isFullScreenEnabled()"
|
||||||
|
(click)="fullScreenService.exitFullScreen()" title="toggle fullscreen"></span>
|
||||||
|
|
||||||
|
<span class="glyphicon glyphicon-fullscreen highlight"
|
||||||
|
*ngIf="!fullScreenService.isFullScreenEnabled()"
|
||||||
|
(click)="fullScreenService.showFullScreen(root)" title="toggle fullscreen"></span>
|
||||||
|
|
||||||
<span class="glyphicon glyphicon-remove highlight" (click)="hide()" title="close"></span>
|
<span class="glyphicon glyphicon-remove highlight" (click)="hide()" title="close"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
///<reference path="../../../browser.d.ts"/>
|
///<reference path="../../../browser.d.ts"/>
|
||||||
|
|
||||||
import {Component, QueryList, Output, EventEmitter, HostListener} from "@angular/core";
|
import {Component, QueryList, Output, EventEmitter, HostListener, ElementRef, ViewChild} from "@angular/core";
|
||||||
import {Photo} from "../../../../common/entities/Photo";
|
import {Photo} from "../../../../common/entities/Photo";
|
||||||
import {GalleryPhotoComponent} from "../grid/photo/photo.grid.gallery.component.ts";
|
import {GalleryPhotoComponent} from "../grid/photo/photo.grid.gallery.component.ts";
|
||||||
import {BrowserDomAdapter} from "@angular/platform-browser/src/browser/browser_adapter";
|
import {BrowserDomAdapter} from "@angular/platform-browser/src/browser/browser_adapter";
|
||||||
import {Dimension} from "../../model/IRenderable";
|
import {Dimension} from "../../model/IRenderable";
|
||||||
import {GalleryLightboxPhotoComponent} from "./photo/photo.lightbox.gallery.component";
|
import {GalleryLightboxPhotoComponent} from "./photo/photo.lightbox.gallery.component";
|
||||||
|
import {FullScreenService} from "../fullscreen.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'gallery-lightbox',
|
selector: 'gallery-lightbox',
|
||||||
@ -25,8 +26,10 @@ export class GalleryLightboxComponent {
|
|||||||
private dom:BrowserDomAdapter;
|
private dom:BrowserDomAdapter;
|
||||||
private visible = false;
|
private visible = false;
|
||||||
|
|
||||||
|
@ViewChild("root") elementRef:ElementRef;
|
||||||
|
|
||||||
constructor() {
|
|
||||||
|
constructor(private fullScreenService:FullScreenService) {
|
||||||
this.dom = new BrowserDomAdapter();
|
this.dom = new BrowserDomAdapter();
|
||||||
|
|
||||||
|
|
||||||
@ -92,7 +95,7 @@ export class GalleryLightboxComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public hide() {
|
public hide() {
|
||||||
|
this.fullScreenService.exitFullScreen();
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
let to = this.activePhoto.getDimension();
|
let to = this.activePhoto.getDimension();
|
||||||
|
|
||||||
@ -107,6 +110,7 @@ export class GalleryLightboxComponent {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private findPhotoComponent(photo) {
|
private findPhotoComponent(photo) {
|
||||||
let galleryPhotoComponents = this.gridPhotoQL.toArray();
|
let galleryPhotoComponents = this.gridPhotoQL.toArray();
|
||||||
for (let i = 0; i < galleryPhotoComponents.length; i++) {
|
for (let i = 0; i < galleryPhotoComponents.length; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user