vendor: 2,030 bytes, lines 1-57
1(function() { 2 // save these original methods before they are overwritten 3 var proto_initIcon = L.Marker.prototype._initIcon; 4 var proto_setPos = L.Marker.prototype._setPos; 5 6 var oldIE = (L.DomUtil.TRANSFORM === 'msTransform'); 7 8 L.Marker.addInitHook(function () { 9 var iconOptions = this.options.icon && this.options.icon.options; 10 var iconAnchor = iconOptions && this.options.icon.options.iconAnchor; 11 if (iconAnchor) { 12 iconAnchor = (iconAnchor[0] + 'px ' + iconAnchor[1] + 'px'); 13 } 14 this.options.rotationOrigin = this.options.rotationOrigin || iconAnchor || 'center bottom' ; 15 this.options.rotationAngle = this.options.rotationAngle || 0; 16 17 // Ensure marker keeps rotated during dragging 18 this.on('drag', function(e) { e.target._applyRotation(); }); 19 }); 20 21 L.Marker.include({ 22 _initIcon: function() { 23 proto_initIcon.call(this); 24 }, 25 26 _setPos: function (pos) { 27 proto_setPos.call(this, pos); 28 this._applyRotation(); 29 }, 30 31 _applyRotation: function () { 32 if(this.options.rotationAngle) { 33 this._icon.style[L.DomUtil.TRANSFORM+'Origin'] = this.options.rotationOrigin; 34 35 if(oldIE) { 36 // for IE 9, use the 2D rotation 37 this._icon.style[L.DomUtil.TRANSFORM] = 'rotate(' + this.options.rotationAngle + 'deg)'; 38 } else { 39 // for modern browsers, prefer the 3D accelerated version 40 this._icon.style[L.DomUtil.TRANSFORM] += ' rotateZ(' + this.options.rotationAngle + 'deg)'; 41 } 42 } 43 }, 44 45 setRotationAngle: function(angle) { 46 this.options.rotationAngle = angle; 47 this.update(); 48 return this; 49 }, 50 51 setRotationOrigin: function(origin) { 52 this.options.rotationOrigin = origin; 53 this.update(); 54 return this; 55 } 56 }); 57})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.