Change Building Outline
Last updated
Last updated
Here's a code snippet that alternates the building outline color every second, cycling through a palette of contrasting colors, it's not the most practical application, but it shows how to achieve it.
You may desire a way to change the stroke color based on user requirements to make the map meet different accessibility requirements.
To change the building outline color use the strokeColor
property of the BuildingOutlineOptions
interface. This property accepts any color as defined by conventional CSS color values.
See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value for more information on CSS color values.
To do this in practice, on the MapsIndoors instance, call setBuildingOutlineOptions
to change the appearance of the building outline.
The building outline design will be taken from the values set through the CMS.
To change the building outline you can use the different properties of the BuildingOutlineOptions
interface. The properties are the following:
visible
- Controls whether the Building Outline is visible on the map.
The value should be a Boolean here, so either true
or false
.
zoomFrom
- Sets the minimum Zoom Level at which the Building Outline is visible.
The value should be a number between 1 and 25, with 1 being very far away, and 25 being very close (25 not available for all Solutions). In a general use case, most users will only need values between 15 and 25.
zoomTo
- Sets the maximum Zoom Level at which the Building Outline is visible.
The value should be a number between 1 and 25, with 1 being very far away, and 25 being very close (25 not available for all Solutions). In a general use case, most users will only need values between 15 and 25.
strokeColor
- Controls the stroke color of the Building Outline.
This property accepts any color as defined by conventional CSS color values. See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value for more information on CSS color values.
strokeWeight
- Controls the stroke width (in pixels) of the Building Outline.
The value should be a number between.
strokeOpacity
- Controls the stroke opacity of the Building Outline.
The value should be a number between 0 and 1, for example a value of 1 gives 100% opacity, 0.2 gives 20% opacity, etc.
To read more about the BuildingOutlineOptions
interface see the reference docs.
One way to do this in practice, call setBuildingOutlineOptions
on the MapsIndoors instance, to change the appearance of the building outline.
Alternatively, you can define the buildingOutlineOptions
property when creating a new mapsindoors instance.