Merge branch 'master' into develop
This commit is contained in:
commit
60c835fdac
7 changed files with 881 additions and 846 deletions
|
@ -64,7 +64,6 @@ export class FromJSON {
|
|||
}
|
||||
|
||||
public static LayoutFromJSON(json: LayoutConfigJson): Layout {
|
||||
console.log(json)
|
||||
const tr = FromJSON.Translation;
|
||||
|
||||
const layers = json.layers.map(FromJSON.Layer);
|
||||
|
@ -115,7 +114,6 @@ export class FromJSON {
|
|||
return undefined;
|
||||
}
|
||||
const transl = new Translation(tr);
|
||||
transl.addCallback(latest => console.log("tr callback changed to", latest));
|
||||
return transl;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,12 +52,20 @@ export class FilteredLayer {
|
|||
|
||||
this._wayHandling = layerDef.wayHandling;
|
||||
this._showOnPopup = showOnPopup;
|
||||
this._style = layerDef.style;
|
||||
if (this._style === undefined) {
|
||||
this._style = function () {
|
||||
this._style = (tags) => {
|
||||
if(layerDef.style === undefined){
|
||||
return {icon: {iconUrl: "./assets/bug.svg"}, color: "#000"};
|
||||
}
|
||||
}
|
||||
|
||||
const obj = layerDef.style(tags);
|
||||
if(obj.weight && typeof (obj.weight) === "string"){
|
||||
obj.weight = Number(obj.weight);// Weight MUST be a number, otherwise leaflet does weird things. see https://github.com/Leaflet/Leaflet/issues/6075
|
||||
if(isNaN(obj.weight)){
|
||||
obj.weight = undefined;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
this.name = name;
|
||||
this.filters = layerDef.overpassFilter;
|
||||
this._maxAllowedOverlap = layerDef.maxAllowedOverlapPercentage;
|
||||
|
@ -215,26 +223,26 @@ export class FilteredLayer {
|
|||
pointToLayer: function (feature, latLng) {
|
||||
const style = self._style(feature.properties);
|
||||
let marker;
|
||||
if (style.icon === undefined) {
|
||||
marker = L.circle(latLng, {
|
||||
radius: 25,
|
||||
color: style.color
|
||||
});
|
||||
if (style.icon === undefined) {
|
||||
marker = L.circle(latLng, {
|
||||
radius: 25,
|
||||
color: style.color
|
||||
});
|
||||
|
||||
} else if (style.icon.iconUrl.startsWith("$circle")) {
|
||||
marker = L.circle(latLng, {
|
||||
radius: 25,
|
||||
color: style.color
|
||||
});
|
||||
} else {
|
||||
if (style.icon.iconSize === undefined) {
|
||||
style.icon.iconSize = [50, 50]
|
||||
}
|
||||
} else if (style.icon.iconUrl.startsWith("$circle")) {
|
||||
marker = L.circle(latLng, {
|
||||
radius: 25,
|
||||
color: style.color
|
||||
});
|
||||
} else {
|
||||
if (style.icon.iconSize === undefined) {
|
||||
style.icon.iconSize = [50, 50]
|
||||
}
|
||||
|
||||
marker = L.marker(latLng, {
|
||||
icon: new L.icon(style.icon),
|
||||
});
|
||||
}
|
||||
marker = L.marker(latLng, {
|
||||
icon: new L.icon(style.icon),
|
||||
});
|
||||
}
|
||||
let eventSource = State.state.allElements.addOrGetElement(feature);
|
||||
const popup = L.popup({}, marker);
|
||||
let uiElement: UIElement;
|
||||
|
|
2
State.ts
2
State.ts
|
@ -22,7 +22,7 @@ export class State {
|
|||
// The singleton of the global state
|
||||
public static state: State;
|
||||
|
||||
public static vNumber = "0.0.8e";
|
||||
public static vNumber = "0.0.8f";
|
||||
|
||||
// The user journey states thresholds when a new feature gets unlocked
|
||||
public static userJourney = {
|
||||
|
|
|
@ -1,44 +1,73 @@
|
|||
<svg width="98" height="122" viewBox="0 0 98 122" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M53.0445 112.094C51.2614 115.981 45.7386 115.981 43.9555 112.094L13.2124 45.085C11.6928 41.7729 14.1129 38 17.7569 38L79.2431 38C82.8871 38 85.3072 41.7729 83.7876 45.085L53.0445 112.094Z" fill="#171615"/>
|
||||
<circle cx="49" cy="49" r="49" fill="#171615"/>
|
||||
<g filter="url(#filter0_d)">
|
||||
<path d="M56.4468 12.3002H49.8793V6.79007C49.8793 6.35374 49.5103 6 49.0552 6H47.2158C46.7606 6 46.3916 6.35374 46.3916 6.79007V12.3002H39.8242C39.369 12.3002 39 12.654 39 13.0903V14.8536C39 15.29 39.369 15.6437 39.8242 15.6437H46.3916V32.2099C46.3916 32.6463 46.7606 33 47.2158 33H49.0552C49.5103 33 49.8793 32.6463 49.8793 32.2099V15.6437H56.4468C56.902 15.6437 57.271 15.29 57.271 14.8536V13.0903C57.271 12.654 56.902 12.3002 56.4468 12.3002Z" fill="#FFFCFC"/>
|
||||
</g>
|
||||
<g filter="url(#filter1_d)">
|
||||
<path d="M45.0763 63.8434H29.7114L38.0923 45.2455H46.4731H52.526H59.0444M59.0444 45.2455L56.7164 40H59.9756H63.2348M59.0444 45.2455L59.9756 47.6299L61.838 51.4448L66.9596 63.8434M59.0444 45.2455L54.6212 52.3985L51.9672 56.6903M50.1979 59.5516L51.9672 56.6903M41.3515 50.4911L46.0075 60.9822L36.6955 40L39.4891 45.7224M48.8011 61.9359L51.9672 56.6903" stroke="white" stroke-width="2"/>
|
||||
<path d="M50.0922 63.032C50.0922 64.6108 48.8456 65.8701 47.3329 65.8701C45.8203 65.8701 44.5737 64.6108 44.5737 63.032C44.5737 61.4533 45.8203 60.194 47.3329 60.194C48.8456 60.194 50.0922 61.4533 50.0922 63.032Z" stroke="white"/>
|
||||
<path d="M40.2801 62.0784C40.2801 68.1329 35.494 73 29.6401 73C23.7861 73 19 68.1329 19 62.0784C19 56.0238 23.7861 51.1567 29.6401 51.1567C35.494 51.1567 40.2801 56.0238 40.2801 62.0784Z" stroke="white" stroke-width="2"/>
|
||||
</g>
|
||||
<g filter="url(#filter2_d)">
|
||||
<circle cx="66" cy="63" r="11" stroke="white" stroke-width="2"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_d" x="35" y="6" width="26.271" height="35" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feOffset dy="4"/>
|
||||
<feGaussianBlur stdDeviation="2"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
|
||||
</filter>
|
||||
<filter id="filter1_d" x="14" y="39" width="64.12" height="43" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feOffset dy="4"/>
|
||||
<feGaussianBlur stdDeviation="2"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
|
||||
</filter>
|
||||
<filter id="filter2_d" x="50" y="51" width="32" height="32" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
|
||||
<feOffset dy="4"/>
|
||||
<feGaussianBlur stdDeviation="2"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
|
||||
</filter>
|
||||
</defs>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
id="svg69"
|
||||
version="1.1"
|
||||
fill="none"
|
||||
viewBox="0 0 98 122"
|
||||
height="122"
|
||||
width="98">
|
||||
|
||||
<defs
|
||||
id="defs17" />
|
||||
<metadata
|
||||
id="metadata73">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer3">
|
||||
<g
|
||||
id="g875">
|
||||
<path
|
||||
style="fill:#171615"
|
||||
d="m 53.0445,112.094 c -1.7831,3.887 -7.3059,3.887 -9.089,0 L 13.2124,45.085 C 11.6928,41.7729 14.1129,38 17.7569,38 h 61.4862 c 3.644,0 6.0641,3.7729 4.5445,7.085 z"
|
||||
id="path2" />
|
||||
<circle
|
||||
style="fill:#171615"
|
||||
cx="49"
|
||||
cy="49"
|
||||
r="49"
|
||||
id="circle4" />
|
||||
<path
|
||||
style="stroke:#ffffff;stroke-width:2;"
|
||||
id="path10"
|
||||
d="M 45.0763,63.8434 H 29.7114 l 8.3809,-18.5979 h 8.3808 6.0529 6.5184 m 0,0 L 56.7164,40 h 3.2592 3.2592 m -4.1904,5.2455 0.9312,2.3844 1.8624,3.8149 5.1216,12.3986 m -7.9152,-18.5979 -4.4232,7.153 -2.654,4.2918 m -1.7693,2.8613 1.7693,-2.8613 M 41.3515,50.4911 46.0075,60.9822 36.6955,40 l 2.7936,5.7224 m 9.312,16.2135 3.1661,-5.2456" />
|
||||
<path
|
||||
style="stroke:#ffffff;"
|
||||
id="path12"
|
||||
d="m 50.0922,63.032 c 0,1.5788 -1.2466,2.8381 -2.7593,2.8381 -1.5126,0 -2.7592,-1.2593 -2.7592,-2.8381 0,-1.5787 1.2466,-2.838 2.7592,-2.838 1.5127,0 2.7593,1.2593 2.7593,2.838 z" />
|
||||
<path
|
||||
style="stroke:#ffffff;stroke-width:2;"
|
||||
id="path14"
|
||||
d="M 40.2801,62.0784 C 40.2801,68.1329 35.494,73 29.6401,73 23.7861,73 19,68.1329 19,62.0784 c 0,-6.0546 4.7861,-10.9217 10.6401,-10.9217 5.8539,0 10.64,4.8671 10.64,10.9217 z" />
|
||||
<g
|
||||
id="g20">
|
||||
<circle
|
||||
cx="66"
|
||||
cy="63"
|
||||
r="11"
|
||||
id="circle18"
|
||||
style="stroke:#ffffff;stroke-width:2" />
|
||||
</g>
|
||||
<g
|
||||
id="g8">
|
||||
<path
|
||||
d="M56.4468 12.3002H49.8793V6.79007C49.8793 6.35374 49.5103 6 49.0552 6H47.2158C46.7606 6 46.3916 6.35374 46.3916 6.79007V12.3002H39.8242C39.369 12.3002 39 12.654 39 13.0903V14.8536C39 15.29 39.369 15.6437 39.8242 15.6437H46.3916V32.2099C46.3916 32.6463 46.7606 33 47.2158 33H49.0552C49.5103 33 49.8793 32.6463 49.8793 32.2099V15.6437H56.4468C56.902 15.6437 57.271 15.29 57.271 14.8536V13.0903C57.271 12.654 56.902 12.3002 56.4468 12.3002Z"
|
||||
id="path6"
|
||||
fill="#FFFCFC" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.8 KiB |
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 45 KiB |
|
@ -13,17 +13,13 @@ import Translations from "./UI/i18n/Translations";
|
|||
import {TagRendering} from "./UI/TagRendering";
|
||||
|
||||
TagRendering.injectFunction();
|
||||
|
||||
|
||||
console.log("Building the layouts")
|
||||
|
||||
|
||||
function enc(str: string): string {
|
||||
return encodeURIComponent(str.toLowerCase());
|
||||
}
|
||||
|
||||
function validate(layout: Layout) {
|
||||
console.log("Validationg ", layout.id)
|
||||
const translations: Translation[] = [];
|
||||
const queue: any[] = [layout]
|
||||
|
||||
|
@ -52,7 +48,6 @@ function validate(layout: Layout) {
|
|||
const txt = translation.translations[ln];
|
||||
const isMissing = txt === undefined || txt === "" || txt.toLowerCase().indexOf("todo") >= 0;
|
||||
if (isMissing) {
|
||||
console.log(`Missing or suspicious ${ln}-translation for '`, translation.txt, ":", txt)
|
||||
missing[ln]++
|
||||
} else {
|
||||
present[ln]++;
|
||||
|
@ -60,7 +55,7 @@ function validate(layout: Layout) {
|
|||
}
|
||||
}
|
||||
|
||||
console.log("Translation completenes for", layout.id);
|
||||
console.log("Translation completenes for theme", layout.id);
|
||||
for (const ln of layout.supportedLanguages) {
|
||||
const amiss = missing[ln];
|
||||
const ok = present[ln];
|
||||
|
@ -129,23 +124,21 @@ function createIcon(iconPath: string, size: number) {
|
|||
}
|
||||
|
||||
console.log("Creating icon ", name, newname)
|
||||
try {
|
||||
svg2img(iconPath,
|
||||
// @ts-ignore
|
||||
{width: size, height: size, preserveAspectRatio: true})
|
||||
.then((buffer) => {
|
||||
console.log("Writing icon", newname)
|
||||
writeFileSync(newname, buffer);
|
||||
}).catch((error) => {
|
||||
console.log("ERROR while writing" + iconPath, error)
|
||||
});
|
||||
|
||||
try{
|
||||
|
||||
svg2img(iconPath,
|
||||
// @ts-ignore
|
||||
{width: size, height: size, preserveAspectRatio: true})
|
||||
.then((buffer) => {
|
||||
console.log("Writing icon", newname)
|
||||
writeFileSync(newname, buffer);
|
||||
}).catch((error) => {
|
||||
console.log("ERROR while writing" + iconPath, error)
|
||||
});
|
||||
|
||||
}catch(e){
|
||||
console.error("Could not read icon",iconPath,"due to",e)
|
||||
} catch (e) {
|
||||
console.error("Could not read icon", iconPath, "due to", e)
|
||||
}
|
||||
|
||||
|
||||
return newname;
|
||||
}
|
||||
|
||||
|
@ -155,7 +148,6 @@ function createManifest(layout: Layout, relativePath: string) {
|
|||
const icons = [];
|
||||
|
||||
let icon = layout.icon;
|
||||
console.log(icon)
|
||||
if (icon.endsWith(".svg")) {
|
||||
// This is an svg. Lets create the needed pngs!
|
||||
const sizes = [72, 96, 120, 128, 144, 152, 180, 192, 384, 512];
|
||||
|
@ -240,16 +232,13 @@ for (const layoutName in all) {
|
|||
};
|
||||
const layout = all[layoutName];
|
||||
validate(layout)
|
||||
console.log("Generating manifest")
|
||||
const manif = JSON.stringify(createManifest(layout, "/MapComplete"));
|
||||
|
||||
const manifestLocation = encodeURIComponent(layout.id.toLowerCase()) + ".webmanifest";
|
||||
writeFile(manifestLocation, manif, err);
|
||||
|
||||
const landing = createLandingPage(layout);
|
||||
console.log("Generating html-file for ", layout.id)
|
||||
writeFile(enc(layout.id) + ".html", landing, err)
|
||||
console.log("done")
|
||||
|
||||
wikiPage += "\n\n"+generateWikiEntry(layout);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ ts-node createLayouts.ts || { echo 'Creating layouts failed' ; exit 1; }
|
|||
find -name '*.png' | parallel optipng '{}'
|
||||
npm run build || { echo 'Npm build failed' ; exit 1; }
|
||||
|
||||
rm -rf .cache
|
||||
|
||||
if [[ $1 == "groen" ]]
|
||||
then
|
||||
echo "DEPLOYING TO BUURTNATUUR!"
|
||||
|
|
Loading…
Reference in a new issue