Source: map/tools/FitToScreenButton.js

  1. import { UiElement } from '../../ui/UiElement.js';
  2. export { FitToScreenButton };
  3. /**
  4. * Simple button to fit map height to the screen
  5. *
  6. * @author rhess <robin.hess@awi.de>
  7. *
  8. * @memberof vef.map.tools
  9. */
  10. class FitToScreenButton extends UiElement {
  11. constructor(map, position) {
  12. super();
  13. this.map = map;
  14. this.position = position || "top-left";
  15. // initialize element
  16. const element = this.getElement();
  17. element.classList.add("vef-tool");
  18. element.innerHTML = "<i class='fas fa-expand'></i>"
  19. element.title = "Zoom to full extent";
  20. element.addEventListener("click", () => this.map.fitToScreen());
  21. this.map.addTool(this, this.position);
  22. }
  23. }