Change on-map home icon

This commit is contained in:
Pieter Vander Vennet 2020-11-15 16:54:41 +01:00
commit c1490267e6
12 changed files with 73 additions and 95 deletions

View file

@ -84,16 +84,16 @@ To develop:
0. Make a fork and clone the repository.
1. Install `npm`. Linux: `sudo apt install npm` (or your favourite package manager), Windows: install nodeJS: https://nodejs.org/en/download/
2. Run `npm install` to install the dependencies
3. Run `npm run start` to host a local testversion at http://localhost:1234/index.html
4. By default, the 'bookcases'-theme is loaded. In order to load another theme, use `layout=themename` or `userlayout=true#<layout configuration>`. Note that the custom URLs (e.g. `bookcases.html`, `aed.html`, ...) _don't_ exist on the development version. (These are automatically generated from a template on the server).
2. Run `npm install` to install the package dependencies
3. Run `npm run generate` to generate some additional dependencies
4. Run `npm run start` to host a local testversion at http://localhost:1234/index.html
5. By default, the 'bookcases'-theme is loaded. In order to load another theme, use `layout=themename` or `userlayout=true#<layout configuration>`. Note that the custom URLs (e.g. `bookcases.html`, `aed.html`, ...) _don't_ exist on the development version. (These are automatically generated from a template on the server).
To deploy:
0. `rm -rf dist/` to remove the local build
1. `ts-node createLayouts.ts` to generate the custom htmls, (such as `aed.html`, `bookcases.html`)
2. `npm run build`
3. copy the entire `dist` folder to where you host your website. Visiting `index.html` gives you the website
1. `npm run build`
2. Copy the entire `dist` folder to where you host your website. Visiting `index.html` gives you the website
## Translating MapComplete

View file

