Skip to main content

FullscreenControl

The FullscreenControl object is used to configure the Fullscreen control on the map.

The FullscreenControl object lets you change the position of the fullscreen control.

See the Map Controls guide page for more information.

Example usage

const fullscreenControl = G.fullscreenControl({
position: G.ControlPosition.TOP_CENTER,
});

const map = G.map('map', {
center: [40.7128, -74.0060],
fullscreenControl: fullscreenControl,
});

Creating the FullscreenControl object

G.fullscreenControl(options?: FullscreenControlValue): FullscreenControl

There are a few ways to setup the FullscreenControl object.

Pass no value.

G.fullscreenControl(): FullscreenControl

const control = G.fullscreenControl();
control.position = G.ControlPosition.TOP_CENTER;

Pass a boolean value to disable the Fullscreen control.

G.fullscreenControl(value: boolean): FullscreenControl

ParameterTypeRequiredDescription
valuebooleanYesWhether to enable the Fullscreen control.

If you pass a false value to the fullscreenControl method then that will disable and hide the Fullscreen control when this is associated with a map.

const control = G.fullscreenControl(false);

Pass an object of options.

G.fullscreenControl(options: FullscreenControlOptions): FullscreenControl

ParameterTypeRequiredDescription
optionsFullscreenControlOptionsYesThe configuration options.
const fullscreenControl = G.fullscreenControl({
position: G.ControlPosition.TOP_CENTER,
});

Pass an existing FullscreenControl object.

G.fullscreenControl(value: FullscreenControl): FullscreenControl

ParameterTypeRequiredDescription
valueFullscreenControlYesThe existing FullscreenControl object.
const control = G.fullscreenControl(existingFullscreenControlObject);

Fullscreen Control options

Type FullscreenControlOptions.

FullscreenControlOptions is an object containing the configuration options for the FullscreenControl object.

OptionTypeDefaultDescription
enabledbooleantrueWhether the Fullscreen control is enabled and will display on the map.
positionControlPositionINLINE_END_BLOCK_STARTThe display position of the control.

Properties

PropertyTypeDescription
enabledbooleanWhether the Fullscreen control is enabled and will display on the map.
positionControlPositionThe display position of the control.

Methods

disable

disable(): FullscreenControl

Disables and hides the Fullscreen control.

control.disable();

enable

enable(): FullscreenControl

Enables and shows the Fullscreen control.

control.enable();

setPosition

setPosition(position: ControlPosition): FullscreenControl

Set the display position of the control on the map.

ParameterTypeRequiredDescription
positionControlPositionYesThe display position of the control.
control.setPosition(G.ControlPosition.BLOCK_END_INLINE_START)

toGoogle

toGoogle(): Promise<google.maps.FullscreenControlOptions>

Get the object to use to pass the FullscreenControl options to the Google Map instance.

control.toGoogle().then((options) => {
// Do something with the options
});