Attempt to add JOSM-edit-button

This commit is contained in:
Pieter Vander Vennet 2020-09-22 00:22:50 +02:00
parent 527a635d6a
commit 8b533a57f5
2 changed files with 227 additions and 3 deletions

View file

@ -422,10 +422,26 @@ export class InitUiElements {
"<img src='./assets/pencil.svg' alt='edit here' class='small-userbadge-icon'>" +
"</a>"
}
return new Combine([mapComplete, reportBug, " | ", stats, " | ",editHere]).Render();
let editWithJosm = ""
if(location !== undefined &&
State.state.osmConnection !== undefined &&
State.state.bm !== undefined &&
State.state.osmConnection.userDetails.data.csCount >= State.userJourney.tagsVisibleAndWikiLinked){
const latLng = ( State.state.bm as Basemap).map.getBounds();
const top = Math.max(latLng[0][0], latLng[0][1]);
const bottom = Math.min(latLng[0][0], latLng[0][1]);
const left = Math.min(latLng[1][0], latLng[1][1]);
const right = Math.max(latLng[1][0], latLng[1][1]);
})
));
const josmLink = `http://127.0.0.1:8111/load_and_zoom?left=${left}&right=${right}top=${top}&bottom=${bottom}`
editHere =
`<a href='${josmLink}' target='_blank'><img src='./assets/josm_logo.svg' alt='edit here' class='small-userbadge-icon'></a>`
}
return new Combine([mapComplete, reportBug, " | ", stats, " | ",editHere, editWithJosm]).Render();
}, [State.state.osmConnection.userDetails])
)
);
State.state.bm = bm;
State.state.layerUpdater = new LayerUpdater(State.state);
const queryParam = QueryParameters.GetQueryParameter("background", State.state.layoutToUse.data.defaultBackground);