Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#576 Vector Layer shapeIcon #577

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions configure/src/metaconfigs/layer-vector-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
"description": "Radius in pixels of point features.",
"type": "slider",
"min": 0,
"max": 24,
"max": 32,
"step": 1,
"width": 2
},
Expand Down Expand Up @@ -249,10 +249,17 @@
"pin"
]
},
{
"field": "style.shapeIcon",
"name": "Shape From Icon",
"description": "Shape but taken from the Material Design Icon (mdi) library. akes priority over the value in the 'shape' field. See https://pictogrammers.com/library/mdi/",
"type": "text",
"width": 3
},
{
"field": "style.shapeProp",
"name": "Shape From Property",
"description": "Shape but taken from each individual feature's property. For example 'shape' or 'path.to.prop.in.properties.object'. Takes priority over the value in the 'shape' field. Shape values are formatted like the dropdown options but all lowercase.",
"description": "Shape but taken from each individual feature's property. For example 'shape' or 'path.to.prop.in.properties.object'. Takes priority over the value in the 'shape' and 'shape from icon' fields. Shape values are formatted like the dropdown options but all lowercase. Material Design Icon (mdi) icon names are also supported values.",
"type": "text",
"width": 3
}
Expand Down
29 changes: 27 additions & 2 deletions src/essence/Basics/Layers_/LayerConstructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ export const constructVectorLayer = (
}

// Use style.shapeProp
let finalShape = layerObj.shape
let finalShape = layerObj.style.shapeIcon || layerObj.shape

if (
layerObj.style.shapeProp != null &&
layerObj.style.shapeProp != ''
Expand Down Expand Up @@ -382,12 +383,36 @@ export const constructVectorLayer = (
].join('\n')
break
case 'none':
default:
layer = L.circleMarker(
latlong,
leafletLayerObject.style
).setRadius(layerObj.style.radius || layerObj.radius || 8)
break
default:
svg = [
`<div style="color: ${
featureStyle.fillColor
}; transform: scale(${
((layerObj.style.radius || layerObj.radius || 8) *
2) /
24
}); text-shadow:
1px 1px 0px ${featureStyle.color},
-1px -1px 0px ${featureStyle.color},
1px -1px 0px ${featureStyle.color},
-1px 1px 0px ${featureStyle.color},
0px 1px 0px ${featureStyle.color},
-1px 0px 0px ${featureStyle.color},
0px -1px 0px ${featureStyle.color},
1px 0px 0px ${featureStyle.color};
display: block;
text-align: center;"
><i class='mdi mdi-${finalShape.replace(
/[^a-zA-Z-]/g,
''
)} mdi-24px'></i></div>`,
]
}

if (markerIcon) {
Expand Down
Loading