title: OpenLayers3 - is it possible to combine modify/draw/select operations?
body: <p>I've started using OpenLayers3 in my app, and so far, I have succeeded in creating working versions of:</p>
  
  <ol>
  <li>a combined draw/modify page (based on the relevant example, <code>draw-and-modify-features.js</code>)</li>
  <li>a combined select/modify page (based on the relevant example, <code>modify-features.js</code>)</li>
  </ol>
  
  <p>In the case of (1), the <code>ol.interaction.Modify</code> instance specifies that it will work on the features inside an <code>ol.FeatureOverlay</code> instance:</p>
  
  <pre><code>var modify = new ol.interaction.Modify({
      features: featureOverlay.getFeatures()
  ...
  </code></pre>
  
  <p>...and it is that <code>ol.FeatureOverlay</code> that holds all the new features drawn by the user.</p>
  
  <p>In the case of (2), the <code>ol.interaction.Modify</code> instance specifies that it will work on the features inside the <code>ol.interaction.Select</code> instance:</p>
  
  <pre><code>var select = new ol.interaction.Select();
  var modify = new ol.interaction.Modify({
      features: select.getFeatures()
  });
  </code></pre>
  
  <p>...and unless I am mistaken, this creates a hidden <code>ol.FeatureOverlay</code> that holds the currently selected feature - which is then edited.</p>
  
  <p>However, I can't see a way to combine all 3 - i.e. a user-friendly way to allow a user to draw, select and modify polygons.</p>
  
  <p>What I'd (ideally) want is the functionality of draw/modify, but the moment I hit and keep Ctrl pressed, the cursor is no longer working in "draw" mode, but in "select" mode, allowing me to select one of the existing polygons, and subsequently hiting Delete on the keyboard to delete it, or just edit its vertices with the mouse. As soon as I click outside all polygons, I return to draw/modify mode.</p>
  
  <p>I did the naive test - that of adding an <code>ol.interaction.Select</code> to the interactions of the draw/modify Map instance - which lead to hilarious results :-) For example, upon finishing the drawing of a polygon (i.e. when I double-click to close it) it's also getting selected... and clicking anywhere (inside or outside polygons) just starts another new polygon edge, it never selects a pre-existing one - etc.</p>
  
  <p>My only thought of a solution so far is... for me to implement a "VI emulation" :-)  i.e. a "command" mode (that is, the select/modify state) and an "insert" mode (i.e. the draw/modify state) - and you chose what mode you are in from a "state toggle" button inside the map (custom OL3 control) or outside the map (normal HTML button) .</p>
  
  <p>I am, however, looking for a better way, like the one I suggested with holding Ctrl...</p>
  
  <p>Any ideas/suggestions most welcome.</p>