mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-30 23:10:33 +01:00
Merge branch 'master' into 60
This commit is contained in:
commit
0ba11b94c8
5 changed files with 128 additions and 74 deletions
147
package-lock.json
generated
147
package-lock.json
generated
|
@ -156,6 +156,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@mapbox/geojson-area": {
|
||||||
|
"version": "0.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@mapbox/geojson-area/-/geojson-area-0.2.2.tgz",
|
||||||
|
"integrity": "sha1-GNeBSqNr8j+7zDefjiaiKSfevxA=",
|
||||||
|
"requires": {
|
||||||
|
"wgs84": "0.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@mapbox/gl-matrix": {
|
"@mapbox/gl-matrix": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@mapbox/gl-matrix/-/gl-matrix-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@mapbox/gl-matrix/-/gl-matrix-0.0.1.tgz",
|
||||||
|
@ -204,6 +212,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@mapbox/mapbox-gl-supported": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-ACfuqIMxAzIoKRp3e7J2VjTJFBbrOoXqt4b7vy1x5uz5Od5Drroe2Ei/+R416eKpTXE1L0zHq5D2m3Q+SyM9WQ=="
|
||||||
|
},
|
||||||
"@mapbox/point-geometry": {
|
"@mapbox/point-geometry": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz",
|
||||||
|
@ -429,7 +442,6 @@
|
||||||
"version": "1.0.9",
|
"version": "1.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz",
|
||||||
"integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=",
|
"integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"sprintf-js": "1.0.3"
|
"sprintf-js": "1.0.3"
|
||||||
}
|
}
|
||||||
|
@ -1486,11 +1498,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz",
|
||||||
"integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg="
|
"integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg="
|
||||||
},
|
},
|
||||||
"base64-js": {
|
|
||||||
"version": "0.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.2.tgz",
|
|
||||||
"integrity": "sha1-Ak8Pcq+iW3X5wO5zzU9V7Bvtl4Q="
|
|
||||||
},
|
|
||||||
"base64-loader": {
|
"base64-loader": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/base64-loader/-/base64-loader-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/base64-loader/-/base64-loader-1.0.0.tgz",
|
||||||
|
@ -1630,15 +1637,6 @@
|
||||||
"hoek": "2.16.3"
|
"hoek": "2.16.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bops": {
|
|
||||||
"version": "0.0.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/bops/-/bops-0.0.6.tgz",
|
|
||||||
"integrity": "sha1-CC0dVfoB5g29wuvC26N/ZZVUzzo=",
|
|
||||||
"requires": {
|
|
||||||
"base64-js": "0.0.2",
|
|
||||||
"to-utf8": "0.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.8",
|
"version": "1.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
|
||||||
|
@ -3447,9 +3445,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"earcut": {
|
"earcut": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.1.3.tgz",
|
||||||
"integrity": "sha512-ji2b8qOVwK4WChYTbpKo983518wEqY2wrpkd85Us/LLw+3O7G0jGvGbHgQERuovrv3Cop9cEpiNkhqVQSkgTtA=="
|
"integrity": "sha512-AxdCdWUk1zzK/NuZ7e1ljj6IGC+VAdC3Qb7QQDsXpfNrc5IM8tL9nNXUmEGE6jRHTfZ10zhzRhtDmWVsR5pd3A=="
|
||||||
},
|
},
|
||||||
"ecc-jsbn": {
|
"ecc-jsbn": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
|
@ -4257,6 +4255,14 @@
|
||||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
|
||||||
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
|
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
|
||||||
},
|
},
|
||||||
|
"extend-shallow": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
|
||||||
|
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
|
||||||
|
"requires": {
|
||||||
|
"is-extendable": "0.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"external-editor": {
|
"external-editor": {
|
||||||
"version": "2.0.5",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz",
|
||||||
|
@ -4681,43 +4687,27 @@
|
||||||
"globule": "1.2.0"
|
"globule": "1.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"geojson-area": {
|
|
||||||
"version": "0.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/geojson-area/-/geojson-area-0.1.0.tgz",
|
|
||||||
"integrity": "sha1-1I2AcILPrfSnjfE0m+UPOL8YlK4=",
|
|
||||||
"requires": {
|
|
||||||
"wgs84": "0.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"geojson-rewind": {
|
"geojson-rewind": {
|
||||||
"version": "0.2.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/geojson-rewind/-/geojson-rewind-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/geojson-rewind/-/geojson-rewind-0.3.0.tgz",
|
||||||
"integrity": "sha1-6lWOnkT/A7hlXQoIt1B43DOhXnk=",
|
"integrity": "sha512-5dsjiZGk6p///Ju9kh7uGW+I74CZriHsxqBNPbIN4bbInfKmHwwM+f8fZ42fmpV5emeUYLTTC+GWs3EC1TMjNQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"concat-stream": "1.2.1",
|
"@mapbox/geojson-area": "0.2.2",
|
||||||
"geojson-area": "0.1.0",
|
"concat-stream": "1.6.0",
|
||||||
"minimist": "0.0.5"
|
"minimist": "1.2.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"concat-stream": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.2.1.tgz",
|
|
||||||
"integrity": "sha1-81EAtsRjeL+6i2uA+fDQzN8T3GA=",
|
|
||||||
"requires": {
|
|
||||||
"bops": "0.0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.5",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||||
"integrity": "sha1-16oye87PUY+RBqxrjwA/o7zqhWY="
|
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"geojson-vt": {
|
"geojson-vt": {
|
||||||
"version": "2.4.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-2.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-3.0.0.tgz",
|
||||||
"integrity": "sha1-PBz0RJPzXrTSxwyV2mVQ3mYHLAU="
|
"integrity": "sha512-FL7VV56gYBDBh0F7EWyZV5G9/L2EHEHh9SyhEpJz4c8YDPerM6dnP9VbRcsbyg1wH+1oyoHRA9dlJkGs/IXULA=="
|
||||||
},
|
},
|
||||||
"get-caller-file": {
|
"get-caller-file": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
|
@ -4906,6 +4896,38 @@
|
||||||
"integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
|
"integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"gray-matter": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-nZ1qjLmayEv0/wt3sHig7I0s3/sJO0dkAaKYQ5YAOApUtYEOonXSFdWvL1khvnZMTvov4UufkqlFsilPnejEXA==",
|
||||||
|
"requires": {
|
||||||
|
"extend-shallow": "2.0.1",
|
||||||
|
"js-yaml": "3.10.0",
|
||||||
|
"kind-of": "5.1.0",
|
||||||
|
"strip-bom-string": "1.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"esprima": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw=="
|
||||||
|
},
|
||||||
|
"js-yaml": {
|
||||||
|
"version": "3.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz",
|
||||||
|
"integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==",
|
||||||
|
"requires": {
|
||||||
|
"argparse": "1.0.9",
|
||||||
|
"esprima": "4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"kind-of": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"grid-index": {
|
"grid-index": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/grid-index/-/grid-index-1.0.0.tgz",
|
||||||
|
@ -6955,11 +6977,12 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"mapbox-gl": {
|
"mapbox-gl": {
|
||||||
"version": "0.41.0",
|
"version": "0.43.0",
|
||||||
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.41.0.tgz",
|
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.43.0.tgz",
|
||||||
"integrity": "sha512-4U4/nhhJhqEqwHK3GSHiBL8STNRQiPkjqZKBivDS18Tuo4A1SPR/PVoSTMZeAqAJWToM9ENWDHSKyj8VKqILxw==",
|
"integrity": "sha512-mSyGdXEy+JXXZS5/U4IL13JnOeHx8IoyrNPalxQnagFf3X8olaqKBy49YyEIBeAxTBR4QDeS50fwDLJK1C2Hgg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@mapbox/gl-matrix": "0.0.1",
|
"@mapbox/gl-matrix": "0.0.1",
|
||||||
|
"@mapbox/mapbox-gl-supported": "1.3.0",
|
||||||
"@mapbox/point-geometry": "0.1.0",
|
"@mapbox/point-geometry": "0.1.0",
|
||||||
"@mapbox/shelf-pack": "3.1.0",
|
"@mapbox/shelf-pack": "3.1.0",
|
||||||
"@mapbox/tiny-sdf": "1.1.0",
|
"@mapbox/tiny-sdf": "1.1.0",
|
||||||
|
@ -6969,13 +6992,13 @@
|
||||||
"brfs": "1.4.3",
|
"brfs": "1.4.3",
|
||||||
"bubleify": "0.7.0",
|
"bubleify": "0.7.0",
|
||||||
"csscolorparser": "1.0.3",
|
"csscolorparser": "1.0.3",
|
||||||
"earcut": "2.1.2",
|
"earcut": "2.1.3",
|
||||||
"geojson-rewind": "0.2.0",
|
"geojson-rewind": "0.3.0",
|
||||||
"geojson-vt": "2.4.0",
|
"geojson-vt": "3.0.0",
|
||||||
|
"gray-matter": "3.1.1",
|
||||||
"grid-index": "1.0.0",
|
"grid-index": "1.0.0",
|
||||||
"jsonlint-lines-primitives": "1.6.0",
|
"jsonlint-lines-primitives": "1.6.0",
|
||||||
"lodash.isequal": "3.0.4",
|
"lodash.isequal": "3.0.4",
|
||||||
"mapbox-gl-supported": "1.2.0",
|
|
||||||
"minimist": "0.0.8",
|
"minimist": "0.0.8",
|
||||||
"package-json-versionify": "1.0.4",
|
"package-json-versionify": "1.0.4",
|
||||||
"pbf": "3.1.0",
|
"pbf": "3.1.0",
|
||||||
|
@ -7021,11 +7044,6 @@
|
||||||
"randomcolor": "0.4.4"
|
"randomcolor": "0.4.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mapbox-gl-supported": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mapbox-gl-supported/-/mapbox-gl-supported-1.2.0.tgz",
|
|
||||||
"integrity": "sha1-y9NN+JQgbK3amjPI2aRgnya7GYk="
|
|
||||||
},
|
|
||||||
"mapbox-to-css-font": {
|
"mapbox-to-css-font": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/mapbox-to-css-font/-/mapbox-to-css-font-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/mapbox-to-css-font/-/mapbox-to-css-font-1.0.2.tgz",
|
||||||
|
@ -11074,8 +11092,7 @@
|
||||||
"sprintf-js": {
|
"sprintf-js": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
|
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"sshpk": {
|
"sshpk": {
|
||||||
"version": "1.13.1",
|
"version": "1.13.1",
|
||||||
|
@ -11300,6 +11317,11 @@
|
||||||
"is-utf8": "0.2.1"
|
"is-utf8": "0.2.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"strip-bom-string": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-5SEekiQ2n7uB1jOi8ABE3IztrZI="
|
||||||
|
},
|
||||||
"strip-eof": {
|
"strip-eof": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
||||||
|
@ -11836,11 +11858,6 @@
|
||||||
"integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=",
|
"integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"to-utf8": {
|
|
||||||
"version": "0.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/to-utf8/-/to-utf8-0.0.1.tgz",
|
|
||||||
"integrity": "sha1-0Xrqcv8vujm55DYBvns/9y4ImFI="
|
|
||||||
},
|
|
||||||
"toggle-selection": {
|
"toggle-selection": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "maputnik",
|
"name": "maputnik",
|
||||||
"version": "1.0.1",
|
"version": "1.1.0-beta",
|
||||||
"description": "A MapboxGL visual style editor",
|
"description": "A MapboxGL visual style editor",
|
||||||
"main": "''",
|
"main": "''",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"lodash.throttle": "^4.1.1",
|
"lodash.throttle": "^4.1.1",
|
||||||
"mapbox-gl": "^0.41.0",
|
"mapbox-gl": "^0.43.0",
|
||||||
"mapbox-gl-inspect": "^1.2.5",
|
"mapbox-gl-inspect": "^1.2.5",
|
||||||
"maputnik-design": "github:maputnik/design",
|
"maputnik-design": "github:maputnik/design",
|
||||||
"mousetrap": "^1.6.1",
|
"mousetrap": "^1.6.1",
|
||||||
|
|
|
@ -4,13 +4,26 @@ import InputBlock from '../inputs/InputBlock'
|
||||||
import StringInput from '../inputs/StringInput'
|
import StringInput from '../inputs/StringInput'
|
||||||
import LayerIcon from '../icons/LayerIcon'
|
import LayerIcon from '../icons/LayerIcon'
|
||||||
|
|
||||||
|
|
||||||
function groupFeaturesBySourceLayer(features) {
|
function groupFeaturesBySourceLayer(features) {
|
||||||
const sources = {}
|
const sources = {}
|
||||||
|
|
||||||
|
let returnedFeatures = {};
|
||||||
|
|
||||||
features.forEach(feature => {
|
features.forEach(feature => {
|
||||||
|
if(returnedFeatures.hasOwnProperty(feature.layer.id)) {
|
||||||
|
returnedFeatures[feature.layer.id]++
|
||||||
|
|
||||||
|
const featureObject = sources[feature.layer['source-layer']].find(f => f.layer.id === feature.layer.id)
|
||||||
|
|
||||||
|
featureObject.counter = returnedFeatures[feature.layer.id]
|
||||||
|
} else {
|
||||||
sources[feature.layer['source-layer']] = sources[feature.layer['source-layer']] || []
|
sources[feature.layer['source-layer']] = sources[feature.layer['source-layer']] || []
|
||||||
sources[feature.layer['source-layer']].push(feature)
|
sources[feature.layer['source-layer']].push(feature)
|
||||||
|
|
||||||
|
returnedFeatures[feature.layer.id] = 1
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return sources
|
return sources
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +51,7 @@ class FeatureLayerPopup extends React.Component {
|
||||||
paddingRight: 3
|
paddingRight: 3
|
||||||
}}/>
|
}}/>
|
||||||
{feature.layer.id}
|
{feature.layer.id}
|
||||||
|
{feature.counter && <span> × {feature.counter}</span>}
|
||||||
</label>
|
</label>
|
||||||
})
|
})
|
||||||
return <div key={vectorLayerId}>
|
return <div key={vectorLayerId}>
|
||||||
|
|
|
@ -23,7 +23,7 @@ function renderProperties(feature) {
|
||||||
|
|
||||||
function renderFeature(feature) {
|
function renderFeature(feature) {
|
||||||
return <div key={feature.id}>
|
return <div key={feature.id}>
|
||||||
<div className="maputnik-popup-layer-id">{feature.layer['source-layer']}</div>
|
<div className="maputnik-popup-layer-id">{feature.layer['source-layer']}{feature.inspectModeCounter && <span> × {feature.inspectModeCounter}</span>}</div>
|
||||||
<InputBlock key={"property-type"} label={"$type"}>
|
<InputBlock key={"property-type"} label={"$type"}>
|
||||||
<StringInput value={feature.geometry.type} style={{backgroundColor: 'transparent'}} />
|
<StringInput value={feature.geometry.type} style={{backgroundColor: 'transparent'}} />
|
||||||
</InputBlock>
|
</InputBlock>
|
||||||
|
@ -31,13 +31,36 @@ function renderFeature(feature) {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeDuplicatedFeatures(features) {
|
||||||
|
let uniqueFeatures = [];
|
||||||
|
|
||||||
|
features.forEach(feature => {
|
||||||
|
const featureIndex = uniqueFeatures.findIndex(feature2 => {
|
||||||
|
return feature.layer['source-layer'] === feature2.layer['source-layer']
|
||||||
|
&& JSON.stringify(feature.properties) === JSON.stringify(feature2.properties)
|
||||||
|
})
|
||||||
|
|
||||||
|
if(featureIndex === -1) {
|
||||||
|
uniqueFeatures.push(feature)
|
||||||
|
} else {
|
||||||
|
if(uniqueFeatures[featureIndex].hasOwnProperty('counter')) {
|
||||||
|
uniqueFeatures[featureIndex].inspectModeCounter++
|
||||||
|
} else {
|
||||||
|
uniqueFeatures[featureIndex].inspectModeCounter = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return uniqueFeatures
|
||||||
|
}
|
||||||
|
|
||||||
class FeaturePropertyPopup extends React.Component {
|
class FeaturePropertyPopup extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
features: PropTypes.array
|
features: PropTypes.array
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const features = this.props.features
|
const features = removeDuplicatedFeatures(this.props.features)
|
||||||
return <div className="maputnik-feature-property-popup">
|
return <div className="maputnik-feature-property-popup">
|
||||||
{features.map(renderFeature)}
|
{features.map(renderFeature)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -56,8 +56,8 @@ class Gist extends React.Component {
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>`+styleTitle+` Preview</title>
|
<title>`+styleTitle+` Preview</title>
|
||||||
<link rel="stylesheet" type="text/css" href="https://api.mapbox.com/mapbox-gl-js/v0.28.0/mapbox-gl.css" />
|
<link rel="stylesheet" type="text/css" href="https://api.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.css" />
|
||||||
<script src="https://api.mapbox.com/mapbox-gl-js/v0.28.0/mapbox-gl.js"></script>
|
<script src="https://api.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.js"></script>
|
||||||
<style>
|
<style>
|
||||||
body { margin:0; padding:0; }
|
body { margin:0; padding:0; }
|
||||||
#map { position:absolute; top:0; bottom:0; width:100%; }
|
#map { position:absolute; top:0; bottom:0; width:100%; }
|
||||||
|
|
Loading…
Reference in a new issue