@@ -789,4 +789,56 @@ public void setCustomControls(CustomControl... customControls) {
789789 }
790790 this .getElement ().setPropertyJson ("customControls" , jsonArray );
791791 }
792+
793+ /**
794+ * Adds a FullScreenEvent listener. The listener is called to notify whether the map is in full
795+ * screen mode.
796+ *
797+ * @param listener a FullScreenEvent listener
798+ * @return Registration object to allow removing the listener
799+ */
800+ public Registration addFullScreenListener (ComponentEventListener <FullScreenEvent > listener ) {
801+ DomListenerRegistration registration =
802+ this .getElement ().addEventListener ("fullscreenchange" , ev -> {
803+ this .getElement ()
804+ .executeJs (
805+ "var isFullScreen = document.fullScreen ||\r \n "
806+ + " document.mozFullScreen ||\r \n "
807+ + " document.webkitIsFullScreen;\r \n "
808+ + " return isFullScreen != null ? isFullScreen : false;" )
809+ .then (Boolean .class , isFullScreen -> listener
810+ .onComponentEvent (new FullScreenEvent (this , true , isFullScreen )));
811+ });
812+ return registration ::remove ;
813+ }
814+
815+ /**
816+ * Event fired when the full screen mode changes on the map.
817+ */
818+ public static class FullScreenEvent extends ComponentEvent <GoogleMap > {
819+
820+ private boolean isFullScreen ;
821+
822+ /**
823+ * Creates a new FullScreenEvent.
824+ *
825+ * @param source the source component
826+ * @param fromClient whether the event originated from the client side
827+ * @param isFullScreen the full screen state
828+ */
829+ public FullScreenEvent (GoogleMap source , boolean fromClient , boolean isFullScreen ) {
830+ super (source , true );
831+ this .isFullScreen = isFullScreen ;
832+ }
833+
834+ /**
835+ * Checks if the map is in full screen mode.
836+ *
837+ * @return true if the map is in full screen mode, false otherwise
838+ */
839+ public boolean isFullScreen () {
840+ return isFullScreen ;
841+ }
842+ }
843+
792844}
0 commit comments