Skip to content

Commit

Permalink
Merge pull request #886 from ZeLonewolf/zlw-shrink-star
Browse files Browse the repository at this point in the history
Refactor place icons
  • Loading branch information
ZeLonewolf authored Jul 18, 2023
2 parents e0cd6a6 + dcc1c62 commit efff6cd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 48 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
80 changes: 32 additions & 48 deletions src/layer/place.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,29 @@ const cityLabelPaint = {
"text-halo-blur": labelHaloBlur,
};

const cityIcon = [
"match",
["get", "capital"],
2,
"star_nation_capital",
3,
"star_state_capital",
4,
"star_state_capital",
"dot_city",
const minorLocationStepFilter = [
"step",
["zoom"],
["<=", ["get", "rank"], 2],
6,
["<=", ["get", "rank"], 4],
7,
["<=", ["get", "rank"], 5],
8,
["<=", ["get", "rank"], 9],
10,
[">=", ["get", "rank"], 1],
];

function filterPlace(type) {
return ["==", ["get", "class"], type];
}

export const village = {
id: "place_village",
type: "symbol",
paint: cityLabelPaint,
filter: [
"all",
["==", ["get", "class"], "village"],
[
"step",
["zoom"],
["<=", ["get", "rank"], 2],
6,
["<=", ["get", "rank"], 4],
7,
["<=", ["get", "rank"], 5],
8,
["<=", ["get", "rank"], 9],
10,
[">=", ["get", "rank"], 1],
],
],
filter: ["all", filterPlace("village"), minorLocationStepFilter],
layout: {
"text-font": ["Americana-Bold"],
"text-size": {
Expand All @@ -63,7 +53,7 @@ export const village = {
[12, 12],
],
},
"icon-image": cityIcon,
"icon-image": "place_dot",
"icon-size": {
base: 1.0,
stops: [
Expand Down Expand Up @@ -99,23 +89,7 @@ export const town = {
id: "place_town",
type: "symbol",
paint: cityLabelPaint,
filter: [
"all",
["==", ["get", "class"], "town"],
[
"step",
["zoom"],
["<=", ["get", "rank"], 2],
6,
["<=", ["get", "rank"], 4],
7,
["<=", ["get", "rank"], 5],
8,
["<=", ["get", "rank"], 9],
10,
[">=", ["get", "rank"], 1],
],
],
filter: ["all", filterPlace("town"), minorLocationStepFilter],
layout: {
"text-font": ["Americana-Bold"],
"text-size": {
Expand All @@ -126,7 +100,7 @@ export const town = {
[12, 18],
],
},
"icon-image": cityIcon,
"icon-image": "place_dot",
"icon-size": {
base: 1.2,
stops: [
Expand Down Expand Up @@ -164,7 +138,7 @@ export const city = {
paint: cityLabelPaint,
filter: [
"all",
["==", ["get", "class"], "city"],
filterPlace("city"),
[
"step",
["zoom"],
Expand All @@ -185,7 +159,17 @@ export const city = {
[11, 24],
],
},
"icon-image": cityIcon,
"icon-image": [
"match",
["get", "capital"],
2,
"place_star_in_circle",
3,
"place_star",
4,
"place_star",
"place_dot",
],
"icon-size": {
base: 1.2,
stops: [
Expand Down

0 comments on commit efff6cd

Please sign in to comment.