This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(overlay): Uses the fullscreenoverlaycontainer now to properly ha…
…ndle fullscreen mode.
- Loading branch information
Showing
7 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
libs/examples/src/overlay/overlay-fullscreen-example/overlay-fullscreen-example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div #container class="span-container"> | ||
<span | ||
[dtOverlay]="overlay" | ||
style="cursor: pointer;" | ||
[dtOverlayConfig]="config" | ||
> | ||
Hover me | ||
</span> | ||
</div> | ||
<button (click)="requestFullscreen()">Test Fullscreen</button> | ||
<ng-template #overlay> | ||
<p>Overlay content</p> | ||
</ng-template> |
4 changes: 4 additions & 0 deletions
4
libs/examples/src/overlay/overlay-fullscreen-example/overlay-fullscreen-example.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.span-container { | ||
background: #ffffff; | ||
width: 100%; | ||
} |
55 changes: 55 additions & 0 deletions
55
libs/examples/src/overlay/overlay-fullscreen-example/overlay-fullscreen-example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Component, ViewChild, ElementRef, Inject } from '@angular/core'; | ||
|
||
import { DtOverlayConfig } from '@dynatrace/barista-components/overlay'; | ||
import { DOCUMENT } from '@angular/common'; | ||
|
||
@Component({ | ||
selector: 'dt-example-overlay-fullscreen', | ||
templateUrl: 'overlay-fullscreen-example.html', | ||
styleUrls: ['./overlay-fullscreen-example.scss'], | ||
}) | ||
export class DtExampleOverlayFullscreen { | ||
config: DtOverlayConfig = { | ||
pinnable: true, | ||
originY: 'center', | ||
}; | ||
|
||
@ViewChild('container', { static: true }) container: ElementRef; | ||
|
||
constructor(@Inject(DOCUMENT) private readonly document: Document) {} | ||
|
||
async requestFullscreen(): Promise<void> { | ||
try { | ||
const element = this.container.nativeElement; | ||
const _document = this.document as any; | ||
|
||
if (_document.fullscreenEnabled) { | ||
await element.requestFullscreen(); | ||
} else if (_document.webkitFullscreenEnabled) { | ||
await element.webkitRequestFullscreen(); | ||
} else if (_document.mozFullScreenEnabled) { | ||
await element.mozRequestFullScreen(); | ||
} else if (_document.msFullscreenEnabled) { | ||
await element.msRequestFullScreen(); | ||
} | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
} |