Commit 8fc51340 authored by Eric Duminil's avatar Eric Duminil
Browse files

RegionChooser: Replace reset button with Backspace or Delete.

parent bcb08e02
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>Simstadt Region Chooser</title>
<meta name="keywords" content="polygon,creator,google map,v3,draw,paint">
......@@ -31,7 +31,6 @@
<div id="side">
<div id="dataPanel"></div>
</div>
<input id="reset" value="Reset" type="button" class="navi" disabled />
<script src="script/simstadt_openlayers.js" type="text/javascript"></script>
</body>
</html>
......@@ -11,7 +11,6 @@ proj4.defs("EPSG:28992", "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.3876388
var regionChooser = (function(){
var publicScope = {};
var fromJavaFX = navigator.userAgent.indexOf('JavaFX') !== -1;
var reset_btn = $('#reset')[0];
var dataPanel = $('#dataPanel');
var wgs84Sphere = new ol.Sphere(6378137);
......@@ -173,7 +172,6 @@ var regionChooser = (function(){
draw.on('drawstart', function(evt) {
sketch = evt.feature;
reset_btn.disabled = false;
updateGMLPolygons();
});
var sourceProj = map.getView().getProjection();
......@@ -290,8 +288,17 @@ var regionChooser = (function(){
displayInfo();
draw.setActive(false);
});
// Pressing ESCAPE or DELETE resets the drawing.
// With OpenLayers 3.9, draw_interaction.removeLastPoint(); might be better.
document.addEventListener('keydown', function(e) {
if (e.which == 27 || e.which == 46){
resetDrawing();
}
});
$('#reset').click(function() {
function resetDrawing(){
console.log("Reset drawing");
try {
draw.finishDrawing();
} finally {
......@@ -300,10 +307,9 @@ var regionChooser = (function(){
draw.setActive(true);
featureOverlay.getFeatures().clear();
intersections.clear();
reset_btn.disabled = true;
focusOnMap();
}
});
}
novafactory_layer.downloadFinished = function() {
// FIXME: Weird <br>s are inserted between lines
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment