In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will introduce in detail "How Mini programs create and return map context mapContext objects," the content steps are clear and detailed, the details are properly handled, and the editor will update different knowledge points every day. I hope this article "How Mini programs create and return map context mapContext objects" can give you unexpected gains. Please follow the ideas of the editor slowly. The specific contents are as follows. Let's harvest new knowledge together.
Creates and returns a mapContext object. Under Custom Component, the second parameter is passed into component instance this to manipulate the component within the component.
mapContext
mapContext is bound to a component through mapId, through which the corresponding component can be operated.
List of methods of mapContext object
Method Parameter Description Minimum version getCenterLocationOBJECT Gets the latitude and longitude of the current map center. The returned coordinate system is gcj02 coordinate system. It can be used for wx.openLocationmoveToLocation None Move the map center to the current location point. It needs to cooperate with the show-location of the map component. Use translateMarkerOBJECT to translate marker. Animated 1.2.0includePointsOBJECT Zoom Field of View Show all latitudes and longitude 1.2.0getRegionOBJECT Get field of view of current map 1.4.0getScaleOBJECT Get zoom level of current map 1.4.0
OBJECT parameter list for getCenterLocation
Parameter type Required Description successFunction No Interface successfully calls callback function, res = { longitude: "longitude", latitude: "latitude"}failFunction No Interface calls callback function that fails completeFunction No Interface calls callback function that ends (call will be executed if successful or failed)
List of OBJECT parameters for translateMarker
Parameter type Required Description markerIdNumber is the specified markerdestinationObject is the target point to which the marker moves autoRotateBoolean is whether to automatically rotate during movement markerrotateNumber is the rotation angle durationNumber of the marker No Animation duration, default value 1000ms, translation and rotation are calculated separately animationEndFunction No Animation end Callback function failFunction No Interface call failed Callback function
OBJECT parameter list includePoints
Parameter Type Required Description pointsArray is a list of coordinate points to be displayed in the visible area,[{latitude, longitude}]paddingArray No Distance from the edge of the rectangle formed by coordinate points to the edge of the map, in pixels. The format is [top, right, bottom, left], Android can only identify the first item of the array, and the padding of the top, bottom, left and right is consistent. Developer tools do not support padding parameters at this time.
OBJECT parameter list for getRegion
Parameter type Required Description successFunction No Interface successfully calls callback function, res = {southwest, northeast}, longitude of southwest corner and northeast corner failFunction No Interface calls callback function that fails completeFunction No Interface calls callback function that ends (call will be executed if successful or failed)
OBJECT parameter list for getScale
Parameter type Required Description successFunction No Interface calls successful callback function, res = {scale}failFunction No Interface calls failed callback function completeFunction No Interface calls finished callback function (successful or failed call will be executed)
Example code:
Get Position Move Position Move Mark Zoom View Show All Latitude and Longitude What are the advantages of Mini programs? Mini programs are less difficult to develop than developers, saving development and operation costs, allowing developers to quickly develop a Mini programs. In addition, Mini programs can be easily acquired and disseminated in WeChat, which can meet the basic life application, meet the conversion of offline shops of life service category and non-rigid low-frequency applications. For users, it can save time cost and mobile phone memory space, and has excellent use experience.
Thank you for reading here. I hope you have the most profound experience on the key issue of "how to create and return mapContext objects for Mini programs" from the practical level. The specific use situation still needs to be practiced by everyone before you can understand it. If you want to read more articles related to content, please pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.