Changes do apply left-right splitting before uploading too
This commit is contained in:
parent
40c4ae769d
commit
0dc7187bab
6 changed files with 27 additions and 9 deletions
|
@ -80,7 +80,7 @@ export default class SelectedElementTagsUpdater {
|
|||
) {
|
||||
try {
|
||||
|
||||
const leftRightSensitive = state.layoutToUse.layers.some(layer => layer.lineRendering.some(lr => lr.leftRightSensitive))
|
||||
const leftRightSensitive = state.layoutToUse.isLeftRightSensitive()
|
||||
|
||||
if (leftRightSensitive) {
|
||||
SimpleMetaTagger.removeBothTagging(latestTags)
|
||||
|
|
|
@ -6,6 +6,7 @@ import OsmChangeAction from "./Actions/OsmChangeAction";
|
|||
import {ChangeDescription} from "./Actions/ChangeDescription";
|
||||
import {Utils} from "../../Utils";
|
||||
import {LocalStorageSource} from "../Web/LocalStorageSource";
|
||||
import SimpleMetaTagger from "../SimpleMetaTagger";
|
||||
|
||||
/**
|
||||
* Handles all changes made to OSM.
|
||||
|
@ -26,8 +27,10 @@ export class Changes {
|
|||
private readonly isUploading = new UIEventSource(false);
|
||||
|
||||
private readonly previouslyCreated: OsmObject[] = []
|
||||
private readonly _leftRightSensitive: boolean;
|
||||
|
||||
constructor() {
|
||||
constructor(leftRightSensitive : boolean = false) {
|
||||
this._leftRightSensitive = leftRightSensitive;
|
||||
// We keep track of all changes just as well
|
||||
this.allChanges.setData([...this.pendingChanges.data])
|
||||
// If a pending change contains a negative ID, we save that
|
||||
|
@ -121,6 +124,11 @@ export class Changes {
|
|||
const self = this;
|
||||
const neededIds = Changes.GetNeededIds(pending)
|
||||
const osmObjects = await Promise.all(neededIds.map(id => OsmObject.DownloadObjectAsync(id)));
|
||||
|
||||
if(this._leftRightSensitive){
|
||||
osmObjects.forEach(obj => SimpleMetaTagger.removeBothTagging(obj.tags))
|
||||
}
|
||||
|
||||
console.log("Got the fresh objects!", osmObjects, "pending: ", pending)
|
||||
const changes: {
|
||||
newObjects: OsmObject[],
|
||||
|
|
|
@ -15,7 +15,7 @@ import TitleHandler from "../Actors/TitleHandler";
|
|||
/**
|
||||
* The part of the state keeping track of where the elements, loading them, configuring the feature pipeline etc
|
||||
*/
|
||||
export default class ElementsState extends FeatureSwitchState{
|
||||
export default class ElementsState extends FeatureSwitchState {
|
||||
|
||||
/**
|
||||
The mapping from id -> UIEventSource<properties>
|
||||
|
@ -24,7 +24,7 @@ export default class ElementsState extends FeatureSwitchState{
|
|||
/**
|
||||
THe change handler
|
||||
*/
|
||||
public changes: Changes = new Changes();
|
||||
public changes: Changes;
|
||||
|
||||
/**
|
||||
The latest element that was selected
|
||||
|
@ -34,7 +34,7 @@ export default class ElementsState extends FeatureSwitchState{
|
|||
"Selected element"
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The map location: currently centered lat, lon and zoom
|
||||
*/
|
||||
|
@ -48,6 +48,9 @@ export default class ElementsState extends FeatureSwitchState{
|
|||
|
||||
constructor(layoutToUse: LayoutConfig) {
|
||||
super(layoutToUse);
|
||||
|
||||
this.changes = new Changes(layoutToUse.isLeftRightSensitive())
|
||||
|
||||
{
|
||||
// -- Location control initialization
|
||||
const zoom = UIEventSource.asFloat(
|
||||
|
@ -84,10 +87,10 @@ export default class ElementsState extends FeatureSwitchState{
|
|||
lon.setData(latlonz.lon);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
new ChangeToElementsActor(this.changes, this.allElements)
|
||||
new PendingChangesUploader(this.changes, this.selectedElement);
|
||||
new TitleHandler(this);
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue