dynmeth / RaphaelLayer

Raphael overlay for Leaflet maps
MIT License
80 stars 25 forks source link

Path #4

Closed SerikDM closed 11 years ago

SerikDM commented 11 years ago

I tried to make 'path' with this library. I had strings like 'M0,0L10,10,L10,0Z' and other kinds of curves with with C in strings. https://github.com/CloudMade/Leaflet/issues/1029 In that issue more information with code I added into libraries. But It still don't works well. If I put Marker in [0,0] it's right in position with Lat/Lon as [0,0]. But if I make 'path' with start at [0,0] it's in another position with Point[0,0] instead Lat/Lon. Also it doesn't change it's position if I zoom map as it R.Marker does.

got a decision by adding:

var r = Raphael.pathBBox(this._pathString);
var p = this._map.latLngToLayerPoint([r.x+r.width/2,r.y+r.height/2]);
var curZoom = 1/Math.pow(2,map.getMaxZoom() - map.getZoom());

and:

.transform('t'+p.x+','+p.y+'s'+curZoom+','+curZoom+',0,0')