-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from SpeciesFileGroup/development
Add clusters type
- Loading branch information
Showing
11 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/modules/otus/components/Panel/PanelMap/clusters/CollectionObject.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export function CollectionObject(cluster) { | ||
| return { | ||
| html: `<div class="bg-map-collection-object"><span>${cluster.getChildCount()}</span></div>`, | ||
| className: | ||
| 'leaflet-marker-icon leaflet-zoom-animated leaflet-interactive bg-map-collection-object bg-opacity-60 marker-cluster text-white', | ||
| iconSize: [40, 40] | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
src/modules/otus/components/Panel/PanelMap/clusters/Mixed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| export function Mixed(cluster) { | ||
| return { | ||
| html: ` | ||
| <div class="relative flex w-[40px] h-[40px]"> | ||
| <div class="rounded-l-full bg-map-collection-object bg-opacity-60"> | ||
| <div class="w-[15px] h-[30px] rounded-l-full bg-map-collection-object ml-[5px] mt-[5px]"></div> | ||
| </div> | ||
| <div class="rounded-r-full bg-map-type-material bg-opacity-60"> | ||
| <div class="w-[15px] h-[30px] rounded-r-full bg-map-type-material mr-[5px] mt-[5px]"></div> | ||
| </div> | ||
| <span class="absolute text-xs top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-white"> | ||
| ${cluster.getChildCount()} | ||
| </span> | ||
| </div>`, | ||
| className: 'leaflet-marker-icon leaflet-zoom-animated leaflet-interactive', | ||
| iconSize: [40, 40] | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
src/modules/otus/components/Panel/PanelMap/clusters/TypeMaterial.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export function TypeMaterial(cluster) { | ||
| return { | ||
| html: `<div class="bg-map-type-material"><span>${cluster.getChildCount()}</span></div>`, | ||
| className: | ||
| 'leaflet-marker-icon leaflet-zoom-animated leaflet-interactive marker-cluster bg-map-type-material bg-opacity-60 text-white', | ||
| iconSize: [40, 40] | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export * from './CollectionObject' | ||
| export * from './Mixed' | ||
| export * from './TypeMaterial' |
17 changes: 17 additions & 0 deletions
17
src/modules/otus/components/Panel/PanelMap/clusters/makeClusterIconFor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import * as ClusterType from '../clusters' | ||
|
|
||
| export function makeClusterIconFor({ L, cluster }) { | ||
| const items = cluster | ||
| .getAllChildMarkers() | ||
| .map((item) => item.feature.properties.base.map((i) => i.type)) | ||
| .flat() | ||
|
|
||
| const types = [...new Set(items)] | ||
| const currentType = types.pop() | ||
|
|
||
| const makeClusterOptions = types.length | ||
| ? ClusterType.Mixed | ||
| : ClusterType[currentType] || ClusterType.CollectionObject | ||
|
|
||
| return L.divIcon(makeClusterOptions(cluster)) | ||
| } |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.