Thursday, 15 April 2010

Leaflet adding an offset to marker -


I'm getting the center of the center of a book to show its label

Then, Specifying an offset while offing, from where it appears the upper and the Writer.

The thing is that I need to add offset to entryJSON.getBounds (). GetCenter () code.

Is there a way to add offsets in a booklet of the lathete object? (I can imagine something like entering JSON.getBounds (). GetCenter () Offset ([-10, -57]) but it does not work ...)

  Var marker = new l. Marker (Antision JSON Jettbonds) GetCenter (), {Opacity: 0.01}); Marker.bindLabel ('Whatever', {noHide: true, className: "info", offsets: [-10, -57]});  

Labels work with offset property pixels, a l.lat << Code> Works with objects, pixels are not what you can do using the L.Map conversion methods and change your current coordinate position to pixel position, change it And then convert back to:

  var latLng = L.latLng ([0,0]), var point = map.latLngToContainerPoint (latLng); Var newPoint = L.point ([point.x - 10, dot.ae-57]); Var newLatLng = map.containerPointToLatLng (new point);  

Example:

Reference:


No comments:

Post a Comment