diff --git a/Logic/Actors/AvailableBaseLayers.ts b/Logic/Actors/AvailableBaseLayers.ts index b5eabd3af..db178dd78 100644 --- a/Logic/Actors/AvailableBaseLayers.ts +++ b/Logic/Actors/AvailableBaseLayers.ts @@ -1,6 +1,5 @@ -console.log("AVAILABLE LAYERS") import * as editorlayerindex from "../../assets/editor-layer-index.json" -import {BaseLayer} from "../../Models/BaseLayer"; +import BaseLayer from "../../Models/BaseLayer"; import * as L from "leaflet"; import * as X from "leaflet-providers"; import {UIEventSource} from "../UIEventSource"; diff --git a/Logic/Actors/LayerResetter.ts b/Logic/Actors/LayerResetter.ts index a38ac2b5b..3a4aa562d 100644 --- a/Logic/Actors/LayerResetter.ts +++ b/Logic/Actors/LayerResetter.ts @@ -1,5 +1,5 @@ import {UIEventSource} from "../UIEventSource"; -import {BaseLayer} from "../../Models/BaseLayer"; +import BaseLayer from "../../Models/BaseLayer"; import AvailableBaseLayers from "./AvailableBaseLayers"; import Loc from "../../Models/Loc"; diff --git a/Logic/Osm/ChangesetHandler.ts b/Logic/Osm/ChangesetHandler.ts index 3cae888be..5e05e6e92 100644 --- a/Logic/Osm/ChangesetHandler.ts +++ b/Logic/Osm/ChangesetHandler.ts @@ -1,4 +1,5 @@ import escapeHtml from "escape-html"; +// @ts-ignore import {OsmConnection, UserDetails} from "./OsmConnection"; import {UIEventSource} from "../UIEventSource"; import {ElementStorage} from "../ElementStorage"; diff --git a/Logic/Osm/Geocoding.ts b/Logic/Osm/Geocoding.ts index 5629fa143..85f5c5ea2 100644 --- a/Logic/Osm/Geocoding.ts +++ b/Logic/Osm/Geocoding.ts @@ -1,4 +1,3 @@ -import {Basemap} from "../Leaflet/Basemap"; import $ from "jquery" import State from "../../State"; export class Geocoding { diff --git a/Logic/Osm/OsmPreferences.ts b/Logic/Osm/OsmPreferences.ts index 7a006398a..7b82c2180 100644 --- a/Logic/Osm/OsmPreferences.ts +++ b/Logic/Osm/OsmPreferences.ts @@ -1,5 +1,5 @@ import {UIEventSource} from "../UIEventSource"; -import {OsmConnection, UserDetails} from "./OsmConnection"; +import UserDetails, {OsmConnection} from "./OsmConnection"; import {Utils} from "../../Utils"; export class OsmPreferences { diff --git a/Logic/Web/CodeGrid.ts b/Logic/Web/CodeGrid.ts deleted file mode 100644 index 78bb5f5c2..000000000 --- a/Logic/Web/CodeGrid.ts +++ /dev/null @@ -1,26 +0,0 @@ -import codegrid from "codegrid-js"; - -export default class CodeGrid { - private static readonly grid = CodeGrid.InitGrid(); - - - public static getCode(lat: any, lon: any, handle: (error, code) => void) { - CodeGrid.grid.getCode(lat, lon, handle); - } - - - private static InitGrid(): any { - const grid = codegrid.CodeGrid("./tiles/"); - - // Heat up the caches - grid.getCode(50.2, 3.2, (error, code) => { - }); - grid.getCode(52.5072, 13.4248, (error, code) => { - }); - grid.getCode(40.4781, -3.7034, () => { - }); - return grid; - } - - -} \ No newline at end of file diff --git a/UI/BigComponents/Attribution.ts b/UI/BigComponents/Attribution.ts index 43f2c8b29..a419a1d83 100644 --- a/UI/BigComponents/Attribution.ts +++ b/UI/BigComponents/Attribution.ts @@ -3,7 +3,7 @@ import Link from "../Base/Link"; import Svg from "../../Svg"; import Combine from "../Base/Combine"; import {UIEventSource} from "../../Logic/UIEventSource"; -import {UserDetails} from "../../Logic/Osm/OsmConnection"; +import UserDetails from "../../Logic/Osm/OsmConnection"; import Constants from "../../Models/Constants"; import LayoutConfig from "../../Customizations/JSON/LayoutConfig"; import Loc from "../../Models/Loc"; @@ -19,7 +19,7 @@ export default class Attribution extends UIElement { constructor(location: UIEventSource, userDetails: UIEventSource, layoutToUse: UIEventSource, - leafletMap: UIEventSource) { + leafletMap: UIEventSource) { super(location); this._layoutToUse = layoutToUse; this.ListenTo(layoutToUse); @@ -49,7 +49,7 @@ export default class Attribution extends UIElement { if (location !== undefined && this._leafletMap.data !== undefined && userDetails.csCount >= Constants.userJourney.tagsVisibleAndWikiLinked) { - const bounds = this._leafletMap.data.getBounds(); + const bounds : any= this._leafletMap.data.getBounds(); const top = bounds.getNorth(); const bottom = bounds.getSouth(); const right = bounds.getEast(); diff --git a/UI/BigComponents/BackgroundSelector.ts b/UI/BigComponents/BackgroundSelector.ts index 2f5824545..c04eba35d 100644 --- a/UI/BigComponents/BackgroundSelector.ts +++ b/UI/BigComponents/BackgroundSelector.ts @@ -3,7 +3,7 @@ import {DropDown} from "../Input/DropDown"; import Translations from "../i18n/Translations"; import State from "../../State"; import {UIEventSource} from "../../Logic/UIEventSource"; -import {BaseLayer} from "../../Models/BaseLayer"; +import BaseLayer from "../../Models/BaseLayer"; export default class BackgroundSelector extends UIElement { diff --git a/UI/BigComponents/SimpleAddUI.ts b/UI/BigComponents/SimpleAddUI.ts index 83309e3ca..c2c73aed6 100644 --- a/UI/BigComponents/SimpleAddUI.ts +++ b/UI/BigComponents/SimpleAddUI.ts @@ -12,6 +12,7 @@ import Combine from "../Base/Combine"; import {FixedUiElement} from "../Base/FixedUiElement"; import Translations from "../i18n/Translations"; import Constants from "../../Models/Constants"; +import LayerConfig from "../../Customizations/JSON/LayerConfig"; export default class SimpleAddUI extends UIElement { private readonly _addButtons: UIElement[]; @@ -24,7 +25,7 @@ export default class SimpleAddUI extends UIElement { icon: UIElement, tags: Tag[], layerToAddTo: { - name: UIElement | string, + layerDef: LayerConfig, isDisplayed: UIEventSource } }> = new UIEventSource(undefined); @@ -128,7 +129,7 @@ export default class SimpleAddUI extends UIElement { if(!this._confirmPreset.data.layerToAddTo.isDisplayed.data){ return new Combine([ - Translations.t.general.add.layerNotEnabled.Subs({layer: this._confirmPreset.data.layerToAddTo.name}) + Translations.t.general.add.layerNotEnabled.Subs({layer: this._confirmPreset.data.layerToAddTo.layerDef.name}) .SetClass("alert"), this.openLayerControl, diff --git a/UI/BigComponents/UserBadge.ts b/UI/BigComponents/UserBadge.ts index a1ad4b566..19de2db05 100644 --- a/UI/BigComponents/UserBadge.ts +++ b/UI/BigComponents/UserBadge.ts @@ -4,7 +4,7 @@ import {UIEventSource} from "../../Logic/UIEventSource"; import {UIElement} from "../UIElement"; import {VariableUiElement} from "../Base/VariableUIElement"; -import {UserDetails} from "../../Logic/Osm/OsmConnection"; +import UserDetails from "../../Logic/Osm/OsmConnection"; import Svg from "../../Svg"; import State from "../../State"; import Combine from "../Base/Combine"; diff --git a/UI/CustomGenerator/AllLayersPanel.ts b/UI/CustomGenerator/AllLayersPanel.ts index c214f9351..588af7f2e 100644 --- a/UI/CustomGenerator/AllLayersPanel.ts +++ b/UI/CustomGenerator/AllLayersPanel.ts @@ -6,7 +6,7 @@ import {LayoutConfigJson} from "../../Customizations/JSON/LayoutConfigJson"; import Combine from "../Base/Combine"; import {GenerateEmpty} from "./GenerateEmpty"; import LayerPanelWithPreview from "./LayerPanelWithPreview"; -import {UserDetails} from "../../Logic/Osm/OsmConnection"; +import UserDetails from "../../Logic/Osm/OsmConnection"; import {MultiInput} from "../Input/MultiInput"; import TagRenderingPanel from "./TagRenderingPanel"; import SingleSetting from "./SingleSetting"; diff --git a/UI/CustomGenerator/CustomGeneratorPanel.ts b/UI/CustomGenerator/CustomGeneratorPanel.ts index 2d5f1a29f..99414cbe2 100644 --- a/UI/CustomGenerator/CustomGeneratorPanel.ts +++ b/UI/CustomGenerator/CustomGeneratorPanel.ts @@ -1,5 +1,5 @@ import {UIElement} from "../UIElement"; -import {OsmConnection, UserDetails} from "../../Logic/Osm/OsmConnection"; +import UserDetails, {OsmConnection} from "../../Logic/Osm/OsmConnection"; import {UIEventSource} from "../../Logic/UIEventSource"; import SingleSetting from "./SingleSetting"; import GeneralSettings from "./GeneralSettings"; @@ -11,7 +11,6 @@ import AllLayersPanel from "./AllLayersPanel"; import SharePanel from "./SharePanel"; import {LayoutConfigJson} from "../../Customizations/JSON/LayoutConfigJson"; import {SubtleButton} from "../Base/SubtleButton"; -import State from "../../State"; import {FixedUiElement} from "../Base/FixedUiElement"; import SavePanel from "./SavePanel"; import {LocalStorageSource} from "../../Logic/Web/LocalStorageSource"; diff --git a/UI/CustomGenerator/LayerPanel.ts b/UI/CustomGenerator/LayerPanel.ts index 759104086..9dcaa9d33 100644 --- a/UI/CustomGenerator/LayerPanel.ts +++ b/UI/CustomGenerator/LayerPanel.ts @@ -16,8 +16,7 @@ import {TagRenderingConfigJson} from "../../Customizations/JSON/TagRenderingConf import {MultiInput} from "../Input/MultiInput"; import {LayerConfigJson} from "../../Customizations/JSON/LayerConfigJson"; import PresetInputPanel from "./PresetInputPanel"; -import {UserDetails} from "../../Logic/Osm/OsmConnection"; -import State from "../../State"; +import UserDetails from "../../Logic/Osm/OsmConnection"; import {FixedUiElement} from "../Base/FixedUiElement"; import ValidatedTextField from "../Input/ValidatedTextField"; import Svg from "../../Svg"; diff --git a/UI/CustomGenerator/LayerPanelWithPreview.ts b/UI/CustomGenerator/LayerPanelWithPreview.ts index ec2e56fad..3c0d19cc3 100644 --- a/UI/CustomGenerator/LayerPanelWithPreview.ts +++ b/UI/CustomGenerator/LayerPanelWithPreview.ts @@ -8,7 +8,7 @@ import {FromJSON} from "../../Customizations/JSON/FromJSON"; import Combine from "../Base/Combine"; import PageSplit from "../Base/PageSplit"; import TagRenderingPreview from "./TagRenderingPreview"; -import {UserDetails} from "../../Logic/Osm/OsmConnection"; +import UserDetails from "../../Logic/Osm/OsmConnection"; export default class LayerPanelWithPreview extends UIElement{ diff --git a/UI/CustomGenerator/SharePanel.ts b/UI/CustomGenerator/SharePanel.ts index ec72af7d5..ddb6d130b 100644 --- a/UI/CustomGenerator/SharePanel.ts +++ b/UI/CustomGenerator/SharePanel.ts @@ -3,7 +3,7 @@ import {UIEventSource} from "../../Logic/UIEventSource"; import {LayoutConfigJson} from "../../Customizations/JSON/LayoutConfigJson"; import Combine from "../Base/Combine"; import {VariableUiElement} from "../Base/VariableUIElement"; -import {UserDetails} from "../../Logic/Osm/OsmConnection"; +import UserDetails from "../../Logic/Osm/OsmConnection"; export default class SharePanel extends UIElement { private _config: UIEventSource; diff --git a/UI/CustomGenerator/TagRenderingPanel.ts b/UI/CustomGenerator/TagRenderingPanel.ts index bc52462eb..211400498 100644 --- a/UI/CustomGenerator/TagRenderingPanel.ts +++ b/UI/CustomGenerator/TagRenderingPanel.ts @@ -12,8 +12,7 @@ import {MultiInput} from "../Input/MultiInput"; import MappingInput from "./MappingInput"; import {AndOrTagConfigJson} from "../../Customizations/JSON/TagConfigJson"; import {TagRenderingConfigJson} from "../../Customizations/JSON/TagRenderingConfigJson"; -import {UserDetails} from "../../Logic/Osm/OsmConnection"; -import State from "../../State"; +import UserDetails from "../../Logic/Osm/OsmConnection"; import {VariableUiElement} from "../Base/VariableUIElement"; import ValidatedTextField from "../Input/ValidatedTextField"; import SpecialVisualizations from "../SpecialVisualizations"; diff --git a/UI/Reviews/ReviewForm.ts b/UI/Reviews/ReviewForm.ts index 8502ee3c5..55379b73d 100644 --- a/UI/Reviews/ReviewForm.ts +++ b/UI/Reviews/ReviewForm.ts @@ -9,7 +9,7 @@ import Svg from "../../Svg"; import {VariableUiElement} from "../Base/VariableUIElement"; import {SaveButton} from "../Popup/SaveButton"; import CheckBoxes from "../Input/Checkboxes"; -import {UserDetails} from "../../Logic/Osm/OsmConnection"; +import UserDetails from "../../Logic/Osm/OsmConnection"; export default class ReviewForm extends InputElement { diff --git a/UI/ShowDataLayer.ts b/UI/ShowDataLayer.ts index 18d2986c2..55c995784 100644 --- a/UI/ShowDataLayer.ts +++ b/UI/ShowDataLayer.ts @@ -39,12 +39,10 @@ export default class ShowDataLayer { const feats = features.data.map(ff => ff.feature); const geoLayer = self.CreateGeojsonLayer(feats); - if (oldGeoLayer) { mp.removeLayer(oldGeoLayer); } - - geoLayer.addTo(mp); + mp.addLayer(geoLayer); oldGeoLayer = geoLayer; } diff --git a/index.html b/index.html index abc12e710..c1aa02008 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ - + diff --git a/package-lock.json b/package-lock.json index 1dee0754e..70162453d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3589,6 +3589,14 @@ "@types/leaflet": "*" } }, + "@types/leaflet.markercluster": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@types/leaflet.markercluster/-/leaflet.markercluster-1.4.3.tgz", + "integrity": "sha512-X/b/Enz84PzmcA9z7pxsHEBEUNghmvznEBcRQeuxyYL/QU6jAR7LIb/ot03ATNPO56wSFzbCnsOf7yJ+7FzS1Q==", + "requires": { + "@types/leaflet": "*" + } + }, "@types/node": { "version": "7.10.11", "resolved": "https://registry.npmjs.org/@types/node/-/node-7.10.11.tgz", @@ -7058,6 +7066,11 @@ "resolved": "https://registry.npmjs.org/leaflet-providers/-/leaflet-providers-1.10.2.tgz", "integrity": "sha512-1l867LObxwuFBeyPeBewip8PAXKOnvEoujq4/9y2TKTiZNHH76ksBD6dfktGjgUrOF+IdjsGHkpASPE+v2DQLw==" }, + "leaflet.markercluster": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/leaflet.markercluster/-/leaflet.markercluster-1.4.1.tgz", + "integrity": "sha512-ZSEpE/EFApR0bJ1w/dUGwTSUvWlpalKqIzkaYdYB7jaftQA/Y2Jav+eT4CMtEYFj+ZK4mswP13Q2acnPBnhGOw==" + }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", diff --git a/package.json b/package.json index dada662e0..5e604d7d9 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "license": "GPL", "dependencies": { "@types/leaflet-providers": "^1.2.0", + "@types/leaflet.markercluster": "^1.4.3", "country-language": "^0.1.7", "email-validator": "^2.0.4", "escape-html": "^1.0.3", @@ -38,6 +39,7 @@ "latlon2country": "^1.0.8", "leaflet": "^1.7.1", "leaflet-providers": "^1.10.2", + "leaflet.markercluster": "^1.4.1", "libphonenumber": "0.0.10", "libphonenumber-js": "^1.7.55", "mangrove-reviews": "^0.1.3", diff --git a/test.ts b/test.ts index 2c474204d..d4ebb8525 100644 --- a/test.ts +++ b/test.ts @@ -6,19 +6,6 @@ import ReviewForm from "./UI/Reviews/ReviewForm"; import Combine from "./UI/Base/Combine"; import {FixedUiElement} from "./UI/Base/FixedUiElement"; -const identity = '{"crv":"P-256","d":"6NHPmTFRedjNl-ZfLRAXhOaNKtRR9GYzPHsO1CzN5wQ","ext":true,"key_ops":["sign"],"kty":"EC","x":"Thm_pL5m0m9Jl41z9vgMTHNyja-9H58v0stJWT4KhTI","y":"PjBldCW85b8K6jEZbw0c2UZskpo-rrkwfPnD7s1MXSM","metadata":"Mangrove private key"}' - -const mangroveReviews = new MangroveReviews(0, 0, "Null Island", - new UIEventSource(identity), true) - -new ReviewElement(mangroveReviews.GetSubjectUri(), mangroveReviews.GetReviews()).AttachTo("maindiv"); -const form = new ReviewForm((r,done) => { - mangroveReviews.AddReview(r, done); -}); -form.AttachTo("extradiv") - -form.GetValue().map(r => form.IsValid(r)).addCallback(d => console.log(d)) - /* window.setTimeout( () => {