{"id":16875522,"url":"https://github.com/ghybs/leaflet.markercluster.freezable","last_synced_at":"2025-03-22T07:31:46.401Z","repository":{"id":71657618,"uuid":"47114649","full_name":"ghybs/Leaflet.MarkerCluster.Freezable","owner":"ghybs","description":"Adds ability to freeze clusters at specified zoom","archived":false,"fork":false,"pushed_at":"2018-02-06T12:58:31.000Z","size":67,"stargazers_count":29,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-29T00:20:56.261Z","etag":null,"topics":["freezing","javascript","leaflet","leaflet-plugins","markercluster"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghybs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-30T11:39:35.000Z","updated_at":"2024-06-18T22:32:50.295Z","dependencies_parsed_at":null,"dependency_job_id":"e2edc1fd-1986-47d3-8cac-59e7cdcd4f73","html_url":"https://github.com/ghybs/Leaflet.MarkerCluster.Freezable","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghybs%2FLeaflet.MarkerCluster.Freezable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghybs%2FLeaflet.MarkerCluster.Freezable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghybs%2FLeaflet.MarkerCluster.Freezable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghybs%2FLeaflet.MarkerCluster.Freezable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghybs","download_url":"https://codeload.github.com/ghybs/Leaflet.MarkerCluster.Freezable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244189790,"owners_count":20412991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["freezing","javascript","leaflet","leaflet-plugins","markercluster"],"created_at":"2024-10-13T15:36:18.772Z","updated_at":"2025-03-22T07:31:46.035Z","avatar_url":"https://github.com/ghybs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- ##########################################################################\nNOTE TO CONTRIBUTOR:\nthis README is automatically generated from build/readme.template.md.\nShould you need to modify the README, please make your modifications on\nthe template file.\n########################################################################### --\u003e\n\n# Leaflet.MarkerCluster.Freezable\nSub-plugin for [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster)\nplugin (MCG in short); adds the ability to freeze clusters at a specified zoom.\n\n[Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster) plugin\nprovides beautiful animated Marker Clustering functionality.\n\n[Leaflet](http://leafletjs.com/) is the leading open-source JavaScript library\nfor mobile-friendly interactive maps.\n\n[![GitHub releases](https://img.shields.io/github/release/ghybs/leaflet.markercluster.freezable.svg?label=GitHub)](https://github.com/ghybs/Leaflet.MarkerCluster.Freezable/releases)\n[![npm](https://img.shields.io/npm/v/leaflet.markercluster.freezable.svg)](https://www.npmjs.com/package/leaflet.markercluster.freezable)\n\n\n\n## Requirements\nThis plugin is compatible with the following combinations:\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003cth\u003eLeaflet\u003c/th\u003e\n\t\t\u003cth\u003eLeaflet.markercluster\u003c/th\u003e\n\t\t\u003cth\u003eLeaflet.MarkerCluster.Freezable\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd rowspan=\"2\"\u003e\n\t\t    1.0.0\u0026nbsp;→\u0026nbsp;1.3.1\n\t\t\u003c/td\u003e\n\t\t\u003ctd\u003e\n\t\t    1.0.4\u0026nbsp;→\u0026nbsp;1.3.0\n\t\t\u003c/td\u003e\n\t\t\u003ctd\u003e\n\t\t    \u003ca href=\"https://github.com/ghybs/Leaflet.MarkerCluster.Freezable/releases/tag/v1.0.0\"\u003e1.0.0\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003c!--td\u003e(\"eaten\" by above rowspan)\u003c/td--\u003e\n\t\t\u003ctd\u003e\n\t\t    1.0.0\u0026nbsp;→\u0026nbsp;1.0.3\n\t\t\u003c/td\u003e\n\t\t\u003ctd rowspan=\"2\"\u003e\n\t\t    \u003ca href=\"https://github.com/ghybs/Leaflet.MarkerCluster.Freezable/releases/tag/v0.1.1\"\u003e0.1.1\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\n\t\t    0.7.7\n\t\t\u003c/td\u003e\n\t\t\u003ctd\u003e\n\t\t    0.5.0\n\t\t\u003c/td\u003e\n\t\t\u003c!--td\u003e(\"eaten\" by above rowspan)\u003c/td--\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n\n\n## Demos\n- [Leaflet.MarkerCluster.Freezable 1.0.0 (Leaflet 1.3.1 + Leaflet.markercluster 1.3.0)](https://ghybs.github.io/Leaflet.MarkerCluster.Freezable/examples/mcg-freezable.html?leaflet=1.3.1\u0026leaflet.markercluster=1.3.0\u0026leaflet.markercluster.freezable=1.0.0)\n- [Leaflet.MarkerCluster.Freezable 0.1.1 (Leaflet 1.3.1 + Leaflet.markercluster 1.0.3)](https://ghybs.github.io/Leaflet.MarkerCluster.Freezable/examples/mcg-freezable.html?leaflet=1.3.1\u0026leaflet.markercluster=1.0.3\u0026leaflet.markercluster.freezable=0.1.1)\n- [Leaflet.MarkerCluster.Freezable 0.1.1 (Leaflet 0.7.7 + Leaflet.markercluster 0.5.0)](https://ghybs.github.io/Leaflet.MarkerCluster.Freezable/examples/mcg-freezable.html?leaflet=0.7.7\u0026leaflet.markercluster=0.5.0\u0026leaflet.markercluster.freezable=0.1.1)\n\n\n## Usage instructions\n\n### Quick Guide\n**HTML:**\n```html\n\u003c!-- After Leaflet and Leaflet.markercluster scripts --\u003e\n\u003cscript src=\"leaflet.markercluster.freezable.js\"\u003e\u003c/script\u003e\n```\n\n**JavaScript:**\n```javascript\nvar map = L.map(\"map\"),\n    mcg = L.markerClusterGroup(options);\n    \nmcg.addLayers(arrayOfMarkers);\nmcg.addTo(map);\n\nmcg.freezeAtZoom(15);\nmcg.freezeAtZoom(\"maxKeepSpiderfy\");\nmcg.freezeAtZoom(\"max\");\nmcg.unfreeze(); // shortcut for mcg.freezeAtZoom(false)\n\nmcg.disableClusteringKeepSpiderfy(); // shortcut for mcg.freezeAtZoom(\"maxKeepSpiderfy\")\nmcg.disableClustering(); // shortcut for mcg.freezeAtZoom(\"max\")\nmcg.enableClustering(); // alias for mcg.unfreeze()\n```\n\nWhen frozen / disabled, clusters will no longer split / merge on map zoom, but\nretain their status as if they were on the specified zoom level. They will\ndirectly spiderfy when clicked on, instead of zooming to bounds (since zooming\nwill not make them split apart).\n\nIn particular, freezing at `maxZoom + 1` removes all clusters.\n\nFreezing at `maxZoom` removes all clusters except the bottom-most ones, so that\nuser can still spiderfy closely positioned markers.\n\n**CAUTION: make sure your operations makes sense before freezing to high zoom\nwhereas the map is at a low zoom. It may have to load _thousands_ of markers\nsuddenly!**\n\n_Note: while frozen, MCG will continue removing clusters and markers which are\nfar from the view port, accordingly with `removeOutsideVisibleBounds` option._\n\n\n\n### Installing the sub-plugin\n\n#### Local copy\n1. Download the \"\u003ca href=\"https://github.com/ghybs/Leaflet.MarkerCluster.Freezable/releases/download/v1.0.0/leaflet.markercluster.freezable.js\"\u003e`leaflet.markercluster.freezable.js`\u003c/a\u003e\" file from the [`v1.0.0` release](https://github.com/ghybs/Leaflet.MarkerCluster.Freezable/releases/tag/v1.0.0).\n2. Place the file alongside your page.\n3. Add the `script` tag (see [Quick Guide \u003e HTML](#quick-guide)) to your page after Leaflet and Leaflet.markercluster scripts.\n\n#### CDN\nYou can alternatively use the free [unpkg](https://unpkg.com) CDN service, but keep in mind that it \"[_is a free, best-effort service and cannot provide any uptime or support guarantees_](https://unpkg.com/#/about)\".\n\n```html\n\u003c!-- After Leaflet script --\u003e\n\u003cscript src=\"https://unpkg.com/leaflet.markercluster.freezable@1.0.0/dist/leaflet.markercluster.freezable.js\"\u003e\u003c/script\u003e\n```\nOr with [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity):\n```html\n\u003cscript\n    src=\"https://unpkg.com/leaflet.markercluster.freezable@1.0.0/dist/leaflet.markercluster.freezable.js\"\n    integrity=\"sha384-QXTyM8sAAM5XAUeRoyzNadlfH7KuYt0C6i9O/T2vFb4wGIKwL9Ak++3y3JBqfGyg\"\n    crossorigin=\"anonymous\"\n\u003e\u003c/script\u003e\n```\n\n#### npm\n1. Add this package to your project:\n   ```bash\n   $ npm install leaflet.markercluster.freezable --save\n   ```\n\n2. If you are using a bundling tool, import in your JavaScript.\nIt only performs the side effect of adding new methods to `L.markerClusterGroup`,\nso you do not need to store it into a local variable or import a namespace.\n   ```javascript\n   require('leaflet.markercluster.freezable');\n   // Or with ES6:\n   import 'leaflet.markercluster.freezable';\n   ```\n\n\n\n### Creation\nSimply use the the regular `L.markerClusterGroup` factory, as Freezable plugin\ndirectly adds new methods to Leaflet.markercluster:\n\n```javascript\nvar mcg = L.markerClusterGroup(options);\n\nmcg.addTo(map);\n```\n\n\n\n## API Reference\n\n### Methods\n| Method  | Returns  | Description |\n| :------ | :------- | :---------- |\n| **freezeAtZoom**( `\u003cNumber\u003e` or `\u003cString\u003e` or `\u003cBoolean\u003e` frozenZoom? ) | `this` | Freezes clusters at specified zoom, current zoom, or unfreeze. If passed a positive number (including 0), freezes at that zoom. If passed `\"max\"` (string), freezes at `maxZoom + 1`. If passed `\"maxKeepSpiderfy\"` (string), freezes at `maxZoom`. If passed nothing, `undefined`, `true` (boolean) or `NaN`, freezes at current zoom. If passed `false` (boolean) or any other non-number, unfreezes. |\n| **unfreeze**() | `this` | Shortcut for `freezeAtZoom(false)`. |\n| **disableClustering**() | `this` | Shortcut for `freezeAtZoom(\"max\")`. |\n| **disableClusteringKeepSpiderfy**() | `this` | Shortcut for `freezeAtZoom(\"maxKeepSpiderfy\")`. |\n| **enableClustering**() | `this` | Shortcut for `unfreeze()`. |\n\nMCG.Freezable does not provide any extra option or event.\n\n\n### Regular MCG options, events and methods\nAll regular MCG [options](https://github.com/Leaflet/Leaflet.markercluster#all-options),\n[events](https://github.com/Leaflet/Leaflet.markercluster#events) and\n[methods](https://github.com/Leaflet/Leaflet.markercluster#methods) are\navailable within MCG Layer Support. Refer to Leaflet.markercluster documentation.\n\n\n\n## Limitations\n\n### Freezing at current zoom while not on map\nIf you request MCG to freeze at current zoom, but MCG is not on any map at that\nmoment, it will freeze at the zoom the map is at when added to it.\n\n## License\n[![license](https://img.shields.io/github/license/ghybs/leaflet.markercluster.freezable.svg)](LICENSE)\n\nLeaflet.MarkerCluster.Freezable is distributed under the\n[MIT License](http://choosealicense.com/licenses/mit/) (Expat type), like\nLeaflet.markercluster.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghybs%2Fleaflet.markercluster.freezable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghybs%2Fleaflet.markercluster.freezable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghybs%2Fleaflet.markercluster.freezable/lists"}