Skip to content

Commit

Permalink
Use a circle layer for all circles
Browse files Browse the repository at this point in the history
  • Loading branch information
krasch committed Dec 18, 2024
1 parent 013fb77 commit d67d976
Showing 1 changed file with 34 additions and 49 deletions.
83 changes: 34 additions & 49 deletions style/map/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,22 @@ const mapStyles = [
// ################################
// city circles
// ################################

{
id: "city-circle-interact",
source: "cities",
type: "symbol",
filter: ["boolean", ["get", "isVisible"], false],
layout: {
"icon-image": "circle",
"icon-size": 2,
"icon-allow-overlap": true,
"text-allow-overlap": true, // perhaps speed up redrawing?
},
paint: {
"icon-color": "white",
"icon-opacity": 0.0,
},
},
{
id: "city-circle-hover-border",
source: "cities",
Expand All @@ -97,63 +112,33 @@ const mapStyles = [
},
},
{
id: "city-circle-interact",
id: "city-circle",
source: "cities",
type: "symbol",
filter: ["boolean", ["get", "isVisible"], false],
layout: {
"icon-image": "circle",
"icon-size": 2,
"icon-allow-overlap": true,
"text-allow-overlap": true, // perhaps speed up redrawing?
},
paint: {
"icon-color": "white",
"icon-opacity": 0.0,
},
},
{
id: "city-circle-stop",
source: "cities",
type: "symbol",
layout: {
"icon-image": "circle",
"icon-size": 0.5,
"icon-allow-overlap": true,
"text-allow-overlap": true, // perhaps speed up redrawing?
},
type: "circle",
paint: {
"icon-color": "white",
"icon-opacity": [
"circle-radius": [
"case",
["boolean", ["feature-state", "isDestination"], false],
5.0,
["boolean", ["feature-state", "isStop"], false],
0.6,
0.0,
3.0,
0,
],
"icon-halo-color": ["to-color", ["feature-state", "circleColor"], "#aaa"],
"icon-halo-width": 1,
},
},
{
id: "city-circle-destination",
source: "cities",
type: "symbol",
layout: {
"icon-image": "circle",
"icon-size": 0.8,
"icon-allow-overlap": true,
"text-allow-overlap": true, // perhaps speed up redrawing?
},
paint: {
"icon-color": "white",
"icon-opacity": [
"circle-color": "white",
"circle-opacity": [
"case",
["boolean", ["feature-state", "isDestination"], false],
1.0,
0.0,
["boolean", ["feature-state", "isStop"], false],
0.6,
0,
],
"circle-stroke-width": 1,
"circle-stroke-color": [
"to-color",
["feature-state", "circleColor"],
"#aaa",
],
"icon-halo-color": ["to-color", ["feature-state", "circleColor"], "#aaa"],
"icon-halo-width": 1,
},
},

Expand Down

0 comments on commit d67d976

Please sign in to comment.