draw square/shift

parent 76f25be1
......@@ -182,6 +182,23 @@ sidtMap.prototype.changeInteraction = function() {
this.map.addInteraction(this.interaction);
}
// this shit is really hack hahahahah
sidtMap.prototype.listenShiftButton = function() {
inDown = (evt) => {
if (evt.key != "Shift" || evt.keyCode != 16 || this.interaction.geometryFunction_.name === "r") return;
this.interaction.geometryFunction_ = new ol.interaction.Draw.createRegularPolygon(4);
}
inUp = (evt) => {
if (evt.key != "Shift" || evt.keyCode != 16 || this.interaction.geometryFunction_.name === "r") return;
this.interaction.geometryFunction_ = new ol.interaction.Draw.createRegularPolygon(4, Math.PI/4);
};
document.addEventListener('keydown', inDown);
document.addEventListener('keyup', inUp);
}
//------------------------------------------------------------------------------
sidtMap.prototype.onMousemove = function(e)
{
......
......@@ -380,6 +380,7 @@
var osmap = new sidtMap("map", -89.63873079999999, 21.0404457, 7);
osmap.geolocation();
osmap.addInteraction();
osmap.listenShiftButton();
var req_url = "{% url 'search-submit' %}"; // url for requesting polygon data
var prod_req_url = "{% url 'productList' %}"; // url for requesting product data
......
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