diff --git a/Logic/Tags/And.ts b/Logic/Tags/And.ts index ef5789d7c..dd5112bd8 100644 --- a/Logic/Tags/And.ts +++ b/Logic/Tags/And.ts @@ -5,7 +5,19 @@ export class And extends TagsFilter { constructor(and: TagsFilter[]) { super(); - this.and = and; + this.and = and + } + + normalize(){ + const ands = [] + for (const c of this.and) { + if(c instanceof And){ + ands.push(...c.and) + }else{ + ands.push(c) + } + } + return new And(ands) } private static combine(filter: string, choices: string[]): string[] { @@ -64,17 +76,6 @@ export class And extends TagsFilter { return false; } - for (const selfTag of this.and) { - let matchFound = false; - for (let i = 0; i < other.and.length && !matchFound; i++) { - let otherTag = other.and[i]; - matchFound = selfTag.isEquivalent(otherTag); - } - if (!matchFound) { - return false; - } - } - for (const selfTag of this.and) { let matchFound = false; for (const otherTag of other.and) { diff --git a/Models/Constants.ts b/Models/Constants.ts index 7d3620d3d..ca3d9db4b 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import { Utils } from "../Utils"; export default class Constants { - public static vNumber = "0.9.5"; + public static vNumber = "0.9.6"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/UI/Base/Minimap.ts b/UI/Base/Minimap.ts index 84e43179b..61a5dfcb8 100644 --- a/UI/Base/Minimap.ts +++ b/UI/Base/Minimap.ts @@ -18,7 +18,7 @@ export default class Minimap extends BaseUIElement { private _allowMoving: boolean; private readonly _leafletoptions: any; private readonly _onFullyLoaded: (leaflet: L.Map) => void - private readonly _attribution: BaseUIElement; + private readonly _attribution: BaseUIElement | boolean; private readonly _lastClickLocation: UIEventSource<{ lat: number; lon: number }>; constructor(options?: { @@ -26,7 +26,7 @@ export default class Minimap extends BaseUIElement { location?: UIEventSource, allowMoving?: boolean, leafletOptions?: any, - attribution?: BaseUIElement, + attribution?: BaseUIElement | boolean, onFullyLoaded?: (leaflet: L.Map) => void, leafletMap?: UIEventSource, lastClickLocation?: UIEventSource<{ lat: number, lon: number }> @@ -122,8 +122,12 @@ export default class Minimap extends BaseUIElement { ); if (this._attribution !== undefined) { + if(this._attribution === true){ + map.attributionControl.setPrefix(false) + }else{ map.attributionControl.setPrefix( - "A"); + ""); + } } this._background.addCallbackAndRun(layer => { @@ -141,7 +145,9 @@ export default class Minimap extends BaseUIElement { } map.addLayer(newLayer); map.setMaxZoom(layer.max_zoom ?? map.getMaxZoom()) - self._attribution?.AttachTo('leaflet-attribution') + if (self._attribution !== true && self._attribution !== false) { + self._attribution?.AttachTo('leaflet-attribution') + } }) diff --git a/UI/BigComponents/SimpleAddUI.ts b/UI/BigComponents/SimpleAddUI.ts index 7fe4de815..aa1f88b1a 100644 --- a/UI/BigComponents/SimpleAddUI.ts +++ b/UI/BigComponents/SimpleAddUI.ts @@ -215,7 +215,10 @@ export default class SimpleAddUI extends Toggle { const disableFiltersOrConfirm = new Toggle( openLayerOrConfirm, disableFilter, - preset.layerToAddTo.appliedFilters.map(filters => filters === undefined || filters.and.length === 0) + preset.layerToAddTo.appliedFilters.map(filters => { + console.log("Current filters are ", filters) + return filters === undefined || filters.normalize().and.length === 0; + }) ) diff --git a/UI/ExportPDF.ts b/UI/ExportPDF.ts index a2bf6c784..6021a130e 100644 --- a/UI/ExportPDF.ts +++ b/UI/ExportPDF.ts @@ -34,7 +34,6 @@ export default class ExportPDF { private _screenhotTaken = false; public isRunning = new UIEventSource(true) - public loadedTiles = new UIEventSource(0) constructor( options: { diff --git a/UI/Input/LocationInput.ts b/UI/Input/LocationInput.ts index 423ceef31..baf27ff22 100644 --- a/UI/Input/LocationInput.ts +++ b/UI/Input/LocationInput.ts @@ -10,6 +10,7 @@ import AvailableBaseLayers from "../../Logic/Actors/AvailableBaseLayers"; import {GeoOperations} from "../../Logic/GeoOperations"; import ShowDataLayer from "../ShowDataLayer"; import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"; +import * as L from "leaflet"; export default class LocationInput extends InputElement { @@ -103,7 +104,7 @@ export default class LocationInput extends InputElement { this._value = this._snappedPoint.map(f => { const [lon, lat] = f.geometry.coordinates; return { - lon: lon, lat: lat, zoom: undefined + lon: lon, lat: lat, zoom: undefined } }) @@ -122,16 +123,59 @@ export default class LocationInput extends InputElement { protected InnerConstructElement(): HTMLElement { try { + const clickLocation = new UIEventSource(undefined); const map = new Minimap( { location: this._centerLocation, - background: this.mapBackground + background: this.mapBackground, + attribution: this.mapBackground !== State.state.backgroundLayer, + lastClickLocation: clickLocation } ) + clickLocation.addCallbackAndRunD(location => this._centerLocation.setData(location)) map.leafletMap.addCallbackAndRunD(leaflet => { - leaflet.setMaxBounds( - leaflet.getBounds().pad(0.15) - ) + const bounds = leaflet.getBounds() + leaflet.setMaxBounds(bounds.pad(0.15)) + const data = { + type: "FeatureCollection", + features: [{ + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ + bounds.getEast(), + bounds.getNorth() + ], + [ + bounds.getWest(), + bounds.getNorth() + ], + [ + bounds.getWest(), + bounds.getSouth() + ], + + [ + bounds.getEast(), + bounds.getSouth() + ], + [ + bounds.getEast(), + bounds.getNorth() + ] + ] + } + }] + } + // @ts-ignore + L.geoJSON(data, { + style: { + color: "#f00", + weight: 2, + opacity: 0.4 + } + }).addTo(leaflet) }) if (this._snapTo !== undefined) { @@ -164,15 +208,15 @@ export default class LocationInput extends InputElement { } leaflet.setMaxZoom(layer.max_zoom) - leaflet.setMinZoom(layer.max_zoom - 3) + leaflet.setMinZoom(layer.max_zoom - 2) leaflet.setZoom(layer.max_zoom - 1) }, [map.leafletMap]) return new Combine([ new Combine([ - Svg.crosshair_empty_ui() - .SetClass("block relative") - .SetStyle("left: -1.25rem; top: -1.25rem; width: 2.5rem; height: 2.5rem") + Svg.move_arrows_ui() + .SetClass("block relative pointer-events-none") + .SetStyle("left: -2.5rem; top: -2.5rem; width: 5rem; height: 5rem") ]).SetClass("block w-0 h-0 z-10 relative") .SetStyle("background: rgba(255, 128, 128, 0.21); left: 50%; top: 50%"), map diff --git a/assets/svg/hand.svg b/assets/svg/hand.svg new file mode 100644 index 000000000..522b3d92f --- /dev/null +++ b/assets/svg/hand.svg @@ -0,0 +1,54 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/assets/svg/license_info.json b/assets/svg/license_info.json index 91918b999..a789c54a1 100644 --- a/assets/svg/license_info.json +++ b/assets/svg/license_info.json @@ -1350,5 +1350,15 @@ "path": "loading.svg", "license": "CC0; trivial", "sources": [] + }, + { + "path": "hand.svg", + "license": "CC0", + "authors": [ + "Anomie" + ], + "sources": [ + "https://commons.wikimedia.org/wiki/File:Right-pointing_hand_in_green_octagon.svg" + ] } ] \ No newline at end of file diff --git a/assets/svg/move-arrows.svg b/assets/svg/move-arrows.svg new file mode 100644 index 000000000..6f2cf63a0 --- /dev/null +++ b/assets/svg/move-arrows.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/assets/svg/move-arrows.svg.license_info.json b/assets/svg/move-arrows.svg.license_info.json new file mode 100644 index 000000000..ca523dd34 --- /dev/null +++ b/assets/svg/move-arrows.svg.license_info.json @@ -0,0 +1,8 @@ +{ + "authors": [ + "Pieter Vander Vennet" + ], + "path": "move-arrows.svg", + "license": "CC0", + "sources": [] +} \ No newline at end of file