-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds fullscreen help control, re: #40
- Loading branch information
Showing
4 changed files
with
160 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as template from './template.html'; | ||
|
||
export default class FullscreenHelp { | ||
constructor(fullscreenControl) { | ||
this.fullscreenControl = fullscreenControl; | ||
this.dismissed = false; | ||
} | ||
onAdd(map) { | ||
const parser = new DOMParser(); | ||
const doc = parser.parseFromString(template, "text/html"); | ||
const el = doc.body.removeChild(doc.body.firstChild); | ||
this.map = map; | ||
this.container = el; | ||
this.container.style.display = "none"; | ||
|
||
window.document.addEventListener(this.fullscreenControl._fullscreenchange, () => { | ||
if (!this.fullscreenControl._fullscreen) this.dismiss(); | ||
this.container.style.display = this.dismissed ? "none" : "inline-block"; | ||
}); | ||
|
||
this.container.querySelectorAll('a').forEach(element => { | ||
element.onclick = () => { | ||
this.dismiss(); | ||
}; | ||
}); | ||
|
||
return this.container; | ||
} | ||
dismiss() { | ||
this.container.style.display = "none"; | ||
this.dismissed = true; | ||
} | ||
onRemove() { | ||
this.container.parentNode.removeChild(this.container); | ||
this.map = undefined; | ||
} | ||
} |
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,17 @@ | ||
<div class="mapboxgl-ctrl mapboxgl-ctrl-group"> | ||
<div class="mapboxgl-ctrl-help"> | ||
<div class="expand-popup mbl-map"> | ||
<div class="hint-header"> | ||
<h5>Click to Exit Fullscreen</h5> | ||
<a class="icon-Close icomoon"></a> | ||
</div> | ||
<div class="clear"></div> | ||
<div class="hint-text"> | ||
Click on the collapse icon to exit fullscreen view. | ||
</div> | ||
<div class="hint-check"> | ||
<a class="white-link flt-right">OK</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
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