Make clicking outside the settings popup dismiss it
This commit is contained in:
parent
2166f9fa07
commit
3378fb3447
|
@ -49,9 +49,7 @@
|
||||||
<div class="pf-arrow-box"></div>
|
<div class="pf-arrow-box"></div>
|
||||||
</div>
|
</div>
|
||||||
<button id="pf-settings-button" type="button" class="btn btn-outline-secondary"
|
<button id="pf-settings-button" type="button" class="btn btn-outline-secondary"
|
||||||
aria-expanded="false" aria-controls="#pf-settings">
|
aria-expanded="false" aria-controls="#pf-settings">{{octicon "gear"}}</button>
|
||||||
{{octicon "gear"}}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="rounded py-1 px-3 mr-3" id="pf-fps-label">0 ms</div>
|
<div class="rounded py-1 px-3 mr-3" id="pf-fps-label">0 ms</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -60,12 +60,17 @@ export abstract class DemoAppController<View extends PathfinderDemoView> extends
|
||||||
this.settingsButton = document.getElementById('pf-settings-button') as HTMLButtonElement;
|
this.settingsButton = document.getElementById('pf-settings-button') as HTMLButtonElement;
|
||||||
this.settingsCloseButton = document.getElementById('pf-settings-close-button') as
|
this.settingsCloseButton = document.getElementById('pf-settings-close-button') as
|
||||||
HTMLButtonElement;
|
HTMLButtonElement;
|
||||||
this.settingsButton.addEventListener('click', () => {
|
|
||||||
|
this.settingsButton.addEventListener('click', event => {
|
||||||
|
event.stopPropagation();
|
||||||
this.settingsCard.classList.toggle('pf-invisible');
|
this.settingsCard.classList.toggle('pf-invisible');
|
||||||
}, false);
|
}, false);
|
||||||
this.settingsCloseButton.addEventListener('click', () => {
|
this.settingsCloseButton.addEventListener('click', () => {
|
||||||
this.settingsCard.classList.add('pf-invisible');
|
this.settingsCard.classList.add('pf-invisible');
|
||||||
}, false);
|
}, false);
|
||||||
|
document.body.addEventListener('click', () => {
|
||||||
|
this.settingsCard.classList.add('pf-invisible');
|
||||||
|
}, false);
|
||||||
|
|
||||||
this.filePickerElement = document.getElementById('pf-file-select') as
|
this.filePickerElement = document.getElementById('pf-file-select') as
|
||||||
(HTMLInputElement | null);
|
(HTMLInputElement | null);
|
||||||
|
|
Loading…
Reference in New Issue