Skip to content

Commit d0381ef

Browse files
committed
【fix】 fix ol 可视化 三叶草范例点击报错问题 review by songym
1 parent b9e7dc6 commit d0381ef

File tree

3 files changed

+3
-55
lines changed

3 files changed

+3
-55
lines changed

examples/leaflet/12_graphicLayerImage.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
L.supermap.graphicLayer(graphics, {
6161
render: 'canvas',
6262
onClick: function (graphic, evt) {
63-
console.log(evt);
6463
L.popup().setLatLng(evt.latlng)
6564
.setContent('<p>' + resources.text_latLng + ':<br>' + graphic.getLatLng()
6665
.lng + ',<br>' + graphic.getLatLng().lat + '</p>')

examples/openlayers/07_graphiclayer_clover.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@
148148
graphics: graphics,
149149
render:"canvas",
150150
map: map,
151-
onClick: function (graphic,e) {
151+
onClick: function (graphic) {
152152
if (graphic) {
153-
var coords = e.coordinate;
153+
var coords = graphic.getGeometry().getCoordinates();
154154
content.innerHTML = resources.text_coordinate + ":[" + coords[0] + "," + coords[1] + "]";
155155
overlay.setPosition(coords);
156156
return;

examples/openlayers/07_graphiclayer_image.html

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -10,61 +10,11 @@
1010
<title data-i18n="resources.title_graphicLayerTaxi"></title>
1111
<script type="text/javascript" include="papaparse,widgets" src="../js/include-web.js"></script>
1212
<script type="text/javascript" src="../../dist/ol/include-ol.js"></script>
13-
<style>
14-
.ol-popup {
15-
position: absolute;
16-
background-color: white;
17-
-webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
18-
filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2));
19-
padding: 15px;
20-
border-radius: 10px;
21-
border: 1px solid #cccccc;
22-
bottom: 12px;
23-
left: -50px;
24-
min-width: 50px;
25-
}
26-
27-
.ol-popup:after, .ol-popup:before {
28-
top: 100%;
29-
border: solid transparent;
30-
content: " ";
31-
height: 0;
32-
width: 0;
33-
position: absolute;
34-
pointer-events: none;
35-
}
36-
37-
.ol-popup:after {
38-
border-top-color: white;
39-
border-width: 10px;
40-
left: 48px;
41-
margin-left: -10px;
42-
}
43-
44-
.ol-popup:before {
45-
border-top-color: #cccccc;
46-
border-width: 11px;
47-
left: 48px;
48-
margin-left: -11px;
49-
}
50-
</style>
5113
</head>
5214
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%; position: absolute;top: 0;">
5315
<div id="map" style="width: 100%;height:100%"></div>
54-
<div id="popup" class="ol-popup">
55-
<div id="popup-content"></div>
56-
</div>
5716
<script type="text/javascript">
5817
var url = (window.isLocal ? window.server : "https://iserver.supermap.io") + "/iserver/services/map-china400/rest/maps/ChinaDark",
59-
container = document.getElementById('popup'),
60-
content = document.getElementById('popup-content'),
61-
overlay = new ol.Overlay(({
62-
element: container,
63-
autoPan: true,
64-
autoPanAnimation: {
65-
duration: 250
66-
}
67-
})),
6818
map = new ol.Map({
6919
target: 'map',
7020
controls: ol.control.defaults({attributionOptions: {collapsed: false}})
@@ -74,8 +24,7 @@
7424
zoom: 12,
7525
projection: 'EPSG:3857',
7626
multiWorld: true
77-
}),
78-
overlays: [overlay]
27+
})
7928
});
8029

8130
loadData();

0 commit comments

Comments
 (0)