Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
273 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Plain</title> | ||
<style media="screen"> | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
html, | ||
body, | ||
#map { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="map">loading</div> | ||
<!--do not use async defer--> | ||
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=c6cf0a6f81c01e6226691a7308962357"></script> | ||
<script src="../dist/plain.js"></script> | ||
<script> | ||
var plain = new Plain().use('AMAP'); | ||
|
||
var path = [ | ||
[39.910, 116.404], | ||
[39.71, 116.5], | ||
[39.909, 117], | ||
[39.710, 118] | ||
]; | ||
var map = plain.Map({ | ||
container: "map", | ||
center: [39.910, 116.404], | ||
zoom: 15 | ||
}); | ||
var icon = plain.Icon({ | ||
url: 'https://unpkg.com/leaflet@1.0.3/dist/images/marker-icon.png', | ||
size: [25, 40], | ||
anchor: [12.5, 40] | ||
}); | ||
var markerOpt = { | ||
icon: icon, | ||
draggable: true | ||
}; | ||
var marker = plain.Marker([39.910, 116.404], markerOpt); | ||
var marker2 = plain.Marker([39.910, 116.402], markerOpt); | ||
var polyline = plain.Polyline(path, { | ||
color: "#f00", | ||
weight: 2, | ||
opacity: 0.8 | ||
}); | ||
map.addLayer([marker, marker2]); | ||
map.addLayer(polyline); | ||
function eventHandler (e) { | ||
alert(e); | ||
console.log(plain.Util.formatEvent.call(this, e)); | ||
} | ||
var listener = marker.on('click', eventHandler); | ||
setTimeout(() => { | ||
console.log("remove listener"); | ||
marker.off(listener); | ||
}, 4000); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.