@ -22,7 +22,7 @@ export default class State {
// The singleton of the global state
public static state: State;
public static vNumber = "0.1.3-rc1";
public static vNumber = "0.1.3-rc2+g";
// The user journey states thresholds when a new feature gets unlocked
public static userJourney = {

7
Svg.ts

File diff suppressed because one or more lines are too long

View file

@ -105,10 +105,9 @@ export default class CustomGeneratorPanel extends UIElement {
}
if (ud.csCount <= State.userJourney.themeGeneratorReadOnlyUnlock) {
return new Combine([
"<h3>Too little experience/h3>",
`Creating your own (readonly) themes can only be done if you have more then <b>${State.userJourney.themeGeneratorReadOnlyUnlock}</b> changesets made`,
`Making a theme including survey options can be done at <b>${State.userJourney.themeGeneratorFullUnlock}</b> changesets`,
this.loginButton
"<h3>Too little experience</h3>",
`<p>Creating your own (readonly) themes can only be done if you have more then <b>${State.userJourney.themeGeneratorReadOnlyUnlock}</b> changesets made</p>`,
`<p>Making a theme including survey options can be done at <b>${State.userJourney.themeGeneratorFullUnlock}</b> changesets</p>`
]).Render();
}
return this.mainPanel.Render()

View file

@ -103,7 +103,7 @@ export default class ValidatedTextField {
"A geographical direction, in degrees. 0° is north, 90° is east, ... Will return a value between 0 (incl) and 360 (excl)",
(str) => {
str = "" + str;
return str !== undefined && str.indexOf(".") < 0 && !isNaN(Number(str)) && Number(str) > 0 && Number(str) <= 360
return str !== undefined && str.indexOf(".") < 0 && !isNaN(Number(str)) && Number(str) >= 0 && Number(str) <= 360
},str => str,
(value) => {
return new DirectionInput(value);

View file

@ -96,11 +96,11 @@ export class UserBadge extends UIElement {
if (user.home !== undefined) {
const icon = L.icon({
iconUrl: Img.AsData(Svg.home),
iconSize: [20, 20],
iconAnchor: [10, 10]
iconUrl: Img.AsData(Svg.home_white_bg),
iconSize: [30, 30],
iconAnchor: [15, 15]
});
L.marker([user.home.lat, user.home.lon], {icon: icon}).addTo(State.state.bm.map);
L.marker([user.home.lat, user.home.lon], {icon: icon}).addTo(State.state.bm.map)
}
const settings =

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg height="16px" id="Layer_1" style="enable-background:new 0 0 16 16;" version="1.1" viewBox="0 0 16 16" width="16px"
<svg height="16px" id="Layer_1" style="enable-background:new 0 0 16 16;fill: #000000;" version="1.1" viewBox="0 0 16 16" width="16px"
xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
<path d="M15.45,7L14,5.551V2c0-0.55-0.45-1-1-1h-1c-0.55,0-1,0.45-1,1v0.553L9,0.555C8.727,0.297,8.477,0,8,0S7.273,0.297,7,0.555 L0.55,7C0.238,7.325,0,7.562,0,8c0,0.563,0.432,1,1,1h1v6c0,0.55,0.45,1,1,1h3v-5c0-0.55,0.45-1,1-1h2c0.55,0,1,0.45,1,1v5h3 c0.55,0,1-0.45,1-1V9h1c0.568,0,1-0.437,1-1C16,7.562,15.762,7.325,15.45,7z"/>
</svg>

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 671 B

View file

@ -0,0 +1,29 @@
<?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"
xml:space="preserve"
width="16px"
viewBox="0 0 16 16"
version="1.1"
style="enable-background:new 0 0 16 16;fill: #000000;"
id="Layer_1"
height="16px"><metadata
id="metadata11"><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><defs
id="defs9" />
<circle
id="circle2"
fill="white"
r="8"
cy="8"
cx="8" />
<path
style="stroke-width:1"
id="path4"
d="m 13.429661,7.2711864 -1.05678,-1.0560508 v -2.588017 c 0,-0.4008474 -0.327966,-0.7288135 -0.728813,-0.7288135 h -0.728814 c -0.400847,0 -0.728813,0.3279661 -0.728813,0.7288135 V 4.0301525 L 8.7288135,2.573983 C 8.5298474,2.3859491 8.347644,2.1694915 8,2.1694915 c -0.3476441,0 -0.5298475,0.2164576 -0.7288136,0.4044915 L 2.570339,7.2711864 C 2.3429491,7.5080508 2.1694915,7.6807796 2.1694915,8 c 0,0.410322 0.3148475,0.7288135 0.7288136,0.7288135 h 0.7288135 v 4.3728815 c 0,0.400847 0.3279661,0.728813 0.7288136,0.728813 h 2.1864407 v -3.644067 c 0,-0.4008478 0.3279661,-0.7288139 0.7288135,-0.7288139 h 1.4576271 c 0.4008475,0 0.7288136,0.3279661 0.7288136,0.7288139 v 3.644067 h 2.1864409 c 0.400847,0 0.728813,-0.327966 0.728813,-0.728813 V 8.7288135 h 0.728814 c 0.413966,0 0.728813,-0.3184915 0.728813,-0.7288135 0,-0.3192204 -0.173457,-0.4919492 -0.400847,-0.7288136 z" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -1,29 +0,0 @@
#! /bin/bash
# clean up the mess we made
# rm *.js
# rm Logic/*.js
# rm Logic/*.js
# rm Logic/*/*.js
# rm Logic/*/*/*.js
# rm UI/*.js
# rm UI/*/*.js
# rm UI/*/*/*.js
# rm Customizations/*.js
# rm Customizations/*/*.js
# rm Customizations/*/*/*.js
rm *.webmanifest
# rm assets/generated/*
for f in ./*.html; do
if [[ "$f" == "./index.html" ]] || [[ "$f" == "./land.html" ]] || [[ "$f" == "./test.html" ]] || [[ "$f" == "./preferences.html" ]] || [[ "$f" == "./customGenerator.html" ]]
then
echo "Not removing $f"
else
rm $f
fi
done
rm -rf .cache

View file

@ -5,7 +5,7 @@ Img.runningFromConsole = true;
UIElement.runningFromConsole = true;
import {AllKnownLayouts} from "./Customizations/AllKnownLayouts";
import {readFileSync, writeFile, writeFileSync} from "fs";
import {existsSync, mkdirSync, readFileSync, writeFile, writeFileSync} from "fs";
import Locale from "./UI/i18n/Locale";
import svg2img from 'promise-svg2img';
import Translations from "./UI/i18n/Translations";
@ -250,6 +250,12 @@ let wikiPage = "{|class=\"wikitable sortable\"\n" +
"! Name, link !! Genre !! Covered region !! Language !! Description !! Free materials !! Image\n" +
"|-";
const generatedDir = "./assets/generated";
if (! existsSync(generatedDir)) {
mkdirSync(generatedDir)
}
for (const layoutName in all) {
if (blacklist.indexOf(layoutName.toLowerCase()) >= 0) {
console.log(`Skipping a layout with name${layoutName}, it is on the blacklist`);
@ -275,7 +281,7 @@ for (const layoutName in all) {
wikiPage += "|}"
writeFile("./assets/generated/wikiIndex", wikiPage, (err) => {
writeFile(generatedDir + "/wikiIndex", wikiPage, (err) => {
if (err !== null) {
console.log("Could not save wikiindex", err);
}

View file

@ -1,42 +0,0 @@
#! /bin/bash
cd assets/ && wget https://osmlab.github.io/editor-layer-index/imagery.geojson --output-document=editor-layer-index.json
cd ..
mkdir -p assets/generated
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!"
mv /home/pietervdvn/git/buurtnatuur.github.io/CNAME /home/pietervdvn/git/
mv /home/pietervdvn/git/buurtnatuur.github.io/.git /home/pietervdvn/git/
rm -rf /home/pietervdvn/git/buurtnatuur.github.io/*
cp -r dist/* /home/pietervdvn/git/buurtnatuur.github.io/
mv /home/pietervdvn/git/CNAME /home/pietervdvn/git/buurtnatuur.github.io/
mv /home/pietervdvn/git/.git /home/pietervdvn/git/buurtnatuur.github.io/
cd /home/pietervdvn/git/buurtnatuur.github.io/
elif [[ $1 == "production" ]]
then
echo "DEPLOYING TO MAPCOMPLETE"
rm -rf /home/pietervdvn/git/pietervdvn.github.io/MapComplete/*
cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/MapComplete/
cd /home/pietervdvn/git/pietervdvn.github.io/MapComplete/
else
echo "Testversion deploy"
rm -rf /home/pietervdvn/git/pietervdvn.github.io/Staging/*
cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/Staging/
cd /home/pietervdvn/git/pietervdvn.github.io/Staging/
fi
git add *
git commit -am "New mapcomplete version"
git push
cd -
./clean.sh
echo "DEPLOYED $1"

View file

@ -13,10 +13,20 @@
]
},
"scripts": {
"start": "parcel *.html UI/** Logic/** assets/** vendor/* vendor/*/*",
"generate": "ts-node createLayouts.ts",
"build": "rm -rf dist/ && ts-node generateIncludedImages.ts && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
"test": "ts-node test/*"
"start": "parcel *.html UI/** Logic/** assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
"test": "ts-node test/*",
"generate:editor-layer-index": "cd assets/ && wget https://osmlab.github.io/editor-layer-index/imagery.geojson --output-document=editor-layer-index.json",
"generate:images": "ts-node generateIncludedImages.ts",
"generate:layouts": "ts-node createLayouts.ts",
"optimize-images": "cd assets/generated/ && find -name '*.png' -exec optipng '{}' \\; && echo 'PNGs are optimized'",
"generate": "npm run generate:images && npm run generate:layouts && npm run generate:editor-layer-index",
"build": "rm -rf dist/ npm run generate && parcel build --public-url ./ *.html assets/** assets/**/** assets/**/**/** vendor/* vendor/*/*",
"prepare-deploy": "npm run generate && npm run build && rm -rf .cache",
"deploy:staging": "npm run prepare-deploy && rm -rf /home/pietervdvn/git/pietervdvn.github.io/Staging/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/Staging/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean",
"deploy:production": "npm run prepare-deploy && npm run optimize-images && rm -rf /home/pietervdvn/git/pietervdvn.github.io/MapComplete/* && cp -r dist/* /home/pietervdvn/git/pietervdvn.github.io/MapComplete/ && cd /home/pietervdvn/git/pietervdvn.github.io/ && git add * && git commit -m 'New MapComplete Version' && git push && cd - && npm run clean",
"clean": "rm *.webmanifest && find *.html | grep -v \"\\(index\\|land\\|test\\|preferences\\|customGenerator\\).html\" | xargs rm"
},
"keywords": [
"OpenStreetMap",