From 1e0d2af0f0aac7f87420cbd40e725669af6b87de Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 27 Mar 2014 11:01:12 -0600 Subject: [PATCH 1/3] Add a style for selected features --- examples/modify-features.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/examples/modify-features.js b/examples/modify-features.js index ff26883ca4..3b4fd9627a 100644 --- a/examples/modify-features.js +++ b/examples/modify-features.js @@ -8,6 +8,9 @@ goog.require('ol.layer.Tile'); goog.require('ol.layer.Vector'); goog.require('ol.source.GeoJSON'); goog.require('ol.source.MapQuest'); +goog.require('ol.style.Fill'); +goog.require('ol.style.Stroke'); +goog.require('ol.style.Style'); var raster = new ol.layer.Tile({ @@ -26,7 +29,17 @@ var vector = new ol.layer.Vector({ source: source }); -var select = new ol.interaction.Select({}); +var select = new ol.interaction.Select({ + style: new ol.style.Style({ + stroke: new ol.style.Stroke({ + color: '#3399CC', + width: 2.5 + }), + fill: new ol.style.Fill({ + color: 'rgba(255,255,255,0.6)' + }) + }) +}); var modify = new ol.interaction.Modify({ features: select.getFeatures() From 02a7913c0f8ca400c563d4dd6e874d2dc0ad4884 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 27 Mar 2014 11:07:06 -0600 Subject: [PATCH 2/3] Add condition for selection --- examples/modify-features.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/modify-features.js b/examples/modify-features.js index 3b4fd9627a..832573b934 100644 --- a/examples/modify-features.js +++ b/examples/modify-features.js @@ -1,6 +1,7 @@ goog.require('ol.Collection'); goog.require('ol.Map'); goog.require('ol.View2D'); +goog.require('ol.events.condition'); goog.require('ol.interaction'); goog.require('ol.interaction.Modify'); goog.require('ol.interaction.Select'); @@ -30,6 +31,7 @@ var vector = new ol.layer.Vector({ }); var select = new ol.interaction.Select({ + addCondition: ol.events.condition.shiftKeyOnly, style: new ol.style.Style({ stroke: new ol.style.Stroke({ color: '#3399CC', From 2da07f883712a541fecea9f5a791624be39ebb4c Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 27 Mar 2014 11:26:17 -0600 Subject: [PATCH 3/3] Always toggle selection --- examples/modify-features.js | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/modify-features.js b/examples/modify-features.js index 832573b934..de41143e24 100644 --- a/examples/modify-features.js +++ b/examples/modify-features.js @@ -32,6 +32,7 @@ var vector = new ol.layer.Vector({ var select = new ol.interaction.Select({ addCondition: ol.events.condition.shiftKeyOnly, + toggleCondition: ol.events.condition.always, style: new ol.style.Style({ stroke: new ol.style.Stroke({ color: '#3399CC',