What settings can Google Map-GMap2 have?

Source: Internet
Author: User
To initialize a gmap2 object, in addition to setting Google maps using the gmapoptions parameter, you can also set some common attributes of the map in some ways after creating the gmap2 object, according to my usage habits and frequency, make a classification (if "default" is not added after the title, this attribute is not supported by the map by default. In addition, the map in this article refers to the Instance Object of gmap2, this saves the trouble of using gmap2 for method declaration ):

1. Continuous scaling
When the map is scaled, the old block does not disappear directly before the new block is loaded. The switching between the blocks is smooth, and the effect will be better when the network speed is slow. Map is not supported by default. We recommend that you enable this function. Use Map. enablecontinuouszoom ()/map. disablecontinuouszoom () to switch between them. In addition, you can use map. continuouszoomenabled () to check whether the map supports Continuous scaling.

2. scroll wheel Scaling

Using the scroll wheel to zoom in or out a map is not supported by default. We recommend that you enable this function. Use the map. enablescrollwheelzoom ()/map. disablescrollwheelzoom () method to switch between and use the map. scrollwheelzoomenabled () method for detection.

3. Double-click scaling is supported.

Double-click the left button to enlarge the map. It is not supported by default. We recommend that you open it. Use the map. enabledoubleclickzoom ()/map. disabledoubleclickzoom () method to switch between and use the map. doubleclickzoomenabled () method for detection. In addition, right-click to zoom out a map is supported by default, and there is no way to change the attribute of right-click in the map API.

4. Supports map dragging (default)
Drag the map with the left-click button, which is supported by default. Use the enabledragging/disabledragging method, and use the draggingenabled () method for testing. This estimation is an old method, because I cannot figure out why I cannot drag a map if I already have a static map API, unless you want to temporarily prohibit the drag of a map.

5. supported information window (default)

When necessary, a bubble map can pop up and display information in it. It is also supported by default. Use the enableInfoWindow/disableInfoWindow method to switch between them, and use the infodeskwenabled () method to detect them. In general, this attribute makes it retain the default value. If you only need to mark on the map and do not allow any information window to pop up, or you want to drag a map with the same attributes, temporary prohibition is required.

6. Add a search bar
Change the Logo in the lower-left corner of the map to a control with a search box, so that you can directly use the Google data source in your map to support user search, after customization, it can be used as a miniature map home page. This is a new feature in the Chinese API. I mentioned in previous articles that the googleBarOptions attribute in GMapOptions can be used to customize this control. This is not added on the map by default. Therefore, if you do not use the map. enableGoogleBar () method to explicitly declare and add a search bar, googleBarOptions will not work. The map. disableGoogleBar () operation is used to add the reverse direction of the search bar ().

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.