This is the 9th day of my participation in the August Wen Challenge.More challenges in August
Text layer
- Text display Layer, inherited from Layer, can be picked with the mouse
-
fontFamily ### collides
-
Text font
-
Color color
-
FontSize fontSize
-
Unit Specifies the unit in which the fontSize property is drawn. The default is px.
- Draw by pixel
- Let’s do it in meters
-
Angle Whether the text is tilted with the map, i.e. lying flat on the map
-
Offset Indicates the offset based on the center of the text
-
SelectedColor indicates the selectedColor
-
AutoSelect automatically sets selectedIndex based on mouse position, making the selected object change color, and disables selectedIndex when set to true
var textLayer = new mapvgl.TextLayer({ // fontFamily: 'Songti SC', enablePicked: true, autoSelect: true, selectedColor: '#f00', // select the item color: '#ff0'});Copy the code
-
Icon in the layer
- IconLayer
- Simple dot Layer used to display large amounts of data, inherited from Layer. Use the mouse to Pick up the Pick
The options properties
- Object (Canvas DOM), String (image URL address)
- Width the width of the
- Height height
- Scale sets the icon scale
- The opacity of the opacity layer is 0-1
- Whether the flat icon is tilted with the map, i.e. lying flat on the map
var layer = new mapvgl.IconLayer({ width: 200 , height: 200 , offset: [0, -153 / 8], opacity: 1, icon: 'https://img0.baidu.com/it/u=2027730681, 1224762729 & FM = 26 & FMT = auto&gp = 0. JPG', enablePicked: // Select selectedColor: '#ff0000', // select autoSelect: OnClick: (e) => {// Click the event console.log('click', e); }, onDblClick: e => { console.log('double click', e); }, onRightClick: e => { console.log('right click', e); }});Copy the code
We can watch farts again
Mouse pick mouse interaction behavior, support hover and click
The options parameter
- EnablePicked Whether to enable the mouse event
onClick
withonMousemove
Event that also supports changing the color of the picked object. - SelectedIndex Manually specifies the index of the selected data item so that the object represented by the data item changes color. -1 indicates that no element is selected
- OnClick onClick({Object}pickObject) Returns data if the click is on the selected Object
- OnRightClick event that returns data if it right-clicks on a selectable object