Mobile Framework

Zooming into a Selected Asset in the Floor Plan

When the user clicks on the “Locate Building” button and chooses a building from the list, you can call the DrawingControl’s findAsset() method, which highlights the building, and then centers and zooms into the map.

campus_map.png

Note that you can highlight a located asset over an existing highlight scheme. (The default highlight color is yellow. However, you can also specify a custom css class; in this case, red.)

If the user selects a new building, the new building is highlighted in red and the previously selected building returns to yellow.

campus_map2.png

findAsset accepts two parameters:

  • id – Required. This is a string of the asset id to search for.
  • opts – Optional. This is an object containing optional properties that can be used for customization. Currently, you can customize:
    • cssClass - This a string of the css class to attach to the found object.
    • zoomFactor – This is a number representing the zoom factor, relative to the asset’s size . Default value is 5.
    • removeStyle - Assets will often have both a class and a style. The fill is often placed in the style attribute. By default, findAsset will remove the existing css class and style in order to allow you to highlight by a custom color. However, sometimes you may wish to retain the existing style. In this scenario, set removeStyle to false.
      var opts = {'cssClass' : 'zoomed-asset-red'}; drawingControl.findAsset(bl_id, opts);