From f2f5cd2630ddeb4b562f234de769dff8d990e62e Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sat, 1 Aug 2015 16:57:35 -0600 Subject: [PATCH] Make seed coordinate sticky --- examples/region-growing.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/examples/region-growing.js b/examples/region-growing.js index 266c019751..a393de64c3 100644 --- a/examples/region-growing.js +++ b/examples/region-growing.js @@ -103,14 +103,10 @@ var map = new ol.Map({ }) }); -var pixel; +var coordinate; -map.getView().on('change', function() { - pixel = null; -}); - -map.on('click', function(ev) { - pixel = map.getPixelFromCoordinate(ev.coordinate); +map.on('click', function(event) { + coordinate = event.coordinate; raster.changed(); }); @@ -118,7 +114,9 @@ raster.on('beforeoperations', function(event) { // the event.data object will be passed to operations var data = event.data; data.delta = thresholdControl.value; - data.pixel = pixel; + if (coordinate) { + data.pixel = map.getPixelFromCoordinate(coordinate); + } }); var thresholdControl = document.getElementById('threshold');