fix regression that caused 'L_PREFER_CANVAS undefined' error

This commit is contained in:
Mourner 2011-06-22 17:17:22 +03:00
parent 6163fd755c
commit 8cdb7069e1
2 changed files with 2 additions and 2 deletions

2
dist/leaflet.js vendored
View File

@ -71,7 +71,7 @@ L.Path=L.Browser.svg||!L.Browser.vml?L.Path:L.Path.extend({statics:{VML:!0,CLIP_
"leaflet-vml-container",this._map._panes.overlayPane.appendChild(this._map._pathRoot),this._map.on("moveend",this._updateViewport,this),this._updateViewport()},_initPath:function(){this._container=this._createElement("shape");this._container.className+=" leaflet-vml-shape"+(this.options.clickable?" leaflet-clickable":"");this._container.coordsize="1 1";this._path=this._createElement("path");this._container.appendChild(this._path);this._map._pathRoot.appendChild(this._container)},_initStyle:function(){this.options.stroke?
(this._stroke=this._createElement("stroke"),this._stroke.endcap="round",this._container.appendChild(this._stroke)):this._container.stroked=!1;this.options.fill?(this._container.filled=!0,this._fill=this._createElement("fill"),this._container.appendChild(this._fill)):this._container.filled=!1;this._updateStyle()},_updateStyle:function(){if(this.options.stroke)this._stroke.weight=this.options.weight+"px",this._stroke.color=this.options.color,this._stroke.opacity=this.options.opacity;if(this.options.fill)this._fill.color=
this.options.fillColor||this.options.color,this._fill.opacity=this.options.fillOpacity},_updatePath:function(){this._container.style.display="none";this._path.v=this.getPathString()+" ";this._container.style.display=""}});L.Browser.canvas=function(){return!!document.createElement("canvas").getContext}();
L.Path=L.Path.SVG&&!L_PREFER_CANVAS||!L.Browser.canvas?L.Path:L.Path.extend({statics:{CANVAS:!0,SVG:!1},options:{updateOnMoveEnd:!0},_initElements:function(){this._initRoot()},_initRoot:function(){var a=this._map._pathRoot;if(!a)a=this._map._pathRoot=document.createElement("canvas"),this._map._panes.overlayPane.appendChild(a),this._map.on("moveend",this._updateCanvasViewport,this),this._updateCanvasViewport();this._ctx=a.getContext("2d")},_updateStyle:function(){this._ctx.lineCap="round";this._ctx.lineJoin=
L.Path=L.Path.SVG&&!window.L_PREFER_CANVAS||!L.Browser.canvas?L.Path:L.Path.extend({statics:{CANVAS:!0,SVG:!1},options:{updateOnMoveEnd:!0},_initElements:function(){this._initRoot()},_initRoot:function(){var a=this._map._pathRoot;if(!a)a=this._map._pathRoot=document.createElement("canvas"),this._map._panes.overlayPane.appendChild(a),this._map.on("moveend",this._updateCanvasViewport,this),this._updateCanvasViewport();this._ctx=a.getContext("2d")},_updateStyle:function(){this._ctx.lineCap="round";this._ctx.lineJoin=
"round";if(this.options.stroke)this._ctx.lineWidth=this.options.weight,this._ctx.strokeStyle=this.options.color;if(this.options.fill)this._ctx.fillStyle=this.options.fillColor||this.options.color},_drawPath:function(){var a,b,c,d,e,f;this._ctx.beginPath();a=0;for(c=this._parts.length;a<c;a++){b=0;for(d=this._parts[a].length;b<d;b++)e=this._parts[a][b],f=(b===0?"move":"line")+"To",this._ctx[f](e.x,e.y);this instanceof L.Polygon&&this._ctx.closePath()}},_updatePath:function(){this._drawPath();this._updateStyle();
if(this.options.fill)this._ctx.globalAlpha=this.options.fillOpacity,this._ctx.fill();if(this.options.stroke)this._ctx.globalAlpha=this.options.opacity,this._ctx.stroke()},_updateCanvasViewport:function(){this._updateViewport();var a=this._map._pathViewport,b=a.min,a=a.max.subtract(b),c=this._map._pathRoot;L.DomUtil.setPosition(c,b);c.width=a.x;c.height=a.y;c.getContext("2d").translate(-b.x,-b.y)},_initEvents:function(){if(this.options.clickable)this._map.on("click",this._onClick,this)},_onClick:function(a){this._containsPoint(a.layerPoint)&&
this.fire("click",a)}});L.Polyline=L.Path.extend({initialize:function(a,b){L.Path.prototype.initialize.call(this,b);this._latlngs=a},options:{smoothFactor:1,noClip:!1,updateOnMoveEnd:!0},projectLatlngs:function(){this._originalPoints=[];for(var a=0,b=this._latlngs.length;a<b;a++)this._originalPoints[a]=this._map.latLngToLayerPoint(this._latlngs[a])},getPathString:function(){for(var a=0,b=this._parts.length,c="";a<b;a++)c+=this._getPathPartStr(this._parts[a]);return c},getLatLngs:function(){return this._latlngs},setLatLngs:function(a){this._latlngs=

View File

@ -6,7 +6,7 @@ L.Browser.canvas = (function() {
return !!document.createElement('canvas').getContext;
})();
L.Path = (L.Path.SVG && !L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path : L.Path.extend({
L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path : L.Path.extend({
statics: {
//CLIP_PADDING: 0.02, // not sure if there's a need to set it to a small value
CANVAS: true,