<p>Resolves <a href="https://github.com/openstreetmap/openstreetmap-website/issues/629" class="issue-link" title="When the data layer is turned on and an item is clicked on, the map recentres, losing the context.">#629</a> <a href="https://github.com/openstreetmap/openstreetmap-website/issues/643" class="issue-link" title="Don't zoom in when clicking on a note.">#643</a>, improves <a href="https://github.com/openstreetmap/openstreetmap-website/pull/644" class="issue-link" title="Don't zoom in when clicking a note">#644</a>.</p>

<p>Only centers and/or zooms when clicking a note or data on a new page load (such as directly visiting /note/xx) or if the data doesn't completely fit inside the map view. Otherwise the map view doesn't move and the item is simply highlighted.</p>

<hr>

<h4>You can merge this Pull Request by running</h4>
<pre>  git pull https://github.com/aaronlidman/openstreetmap-website master</pre>
<p>Or view, comment on, or merge it at:</p>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/646'>https://github.com/openstreetmap/openstreetmap-website/pull/646</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Refine zooming and panning for note and data layers</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/646/files#diff-0">app/assets/javascripts/index.js</a>
    (14)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/646/files#diff-1">app/assets/javascripts/index/history.js</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/646/files#diff-2">app/assets/javascripts/index/note.js.erb</a>
    (34)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/646/files#diff-3">app/assets/javascripts/leaflet.map.js.erb</a>
    (11)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/646.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/646.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/646.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/646.diff</a></li>
</ul>