forked from MapComplete/MapComplete
Also pickup wikimedia categories in the image tags, fix #433
This commit is contained in:
parent
8cbb693c98
commit
32cbd6e2c1
6 changed files with 55 additions and 31 deletions
|
@ -19,7 +19,6 @@ import CreateNewNodeAction from "../../Logic/Osm/Actions/CreateNewNodeAction";
|
|||
import {OsmObject, OsmWay} from "../../Logic/Osm/OsmObject";
|
||||
import PresetConfig from "../../Models/ThemeConfig/PresetConfig";
|
||||
import FilteredLayer from "../../Models/FilteredLayer";
|
||||
import {And} from "../../Logic/Tags/And";
|
||||
import {BBox} from "../../Logic/BBox";
|
||||
|
||||
/*
|
||||
|
@ -230,7 +229,25 @@ export default class SimpleAddUI extends Toggle {
|
|||
const disableFiltersOrConfirm = new Toggle(
|
||||
openLayerOrConfirm,
|
||||
disableFilter,
|
||||
preset.layerToAddTo.appliedFilters.map(filters => filters === undefined || filters.length === 0)
|
||||
preset.layerToAddTo.appliedFilters.map(filters => {
|
||||
if(filters === undefined || filters.length === 0){
|
||||
return true;
|
||||
}
|
||||
for (const filter of filters) {
|
||||
if(filter.selected === 0 && filter.filter.options.length === 1){
|
||||
return false;
|
||||
}
|
||||
if(filter.selected !== undefined){
|
||||
const tags = filter.filter.options[filter.selected].osmTags
|
||||
if(tags !== undefined && tags["and"]?.length !== 0){
|
||||
// This actually doesn't filter anything at all
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -66,16 +66,10 @@ export default class SpecialVisualizations {
|
|||
name: "image key/prefix",
|
||||
defaultValue: "image",
|
||||
doc: "The keys given to the images, e.g. if <span class='literal-code'>image</span> is given, the first picture URL will be added as <span class='literal-code'>image</span>, the second as <span class='literal-code'>image:0</span>, the third as <span class='literal-code'>image:1</span>, etc... "
|
||||
},
|
||||
{
|
||||
name: "smart search",
|
||||
defaultValue: "true",
|
||||
doc: "Also include images given via 'Wikidata', 'wikimedia_commons' and 'mapillary"
|
||||
}],
|
||||
}],
|
||||
constr: (state: State, tags, args) => {
|
||||
const imagePrefix = args[0];
|
||||
const loadSpecial = args[1].toLowerCase() === "true";
|
||||
return new ImageCarousel(AllImageProviders.LoadImagesFor(tags, imagePrefix, loadSpecial), tags);
|
||||
return new ImageCarousel(AllImageProviders.LoadImagesFor(tags, imagePrefix), tags);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue