Leaflet.Control.Custom icon indicating copy to clipboard operation
Leaflet.Control.Custom copied to clipboard

Too few positions

Open nordmograph opened this issue 6 years ago • 1 comments

Not a so called issue. But this plugin lacks positions. At least

topcenter center bottomcenter left right

nordmograph avatar Jun 06 '19 08:06 nordmograph

Not a so called issue. But this plugin lacks positions. At least

topcenter center bottomcenter left right

I know it's 6 years later, but for anyone else travelling this path....

The positions quoted are part of the underlying L.Control object. There are ways of extending these to include, for example, the 'center' positions you're asking for. I use this code (also needs some CSS, see the linked answer)

// Create additional Control placeholders
function addControlPlaceholders(map) {
  var corners = map._controlCorners,
      l = 'leaflet-',
      container = map._controlContainer;

  function createCorner(vSide, hSide) {
      var className = l + vSide + ' ' + l + hSide;

      corners[vSide + hSide] = L.DomUtil.create('div', className, container);
  }

  createCorner('bottom', 'center');
  createCorner('top', 'center');
}

addControlPlaceholders(map);

which is from this answer on Stackoverflow by @ghybs

peeebeee avatar Feb 13 '25 13:02 peeebeee