Skip to main content

reference

Widget parameters

init method parameters

ParameterRequiredDescription
widthyesWidget width. Can be specified in pixels or percentage.
heightyesWidget height. Can be specified in pixels or percentage.
containernoThe element inside which to create the widget. You can pass either the element itself or its id. If this parameter is not specified, the widget will be created where the initialization code is located (using document.write).
initDatayesData to initialize the widget.

initData parameters for widget initialization

ParameterRequiredDescription
complexIdyesThe id of the building whose floors need to be displayed.
optionsnoWidget options.

Widget options

ParameterDescriptionDefault value
localeWidget interface locale. Available values: ru_RU, es_CL, or en_US.ru_RU
initialSearchQueryInitializes the widget with an open search results page for the given query.undefined
initialRubricInitializes the widget with an open list of firms in the rubric with the given id.undefined
initialFirmInitializes the widget with an open firm card with the given id.undefined
initialZoomDetermines the zoom level at which to open the widget. If not specified, the zoom level is chosen automatically to fit the entire building inside the widget. This parameter is ignored if either initialSearchQuery or initialRubric is specified.undefined
initialRotationDetermines the angle to which to rotate the map on which to open the widget. Specified in radians. If not specified, the angle is chosen automatically.undefined
initialFloorDetermines the floor to which to open the widget. If not specified, the widget opens on the building's default floor.undefined
rotatableDetermines whether the map with floors can be rotated.true
minZoomDetermines the map's minimum zoom level. If not specified, it is calculated automatically.undefined
maxZoomDetermines the map's maximum zoom level. If not specified, it is calculated automatically.undefined

Widget methods

The DG.FloorsWidget.init method returns an object with three callable methods.

MethodDescription
search(query)Opens a search results page for the specified query.
showFirm(firmId)Opens a firm card with the given id.
showRubric(rubricId)Opens a list of firms in the rubric with the given id.
zoomIn()Increases the map zoom level.
zoomOut()Decreases the map zoom level.
showFloor(floor)Switches the map to the floor with the given name. Accepts a string with the floor name.

Events

The widget object generates events that you can subscribe to. The following methods control events:

MethodDescription
on(type, handler)Adds the handler event handler for the type event.
off(type, handler)Removes the handler event handler for the type event.
off(type)Removes all handlers for the type event.
off()Removes all handlers for all events.

You can subscribe to the following events:

NameDescriptionData received in the event
initOccurs at the moment the map is initialized.floorList, firmList
clickOccurs when the user clicks on a firm (room or icon) on the map.firmIds
zoomendOccurs at the end of the zoom animation.state
floorswitchOccurs when the floor is switched.state

Event data

floorList

An array that contains the names of all floors in the building, starting from the lowest to the highest.

firmList

An array containing all firms in the building. The array element is an object with the following fields:

NameTypeDescription
idstringThe firm's id.
floorstringThe name of the floor on which the firm is located.

state

An object that contains data about the current state of the map. It has the following fields:

NameTypeDescription
floorstringThe current floor's name.
zoomnumberThe current map zoom level.
minZoomnumberThe map's minimum zoom level.
maxZoomnumberThe map's maximum zoom level.

firmIds

An array of firm ids where the click was made. Cannot be empty. May have more than one element if the click was made in a room containing multiple firms.