forked from MapComplete/MapComplete
		
	Re-enable button, add setting to choose how to add new features
This commit is contained in:
		
							parent
							
								
									25ff4b3a8c
								
							
						
					
					
						commit
						1acb645beb
					
				
					 12 changed files with 124 additions and 110 deletions
				
			
		| 
						 | 
					@ -3,7 +3,24 @@
 | 
				
			||||||
  "name": null,
 | 
					  "name": null,
 | 
				
			||||||
  "description": "This 'layer' is not really a layer, but contains part of the code how the popup to 'add a new marker' is displayed",
 | 
					  "description": "This 'layer' is not really a layer, but contains part of the code how the popup to 'add a new marker' is displayed",
 | 
				
			||||||
  "source": "special",
 | 
					  "source": "special",
 | 
				
			||||||
  "isShown": "mouse_button=right",
 | 
					  "isShown": {
 | 
				
			||||||
 | 
					    "or": [
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "and": [
 | 
				
			||||||
 | 
					          "mouse_button=right",
 | 
				
			||||||
 | 
					          "_usermode=button_click_right"
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "_usermode=button_click",
 | 
				
			||||||
 | 
					      "_usermode=click",
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "and": [
 | 
				
			||||||
 | 
					          "mouse_button=right",
 | 
				
			||||||
 | 
					          "_usermode=click_right"
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
  "title": {
 | 
					  "title": {
 | 
				
			||||||
    "mappings": [
 | 
					    "mappings": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -466,6 +466,44 @@
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      "id": "add-new-feature",
 | 
				
			||||||
 | 
					      "question": {
 | 
				
			||||||
 | 
					        "en": "How should the menu to add a new feature be opened?"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "mappings": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "if": "mapcomplete-preferences-add-new-mode=button",
 | 
				
			||||||
 | 
					          "then": {
 | 
				
			||||||
 | 
					            "en": "Adding a new feature is done with the button at the bottom left. Clicking the map does nothing"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "if": "mapcomplete-preferences-add-new-mode=click",
 | 
				
			||||||
 | 
					          "then": {
 | 
				
			||||||
 | 
					            "en": "When clicking or tapping the map, a marker pops up where a new feature is added"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "if": "mapcomplete-preferences-add-new-mode=click_right",
 | 
				
			||||||
 | 
					          "then": {
 | 
				
			||||||
 | 
					            "en": "When right-clicking or long-pressing the map, a marker pops up where a new feature can be added"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "if": "mapcomplete-preferences-add-new-mode=button_click",
 | 
				
			||||||
 | 
					          "then": {
 | 
				
			||||||
 | 
					            "en": "When clicking or tapping the map, a marker pops up where a new feature can be added. Additionally, a button at the bottom left is shown"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "if": "mapcomplete-preferences-add-new-mode=button_click_right",
 | 
				
			||||||
 | 
					          "then": {
 | 
				
			||||||
 | 
					            "en": "When right-clicking or long-pressing the map, a marker pops up where a new feature can be added. Additionally, a button at the bottom left is shown"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      "id": "fixate-north",
 | 
					      "id": "fixate-north",
 | 
				
			||||||
      "question": {
 | 
					      "question": {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,17 +1,13 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "id": "mapcomplete-changes",
 | 
					  "id": "mapcomplete-changes",
 | 
				
			||||||
  "title": {
 | 
					  "title": {
 | 
				
			||||||
    "en": "Changes made with MapComplete",
 | 
					    "en": "Changes made with MapComplete"
 | 
				
			||||||
    "de": "Änderungen mit MapComplete"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "shortDescription": {
 | 
					  "shortDescription": {
 | 
				
			||||||
    "en": "Shows changes made by MapComplete",
 | 
					    "en": "Shows changes made by MapComplete"
 | 
				
			||||||
    "de": "Änderungen von MapComplete anzeigen"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "description": {
 | 
					  "description": {
 | 
				
			||||||
    "en": "This maps shows all the changes made with MapComplete",
 | 
					    "en": "This maps shows all the changes made with MapComplete"
 | 
				
			||||||
    "de": "Diese Karte zeigt alle mit MapComplete vorgenommenen Änderungen",
 | 
					 | 
				
			||||||
    "pl": "Ta mapa pokazuje wszystkie zmiany wprowadzone za pomocą MapComplete"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "icon": "./assets/svg/logo.svg",
 | 
					  "icon": "./assets/svg/logo.svg",
 | 
				
			||||||
  "hideFromOverview": true,
 | 
					  "hideFromOverview": true,
 | 
				
			||||||
| 
						 | 
					@ -22,9 +18,7 @@
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      "id": "mapcomplete-changes",
 | 
					      "id": "mapcomplete-changes",
 | 
				
			||||||
      "name": {
 | 
					      "name": {
 | 
				
			||||||
        "en": "Changeset centers",
 | 
					        "en": "Changeset centers"
 | 
				
			||||||
        "de": "Zentrum der Änderungssätze",
 | 
					 | 
				
			||||||
        "zh_Hant": "變更集中心"
 | 
					 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "minzoom": 0,
 | 
					      "minzoom": 0,
 | 
				
			||||||
      "source": {
 | 
					      "source": {
 | 
				
			||||||
| 
						 | 
					@ -34,48 +28,41 @@
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "title": {
 | 
					      "title": {
 | 
				
			||||||
        "render": {
 | 
					        "render": {
 | 
				
			||||||
          "en": "Changeset for {theme}",
 | 
					          "en": "Changeset for {theme}"
 | 
				
			||||||
          "de": "Änderungssatz für {theme}"
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "description": {
 | 
					      "description": {
 | 
				
			||||||
        "en": "Shows all MapComplete changes",
 | 
					        "en": "Shows all MapComplete changes"
 | 
				
			||||||
        "de": "Alle MapComplete-Änderungen anzeigen"
 | 
					 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "tagRenderings": [
 | 
					      "tagRenderings": [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          "id": "show_changeset_id",
 | 
					          "id": "show_changeset_id",
 | 
				
			||||||
          "render": {
 | 
					          "render": {
 | 
				
			||||||
            "en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>",
 | 
					            "en": "Changeset <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
 | 
				
			||||||
            "de": "Änderungssatz <a href='https://openstreetmap.org/changeset/{id}' target='_blank'>{id}</a>"
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          "id": "contributor",
 | 
					          "id": "contributor",
 | 
				
			||||||
          "question": {
 | 
					          "question": {
 | 
				
			||||||
            "en": "What contributor did make this change?",
 | 
					            "en": "What contributor did make this change?"
 | 
				
			||||||
            "de": "Welcher Mitwirkende hat diese Änderung vorgenommen?"
 | 
					 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "freeform": {
 | 
					          "freeform": {
 | 
				
			||||||
            "key": "user"
 | 
					            "key": "user"
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "render": {
 | 
					          "render": {
 | 
				
			||||||
            "en": "Change made by <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>",
 | 
					            "en": "Change made by <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>"
 | 
				
			||||||
            "de": "Änderung vorgenommen von <a href='https://openstreetmap.org/user/{user}' target='_blank'>{user}</a>"
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          "id": "theme-id",
 | 
					          "id": "theme-id",
 | 
				
			||||||
          "question": {
 | 
					          "question": {
 | 
				
			||||||
            "en": "What theme was used to make this change?",
 | 
					            "en": "What theme was used to make this change?"
 | 
				
			||||||
            "de": "Welches Thema wurde für die Änderung verwendet?"
 | 
					 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "freeform": {
 | 
					          "freeform": {
 | 
				
			||||||
            "key": "theme"
 | 
					            "key": "theme"
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "render": {
 | 
					          "render": {
 | 
				
			||||||
            "en": "Change with theme <a href='https://mapcomplete.org/{theme}'>{theme}</a>",
 | 
					            "en": "Change with theme <a href='https://mapcomplete.org/{theme}'>{theme}</a>"
 | 
				
			||||||
            "de": "Geändert mit Thema <a href='https://mapcomplete.osm.be/{theme}'>{theme}</a>"
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -84,23 +71,19 @@
 | 
				
			||||||
            "key": "locale"
 | 
					            "key": "locale"
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "question": {
 | 
					          "question": {
 | 
				
			||||||
            "en": "What locale (language) was this change made in?",
 | 
					            "en": "What locale (language) was this change made in?"
 | 
				
			||||||
            "de": "In welcher Benutzersprache wurde die Änderung vorgenommen?"
 | 
					 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "render": {
 | 
					          "render": {
 | 
				
			||||||
            "en": "User locale is {locale}",
 | 
					            "en": "User locale is {locale}"
 | 
				
			||||||
            "de": "Benutzersprache {locale}"
 | 
					 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          "id": "host",
 | 
					          "id": "host",
 | 
				
			||||||
          "render": {
 | 
					          "render": {
 | 
				
			||||||
            "en": "Change with with <a href='{host}'>{host}</a>",
 | 
					            "en": "Change with with <a href='{host}'>{host}</a>"
 | 
				
			||||||
            "de": "Änderung über <a href='{host}'>{host}</a>"
 | 
					 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "question": {
 | 
					          "question": {
 | 
				
			||||||
            "en": "What host (website) was this change made with?",
 | 
					            "en": "What host (website) was this change made with?"
 | 
				
			||||||
            "de": "Über welchen Host (Webseite) wurde diese Änderung vorgenommen?"
 | 
					 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "freeform": {
 | 
					          "freeform": {
 | 
				
			||||||
            "key": "host"
 | 
					            "key": "host"
 | 
				
			||||||
| 
						 | 
					@ -121,12 +104,10 @@
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          "id": "version",
 | 
					          "id": "version",
 | 
				
			||||||
          "question": {
 | 
					          "question": {
 | 
				
			||||||
            "en": "What version of MapComplete was used to make this change?",
 | 
					            "en": "What version of MapComplete was used to make this change?"
 | 
				
			||||||
            "de": "Mit welcher MapComplete Version wurde die Änderung vorgenommen?"
 | 
					 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "render": {
 | 
					          "render": {
 | 
				
			||||||
            "en": "Made with {editor}",
 | 
					            "en": "Made with {editor}"
 | 
				
			||||||
            "de": "Erstellt mit {editor}"
 | 
					 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          "freeform": {
 | 
					          "freeform": {
 | 
				
			||||||
            "key": "editor"
 | 
					            "key": "editor"
 | 
				
			||||||
| 
						 | 
					@ -512,9 +493,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "Themename contains {search}",
 | 
					                "en": "Themename contains {search}"
 | 
				
			||||||
                "de": "Themenname enthält {search}",
 | 
					 | 
				
			||||||
                "pl": "Nazwa tematu zawiera {search}"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -530,8 +509,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "Themename does <b>not</b> contain {search}",
 | 
					                "en": "Themename does <b>not</b> contain {search}"
 | 
				
			||||||
                "de": "Themename enthält <b>not</b> {search}"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -547,8 +525,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "Made by contributor {search}",
 | 
					                "en": "Made by contributor {search}"
 | 
				
			||||||
                "de": "Erstellt vom Mitwirkenden {search}"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -564,8 +541,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "<b>Not</b> made by contributor {search}",
 | 
					                "en": "<b>Not</b> made by contributor {search}"
 | 
				
			||||||
                "de": "<b>Nicht</b> erstellt von Mitwirkendem {search}"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -582,8 +558,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "Made before {search}",
 | 
					                "en": "Made before {search}"
 | 
				
			||||||
                "de": "Erstellt vor {search}"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -600,8 +575,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "Made after {search}",
 | 
					                "en": "Made after {search}"
 | 
				
			||||||
                "de": "Erstellt nach {search}"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -617,8 +591,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "User language (iso-code) {search}",
 | 
					                "en": "User language (iso-code) {search}"
 | 
				
			||||||
                "de": "Benutzersprache (ISO-Code) {search}"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -634,8 +607,7 @@
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
              ],
 | 
					              ],
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "Made with host {search}",
 | 
					                "en": "Made with host {search}"
 | 
				
			||||||
                "de": "Erstellt mit Host {search}"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -646,8 +618,7 @@
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
              "osmTags": "add-image>0",
 | 
					              "osmTags": "add-image>0",
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "Changeset added at least one image",
 | 
					                "en": "Changeset added at least one image"
 | 
				
			||||||
                "de": "Änderungssatz hat mindestens ein Bild hinzugefügt"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -658,8 +629,7 @@
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
              "osmTags": "theme!=grb",
 | 
					              "osmTags": "theme!=grb",
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "Exclude GRB theme",
 | 
					                "en": "Exclude GRB theme"
 | 
				
			||||||
                "de": "GRB-Thema ausschließen"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -670,8 +640,7 @@
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
              "osmTags": "theme!=etymology",
 | 
					              "osmTags": "theme!=etymology",
 | 
				
			||||||
              "question": {
 | 
					              "question": {
 | 
				
			||||||
                "en": "Exclude etymology theme",
 | 
					                "en": "Exclude etymology theme"
 | 
				
			||||||
                "de": "Etymologie-Thema ausschließen"
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
| 
						 | 
					@ -686,8 +655,7 @@
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            "id": "link_to_more",
 | 
					            "id": "link_to_more",
 | 
				
			||||||
            "render": {
 | 
					            "render": {
 | 
				
			||||||
              "en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>",
 | 
					              "en": "More statistics can be found <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>here</a>"
 | 
				
			||||||
              "de": "Weitere Statistiken gibt es <a href='https://github.com/pietervdvn/MapComplete/tree/develop/Docs/Tools/graphs' target='_blank'>hier</a>"
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          },
 | 
					          },
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "name": "mapcomplete",
 | 
					  "name": "mapcomplete",
 | 
				
			||||||
  "version": "0.44.1",
 | 
					  "version": "0.44.2",
 | 
				
			||||||
  "repository": "https://github.com/pietervdvn/MapComplete",
 | 
					  "repository": "https://github.com/pietervdvn/MapComplete",
 | 
				
			||||||
  "description": "A small website to edit OSM easily",
 | 
					  "description": "A small website to edit OSM easily",
 | 
				
			||||||
  "bugs": "https://github.com/pietervdvn/MapComplete/issues",
 | 
					  "bugs": "https://github.com/pietervdvn/MapComplete/issues",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
import LayoutConfig from "../../../Models/ThemeConfig/LayoutConfig"
 | 
					import LayoutConfig from "../../../Models/ThemeConfig/LayoutConfig"
 | 
				
			||||||
import { ImmutableStore, Store } from "../../UIEventSource"
 | 
					import { ImmutableStore, Store, UIEventSource } from "../../UIEventSource"
 | 
				
			||||||
import { Feature, Point } from "geojson"
 | 
					import { Feature, Point } from "geojson"
 | 
				
			||||||
import { TagUtils } from "../../Tags/TagUtils"
 | 
					import { TagUtils } from "../../Tags/TagUtils"
 | 
				
			||||||
import BaseUIElement from "../../../UI/BaseUIElement"
 | 
					import BaseUIElement from "../../../UI/BaseUIElement"
 | 
				
			||||||
| 
						 | 
					@ -18,10 +18,13 @@ export class LastClickFeatureSource implements FeatureSource {
 | 
				
			||||||
    private readonly hasNoteLayer: boolean
 | 
					    private readonly hasNoteLayer: boolean
 | 
				
			||||||
    public static readonly newPointElementId = "new_point_dialog"
 | 
					    public static readonly newPointElementId = "new_point_dialog"
 | 
				
			||||||
    public readonly features: Store<Feature[]>
 | 
					    public readonly features: Store<Feature[]>
 | 
				
			||||||
 | 
					    private _usermode: UIEventSource<string>
 | 
				
			||||||
    constructor(
 | 
					    constructor(
 | 
				
			||||||
        layout: LayoutConfig,
 | 
					        layout: LayoutConfig,
 | 
				
			||||||
        clickSource: Store<{ lon: number; lat: number; mode: "left" | "right" | "middle" }>
 | 
					        clickSource: Store<{ lon: number; lat: number; mode: "left" | "right" | "middle" }>,
 | 
				
			||||||
 | 
					        usermode?: UIEventSource<string>
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
 | 
					        this._usermode = usermode
 | 
				
			||||||
        this.hasNoteLayer = layout.hasNoteLayer()
 | 
					        this.hasNoteLayer = layout.hasNoteLayer()
 | 
				
			||||||
        this.hasPresets = layout.hasPresets()
 | 
					        this.hasPresets = layout.hasPresets()
 | 
				
			||||||
        const allPresets: BaseUIElement[] = []
 | 
					        const allPresets: BaseUIElement[] = []
 | 
				
			||||||
| 
						 | 
					@ -65,6 +68,7 @@ export class LastClickFeatureSource implements FeatureSource {
 | 
				
			||||||
            number_of_presets: "" + this.renderings.length,
 | 
					            number_of_presets: "" + this.renderings.length,
 | 
				
			||||||
            first_preset: this.renderings[0],
 | 
					            first_preset: this.renderings[0],
 | 
				
			||||||
            mouse_button: mode ?? "none",
 | 
					            mouse_button: mode ?? "none",
 | 
				
			||||||
 | 
					            _usermode: this._usermode?.data
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        this.i++
 | 
					        this.i++
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,6 +118,9 @@ export default class MetaTagging {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        const state = this.state
 | 
					        const state = this.state
 | 
				
			||||||
        const layer = state.layout.getMatchingLayer(feature.properties)
 | 
					        const layer = state.layout.getMatchingLayer(feature.properties)
 | 
				
			||||||
 | 
					        if(!layer){
 | 
				
			||||||
 | 
					            return
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        // Force update if the tags of the element changed
 | 
					        // Force update if the tags of the element changed
 | 
				
			||||||
        MetaTagging.addMetatags(
 | 
					        MetaTagging.addMetatags(
 | 
				
			||||||
            [feature],
 | 
					            [feature],
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,6 +61,9 @@ export default class UserRelatedState {
 | 
				
			||||||
        7 * 24 * 60 * 60,
 | 
					        7 * 24 * 60 * 60,
 | 
				
			||||||
        "gps_location_retention"
 | 
					        "gps_location_retention"
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public readonly addNewFeatureMode = new UIEventSource<"button" | "button_click_right" | "button_click" | "click" | "click_right">("button_click_right")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Preferences as tags exposes many preferences and state properties as record.
 | 
					     * Preferences as tags exposes many preferences and state properties as record.
 | 
				
			||||||
     * This is used to bridge the internal state with the usersettings.json layerconfig file
 | 
					     * This is used to bridge the internal state with the usersettings.json layerconfig file
 | 
				
			||||||
| 
						 | 
					@ -127,6 +130,14 @@ export default class UserRelatedState {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        this.addNewFeatureMode = this.osmConnection.GetPreference(
 | 
				
			||||||
 | 
					            "preferences-add-new-mode",
 | 
				
			||||||
 | 
					            "button_click_right",
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                documentation: "How adding a new feature is done"
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.imageLicense = this.osmConnection.GetPreference("pictures-license", "CC0", {
 | 
					        this.imageLicense = this.osmConnection.GetPreference("pictures-license", "CC0", {
 | 
				
			||||||
            documentation: "The license under which new images are uploaded",
 | 
					            documentation: "The license under which new images are uploaded",
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,39 +4,11 @@ export class ThemeMetaTagging {
 | 
				
			||||||
   public static readonly themeName = "usersettings"
 | 
					   public static readonly themeName = "usersettings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   public metaTaggging_for_usersettings(feat: {properties: Record<string, string>}) {
 | 
					   public metaTaggging_for_usersettings(feat: {properties: Record<string, string>}) {
 | 
				
			||||||
        Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_md", () =>
 | 
					      Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_md', () => feat.properties._description.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)?.at(1) ) 
 | 
				
			||||||
            feat.properties._description
 | 
					      Utils.AddLazyProperty(feat.properties, '_d', () => feat.properties._description?.replace(/</g,'<')?.replace(/>/g,'>') ?? '' ) 
 | 
				
			||||||
                .match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)
 | 
					      Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href   }) (feat)  ) 
 | 
				
			||||||
                ?.at(1)
 | 
					      Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat)  ) 
 | 
				
			||||||
        )
 | 
					      Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a ) 
 | 
				
			||||||
        Utils.AddLazyProperty(
 | 
					      feat.properties['__current_backgroun'] = 'initial_value'
 | 
				
			||||||
            feat.properties,
 | 
					 | 
				
			||||||
            "_d",
 | 
					 | 
				
			||||||
            () => feat.properties._description?.replace(/</g, "<")?.replace(/>/g, ">") ?? ""
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
        Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_a", () =>
 | 
					 | 
				
			||||||
            ((feat) => {
 | 
					 | 
				
			||||||
                const e = document.createElement("div")
 | 
					 | 
				
			||||||
                e.innerHTML = feat.properties._d
 | 
					 | 
				
			||||||
                return Array.from(e.getElementsByTagName("a")).filter(
 | 
					 | 
				
			||||||
                    (a) => a.href.match(/mastodon|en.osm.town/) !== null
 | 
					 | 
				
			||||||
                )[0]?.href
 | 
					 | 
				
			||||||
            })(feat)
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
        Utils.AddLazyProperty(feat.properties, "_mastodon_link", () =>
 | 
					 | 
				
			||||||
            ((feat) => {
 | 
					 | 
				
			||||||
                const e = document.createElement("div")
 | 
					 | 
				
			||||||
                e.innerHTML = feat.properties._d
 | 
					 | 
				
			||||||
                return Array.from(e.getElementsByTagName("a")).filter(
 | 
					 | 
				
			||||||
                    (a) => a.getAttribute("rel")?.indexOf("me") >= 0
 | 
					 | 
				
			||||||
                )[0]?.href
 | 
					 | 
				
			||||||
            })(feat)
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
        Utils.AddLazyProperty(
 | 
					 | 
				
			||||||
            feat.properties,
 | 
					 | 
				
			||||||
            "_mastodon_candidate",
 | 
					 | 
				
			||||||
            () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
        feat.properties["__current_backgroun"] = "initial_value"
 | 
					 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -331,6 +331,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
 | 
				
			||||||
        this.lastClickObject = new LastClickFeatureSource(
 | 
					        this.lastClickObject = new LastClickFeatureSource(
 | 
				
			||||||
            this.layout,
 | 
					            this.layout,
 | 
				
			||||||
            this.mapProperties.lastClickLocation,
 | 
					            this.mapProperties.lastClickLocation,
 | 
				
			||||||
 | 
					            this.userRelatedState.addNewFeatureMode
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.osmObjectDownloader = new OsmObjectDownloader(
 | 
					        this.osmObjectDownloader = new OsmObjectDownloader(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,7 @@
 | 
				
			||||||
  import Delete_icon from "../../assets/svg/Delete_icon.svelte"
 | 
					  import Delete_icon from "../../assets/svg/Delete_icon.svelte"
 | 
				
			||||||
  import BackButton from "../Base/BackButton.svelte"
 | 
					  import BackButton from "../Base/BackButton.svelte"
 | 
				
			||||||
  import TagRenderingEditableDynamic from "../Popup/TagRendering/TagRenderingEditableDynamic.svelte"
 | 
					  import TagRenderingEditableDynamic from "../Popup/TagRendering/TagRenderingEditableDynamic.svelte"
 | 
				
			||||||
 | 
					  import { LastClickFeatureSource } from "../../Logic/FeatureSource/Sources/LastClickFeatureSource"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  export let state: SpecialVisualizationState
 | 
					  export let state: SpecialVisualizationState
 | 
				
			||||||
  export let selectedElement: Feature
 | 
					  export let selectedElement: Feature
 | 
				
			||||||
| 
						 | 
					@ -25,7 +26,7 @@
 | 
				
			||||||
    if (properties.id === "settings") {
 | 
					    if (properties.id === "settings") {
 | 
				
			||||||
      return UserRelatedState.usersettingsConfig
 | 
					      return UserRelatedState.usersettingsConfig
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (properties.id === "new_point_dialog") {
 | 
					    if (properties.id.startsWith(LastClickFeatureSource.newPointElementId)) {
 | 
				
			||||||
      return state.layout.layers.find((l) => l.id === "last_click")
 | 
					      return state.layout.layers.find((l) => l.id === "last_click")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (properties.id === "location_track") {
 | 
					    if (properties.id === "location_track") {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -148,10 +148,8 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
 | 
				
			||||||
            map.on("click", (e) => {
 | 
					            map.on("click", (e) => {
 | 
				
			||||||
                handleClick(e)
 | 
					                handleClick(e)
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            map.on("contextmenu", (e) => {
 | 
					
 | 
				
			||||||
                // This one only works on desktop
 | 
					            // map.on("contextmenu", ...) only works on desktop, hence we listen to the container:
 | 
				
			||||||
                handleClick(e, "right")
 | 
					 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            map._container.addEventListener("contextmenu", (e) => {
 | 
					            map._container.addEventListener("contextmenu", (e) => {
 | 
				
			||||||
                const lngLat = map.unproject([e.x, e.y])
 | 
					                const lngLat = map.unproject([e.x, e.y])
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,7 +108,7 @@
 | 
				
			||||||
    if (element.properties.id.startsWith("current_view")) {
 | 
					    if (element.properties.id.startsWith("current_view")) {
 | 
				
			||||||
      return currentViewLayer
 | 
					      return currentViewLayer
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (element.properties.id === "new_point_dialog") {
 | 
					    if (element.properties.id.startsWith(LastClickFeatureSource.newPointElementId)) {
 | 
				
			||||||
      return layout.layers.find((l) => l.id === "last_click")
 | 
					      return layout.layers.find((l) => l.id === "last_click")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (element.properties.id === "location_track") {
 | 
					    if (element.properties.id === "location_track") {
 | 
				
			||||||
| 
						 | 
					@ -206,6 +206,7 @@
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  let openFilterButton: UIEventSource<HTMLElement> = new UIEventSource<HTMLElement>(undefined)
 | 
					  let openFilterButton: UIEventSource<HTMLElement> = new UIEventSource<HTMLElement>(undefined)
 | 
				
			||||||
  let openBackgroundButton: UIEventSource<HTMLElement> = new UIEventSource<HTMLElement>(undefined)
 | 
					  let openBackgroundButton: UIEventSource<HTMLElement> = new UIEventSource<HTMLElement>(undefined)
 | 
				
			||||||
 | 
					  let addNewFeatureMode = state.userRelatedState.addNewFeatureMode
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<main>
 | 
					<main>
 | 
				
			||||||
| 
						 | 
					@ -306,7 +307,7 @@
 | 
				
			||||||
    <div class="flex w-full items-end justify-between px-4">
 | 
					    <div class="flex w-full items-end justify-between px-4">
 | 
				
			||||||
      <div class="flex flex-col">
 | 
					      <div class="flex flex-col">
 | 
				
			||||||
        <If condition={featureSwitches.featureSwitchEnableLogin}>
 | 
					        <If condition={featureSwitches.featureSwitchEnableLogin}>
 | 
				
			||||||
          {#if (state.layout.hasPresets() && state.layout.enableAddNewPoints) || state.layout.hasNoteLayer()}
 | 
					          {#if $addNewFeatureMode.indexOf("button") >= 0 && ((state.layout.hasPresets() && state.layout.enableAddNewPoints) || state.layout.hasNoteLayer())}
 | 
				
			||||||
            <button
 | 
					            <button
 | 
				
			||||||
              class="low-interaction pointer-events-auto w-fit"
 | 
					              class="low-interaction pointer-events-auto w-fit"
 | 
				
			||||||
              class:disabled={$currentZoom < Constants.minZoomLevelToAddNewPoint}
 | 
					              class:disabled={$currentZoom < Constants.minZoomLevelToAddNewPoint}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue