1/** 2 * @file Plugin for Leaflet.js to make a marker bounce when added to a map. 3 * @author Max Hadjinlian <[email protected]> 4 * @copyright 2013-2025 5 * @license MIT 6 * @example <caption>All examples will assume a Leaflet map object</caption> 7 * import { Map, TileLayer } from 'leaflet'; 8 * const map = new Map('map'); 9 * new TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 10 * attribution: 'Map data © <a href="http://www.osm.org">OpenStreetMap</a>' 11 * }).addTo(map); 12 */ 13!function e(){if(!window.L)return void setTimeout(e,100);const a=window.L,n=a.Marker;if(a.LatLng,a.Point,!n)return void console.error("Leaflet Marker class not found.","Make sure Leaflet is loaded before this plugin.");!function(){if(document.getElementById("leaflet-bouncemarker-styles"))return;const e=document.createElement("style");e.id="leaflet-bouncemarker-styles",e.textContent="\n/* Bounce animation keyframes */\n@keyframes leaflet-marker-bounce {\n 0.00% { transform: translate3d(0, calc(var(--bounce-height) * -1.0000), 0); }\n 10.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.9244), 0); }\n 20.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.6975), 0); }\n 30.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.3194), 0); }\n 36.36% { transform: translate3d(0, calc(var(--bounce-height) * -0.0002), 0); }\n 40.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.0900), 0); }\n 50.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.2344), 0); }\n 60.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.2275), 0); }\n 70.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.0694), 0); }\n 72.72% { transform: translate3d(0, calc(var(--bounce-height) * -0.0002), 0); }\n 80.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.0600), 0); }\n 85.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.0548), 0); }\n 90.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.0119), 0); }\n 90.90% { transform: translate3d(0, calc(var(--bounce-height) * -0.0001), 0); }\n 95.00% { transform: translate3d(0, calc(var(--bounce-height) * -0.0155), 0); }\n 100.00% { transform: translate3d(0, 0, 0); }\n}\n\n/* Shadow animation keyframes - scale/opacity follows bounce curve */\n@keyframes leaflet-marker-shadow-scale {\n 0.00% { transform: scale(0.30); opacity: 0.20; }\n 10.00% { transform: scale(0.35); opacity: 0.25; }\n 20.00% { transform: scale(0.51); opacity: 0.41; }\n 30.00% { transform: scale(0.78); opacity: 0.68; }\n 36.36% { transform: scale(1.00); opacity: 0.90; }\n 40.00% { transform: scale(0.94); opacity: 0.84; }\n 50.00% { transform: scale(0.84); opacity: 0.74; }\n 60.00% { transform: scale(0.84); opacity: 0.74; }\n 70.00% { transform: scale(0.95); opacity: 0.85; }\n 72.72% { transform: scale(1.00); opacity: 0.90; }\n 80.00% { transform: scale(0.96); opacity: 0.86; }\n 85.00% { transform: scale(0.96); opacity: 0.86; }\n 90.00% { transform: scale(0.99); opacity: 0.89; }\n 90.90% { transform: scale(1.00); opacity: 0.90; }\n 95.00% { transform: scale(0.99); opacity: 0.89; }\n 100.00% { transform: scale(1.00); opacity: 0.90; }\n}\n\n/* Shadow slide animation - follows marker height curve (not linear!) */\n@keyframes leaflet-marker-shadow-slide {\n 0.00% { transform: translate(calc(var(--bounce-height) * 1.0000 * 0.48), calc(var(--bounce-height) * 1.0000 * -1.64)); }\n 10.00% { transform: translate(calc(var(--bounce-height) * 0.9244 * 0.48), calc(var(--bounce-height) * 0.9244 * -1.64)); }\n 20.00% { transform: translate(calc(var(--bounce-height) * 0.6975 * 0.48), calc(var(--bounce-height) * 0.6975 * -1.64)); }\n 30.00% { transform: translate(calc(var(--bounce-height) * 0.3194 * 0.48), calc(var(--bounce-height) * 0.3194 * -1.64)); }\n 36.36% { transform: translate(calc(var(--bounce-height) * 0.0002 * 0.48), calc(var(--bounce-height) * 0.0002 * -1.64)); }\n 40.00% { transform: translate(calc(var(--bounce-height) * 0.0900 * 0.48), calc(var(--bounce-height) * 0.0900 * -1.64)); }\n 50.00% { transform: translate(calc(var(--bounce-height) * 0.2344 * 0.48), calc(var(--bounce-height) * 0.2344 * -1.64)); }\n 60.00% { transform: translate(calc(var(--bounce-height) * 0.2275 * 0.48), calc(var(--bounce-height) * 0.2275 * -1.64)); }\n 70.00% { transform: translate(calc(var(--bounce-height) * 0.0694 * 0.48), calc(var(--bounce-height) * 0.0694 * -1.64)); }\n 72.72% { transform: translate(calc(var(--bounce-height) * 0.0002 * 0.48), calc(var(--bounce-height) * 0.0002 * -1.64)); }\n 80.00% { transform: translate(calc(var(--bounce-height) * 0.0600 * 0.48), calc(var(--bounce-height) * 0.0600 * -1.64)); }\n 85.00% { transform: translate(calc(var(--bounce-height) * 0.0548 * 0.48), calc(var(--bounce-height) * 0.0548 * -1.64)); }\n 90.00% { transform: translate(calc(var(--bounce-height) * 0.0119 * 0.48), calc(var(--bounce-height) * 0.0119 * -1.64)); }\n 90.90% { transform: translate(calc(var(--bounce-height) * 0.0001 * 0.48), calc(var(--bounce-height) * 0.0001 * -1.64)); }\n 95.00% { transform: translate(calc(var(--bounce-height) * 0.0155 * 0.48), calc(var(--bounce-height) * 0.0155 * -1.64)); }\n 100.00% { transform: translate(calc(var(--bounce-height) * 0.0000 * 0.48), calc(var(--bounce-height) * 0.0000 * -1.64)); }\n}\n\n/* Bounce container wrapping icon and shadow */\n.leaflet-marker-bounce-container {\n position: absolute;\n}
13\n\n.leaflet-marker-shadow-position-container {\n position: absolute;\n}\n\n.leaflet-marker-shadow-scale-container {\n position: absolute;\n}\n\n.leaflet-marker-shadow-slide-container {\n position: absolute;\n}\n\n/* Scale/opacity animation on shadow middle wrapper */\n.leaflet-marker-shadow-scale-container.leaflet-marker-shadow-scale-bouncing {\n transform-origin: top right;\n animation: leaflet-marker-shadow-scale var(--bounce-duration) linear;\n animation-delay: var(--bounce-delay, 0ms);\n animation-iteration-count: var(--bounce-loops, 1);\n animation-fill-mode: both;\n}\n\n/* Slide animation on shadow inner wrapper - follows marker height */\n.leaflet-marker-shadow-slide-container.leaflet-marker-shadow-slide-bouncing {\n animation: leaflet-marker-shadow-slide var(--bounce-duration) linear;\n animation-delay: var(--bounce-delay, 0ms);\n animation-iteration-count: var(--bounce-loops, 1);\n animation-fill-mode: both;\n}\n\n/* Bouncing marker icon */\n.leaflet-marker-icon.leaflet-marker-bouncing {\n animation: leaflet-marker-bounce var(--bounce-duration) ease-out;\n animation-delay: var(--bounce-delay, 0ms);\n animation-iteration-count: var(--bounce-loops, 1);\n animation-fill-mode: both;\n}\n",document.head.appendChild(e)}();const t=n.prototype.onAdd,o=n.prototype.onRemove;n.mergeOptions({bounceOnAdd:!1,bounceOnAddOptions:{duration:1e3,height:-1,loop:1},bounceOnAddCallback:function(){}}),Object.assign(n.prototype,{_startCSSBounce:function(e,a){const n=this._icon;if(!n)return;const t=this._getDropHeight(e.height);if(n.style.setProperty("--bounce-height",t+"px"),n.style.setProperty("--bounce-duration",(e.duration||1e3)+"ms"),n.style.setProperty("--bounce-delay",(e.delay||0)+"ms"),n.style.setProperty("--bounce-loops",e.loop||1),n.classList&&n.classList.contains("leaflet-marker-bounce-container"))this._iconElement=n.querySelector(".leaflet-marker-icon");else{const e=document.createElement("div");e.className="leaflet-marker-bounce-container",e.style.position="absolute",e.style.transform=n.style.transform,e.style.zIndex=n.style.zIndex,n.parentNode.replaceChild(e,n),e.appendChild(n),n.style.transform="",this._iconElement=n,this._icon=e,this._bounceContainer=e}if(this._shadow){const a=this._shadowElement||this._shadow;let n=a.parentNode;if(n.classList&&n.classList.contains("leaflet-marker-shadow-scale-container"))this._shadowScaleContainer=n;else{const e=document.createElement("div");e.className="leaflet-marker-shadow-scale-container",e.style.position="absolute",e.style.transformOrigin="top right",a.parentNode.replaceChild(e,a),e.appendChild(a),n=e,this._shadowScaleContainer=e}let o=n.parentNode;if(o.classList&&o.classList.contains("leaflet-marker-shadow-slide-container"))this._shadowSlideContainer=o;else{const e=document.createElement("div");e.className="leaflet-marker-shadow-slide-container",e.style.position="absolute",n.parentNode.replaceChild(e,n),e.appendChild(n),o=e,this._shadowSlideContainer=e}let r=o.parentNode;if(r.classList&&r.classList.contains("leaflet-marker-shadow-position-container"))this._shadowPositionContainer=r;else{const e=document.createElement("div");e.className="leaflet-marker-shadow-position-container",e.style.position="absolute",e.style.transform=a.style.transform,o.parentNode.replaceChild(e,o),e.appendChild(o),a.style.transform="",this._shadowPositionContainer=e}this._shadowElement=a,this._shadow=this._shadowPositionContainer;const s=(e.duration||1e3)+"ms",i=(e.delay||0)+"ms",c=e.loop||1;this._shadowSlideContainer.style.setProperty("--bounce-duration",s),this._shadowSlideContainer.style.setProperty("--bounce-delay",i),this._shadowSlideContainer.style.setProperty("--bounce-loops",c),this._shadowSlideContainer.style.setProperty("--bounce-height",t+"px"),this._shadowSlideContainer.classList.add("leaflet-marker-shadow-slide-bouncing"),this._shadowScaleContainer.style.setProperty("--bounce-duration",s),this._shadowScaleContainer.style.setProperty("--bounce-delay",i),this._shadowScaleContainer.style.setProperty("--bounce-loops",c),this._shadowScaleContainer.classList.add("leaflet-marker-shadow-scale-bouncing")}(this._iconElement||n).classList.add("leaflet-marker-bouncing"),this._map&&this.update(),this._bounceCallback=a;const o=e.duration||1e3,r=e.delay||0,s=o*(e.loop||1)+r;this._bounceTimeoutId=setTimeout(()=>{this._endCSSBounce()},s)},_endCSSBounce:function(){const e=this._iconElement||this._icon;e&&(e.classList.remove("leaflet-marker-bouncing"),e.style.removeProperty("--bounce-height"),e.style.removeProperty("--bounce-duration"),e.style.removeProperty("--bounce-delay"),e.style.removeProperty("--bounce-loops")),this._shadowScaleContainer&&(this._shadowScaleContainer.classList.remove("leaflet-marker-shadow-scale-bouncing"),this._shadowScaleContainer.style.removeProperty("--bounce-duration"),this._shadowScaleContainer.style.removeProperty("--bounce-delay"),this._shadowScaleContainer.style.removeProperty("--bounce-loops")),this._shadowSlideContainer&&(this._shadowSlideContainer.classList.remove("leaflet-marker-shadow-sli
13de-bouncing"),this._shadowSlideContainer.style.removeProperty("--bounce-duration"),this._shadowSlideContainer.style.removeProperty("--bounce-delay"),this._shadowSlideContainer.style.removeProperty("--bounce-loops"),this._shadowSlideContainer.style.removeProperty("--bounce-height")),this._bounceTimeoutId&&(clearTimeout(this._bounceTimeoutId),this._bounceTimeoutId=null),"function"==typeof this._bounceCallback&&(this._bounceCallback(),this._bounceCallback=null)},_getDropHeight:function(e){return void 0===e||e<0?this._map.getSize().y/2:e},bounce:function(e,a){"function"==typeof e&&(a=e,e=null),e=e||{duration:1e3,height:-1,loop:1},this._startCSSBounce(e,a)},stopBounce:function(){this._endCSSBounce()},onAdd:function(e){this._map=e,t.call(this,e),!0===this.options.bounceOnAdd&&this.bounce(this.options.bounceOnAddOptions,this.options.bounceOnAddCallback)},onRemove:function(e){this.stopBounce(),o.call(this,e)}})}();
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.