From 43a903d98b1b302c64fb804be6b0e6ce09660b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 21 Nov 2013 22:02:30 +0100 Subject: [PATCH] Make vector-layer example work when hosted --- examples/vector-layer.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/vector-layer.js b/examples/vector-layer.js index 90373d2e4c..52db5f960f 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -54,9 +54,8 @@ $.getJSON('data/countries.geojson', function(data) { }); var highlight; -var displayFeatureInfo = function(pixel) { +var displayFeatureInfo = function(coordinate) { var oldHighlight = highlight; - var coordinate = map.getCoordinateFromPixel(pixel); var features = vectorSource.getAllFeaturesAtCoordinate(coordinate); var info = document.getElementById('info'); if (features.length > 0) { @@ -73,13 +72,13 @@ var displayFeatureInfo = function(pixel) { }; $(map.getViewport()).on('mousemove', function(evt) { - var pixel = map.getEventPixel(evt.originalEvent); - displayFeatureInfo(pixel); + var coordinate = map.getEventCoordinate(evt.originalEvent); + displayFeatureInfo(coordinate); }); map.on('singleclick', function(evt) { - var pixel = evt.getPixel(); - displayFeatureInfo(pixel); + var coordinate = evt.getCoordinate(); + displayFeatureInfo(coordinate); }); var highlightStyle = new ol.style.Style({