forked from MapComplete/MapComplete
		
	Small tweaks
This commit is contained in:
		
							parent
							
								
									1d2d098167
								
							
						
					
					
						commit
						0ab0d159cc
					
				
					 6 changed files with 52 additions and 21 deletions
				
			
		|  | @ -27,7 +27,9 @@ export class Changes { | ||||||
|     private readonly previouslyCreated : OsmObject[] = [] |     private readonly previouslyCreated : OsmObject[] = [] | ||||||
| 
 | 
 | ||||||
|     constructor() { |     constructor() { | ||||||
|         |        this.isUploading.addCallbackAndRun(uploading => { | ||||||
|  |            console.trace("Is uploading changed:", uploading) | ||||||
|  |        }) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private static createChangesetFor(csId: string, |     private static createChangesetFor(csId: string, | ||||||
|  | @ -255,6 +257,9 @@ export class Changes { | ||||||
|         console.log("Needed ids", neededIds) |         console.log("Needed ids", neededIds) | ||||||
|         OsmObject.DownloadAll(neededIds, true).addCallbackAndRunD(osmObjects => { |         OsmObject.DownloadAll(neededIds, true).addCallbackAndRunD(osmObjects => { | ||||||
|             console.log("Got the fresh objects!", osmObjects, "pending: ", pending) |             console.log("Got the fresh objects!", osmObjects, "pending: ", pending) | ||||||
|  |             try{ | ||||||
|  |                  | ||||||
|  |          | ||||||
|             const changes: { |             const changes: { | ||||||
|                 newObjects: OsmObject[], |                 newObjects: OsmObject[], | ||||||
|                 modifiedObjects: OsmObject[] |                 modifiedObjects: OsmObject[] | ||||||
|  | @ -283,6 +288,11 @@ export class Changes { | ||||||
|                     return self.isUploading.setData(false); |                     return self.isUploading.setData(false); | ||||||
|                 } // Failed - mark to try again
 |                 } // Failed - mark to try again
 | ||||||
|             ) |             ) | ||||||
|  |             }catch(e){ | ||||||
|  |                 console.error("Could not handle changes - probably an old, pending changeset in localstorage with an invalid format; erasing those", e) | ||||||
|  |                 self.pendingChanges.setData([]) | ||||||
|  |                 self.isUploading.setData(false) | ||||||
|  |             } | ||||||
|             return true; |             return true; | ||||||
| 
 | 
 | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  | @ -437,6 +437,9 @@ export class OsmWay extends OsmObject { | ||||||
| 
 | 
 | ||||||
|         for (const nodeId of element.nodes) { |         for (const nodeId of element.nodes) { | ||||||
|             const node = nodeDict.get(nodeId) |             const node = nodeDict.get(nodeId) | ||||||
|  |             if(node === undefined){ | ||||||
|  |                 console.error("Error: node ", nodeId, "not found in ", nodeDict) | ||||||
|  |             } | ||||||
|             const cp = node.centerpoint(); |             const cp = node.centerpoint(); | ||||||
|             this.coordinates.push(cp); |             this.coordinates.push(cp); | ||||||
|             latSum = cp[0] |             latSum = cp[0] | ||||||
|  |  | ||||||
|  | @ -305,7 +305,7 @@ export default class SimpleMetaTagger { | ||||||
|             } else if (_otherParkingMode.matchesProperties(properties)) { |             } else if (_otherParkingMode.matchesProperties(properties)) { | ||||||
|                 parallelParkingCount = 0; |                 parallelParkingCount = 0; | ||||||
|             } else { |             } else { | ||||||
|                 console.log("No parking data for ", properties.name, properties.id, properties) |                 console.log("No parking data for ", properties.name, properties.id) | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -29,6 +29,7 @@ export default class ExportPDF { | ||||||
|     private readonly scaling = 2 |     private readonly scaling = 2 | ||||||
|     private readonly freeDivId: string; |     private readonly freeDivId: string; | ||||||
|     private readonly _layout: UIEventSource<LayoutConfig>; |     private readonly _layout: UIEventSource<LayoutConfig>; | ||||||
|  |     private _screenhotTaken = false; | ||||||
| 
 | 
 | ||||||
|     constructor( |     constructor( | ||||||
|         options: { |         options: { | ||||||
|  | @ -58,6 +59,9 @@ export default class ExportPDF { | ||||||
|             background: options.background, |             background: options.background, | ||||||
|             allowMoving: false, |             allowMoving: false, | ||||||
|             onFullyLoaded: leaflet => window.setTimeout(() => { |             onFullyLoaded: leaflet => window.setTimeout(() => { | ||||||
|  |                 if (self._screenhotTaken) { | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|                 try { |                 try { | ||||||
|                     self.CreatePdf(leaflet) |                     self.CreatePdf(leaflet) | ||||||
|                         .then(() => self.cleanup()) |                         .then(() => self.cleanup()) | ||||||
|  | @ -97,6 +101,7 @@ export default class ExportPDF { | ||||||
| 
 | 
 | ||||||
|     private cleanup() { |     private cleanup() { | ||||||
|         new FixedUiElement("Screenshot taken!").AttachTo(this.freeDivId) |         new FixedUiElement("Screenshot taken!").AttachTo(this.freeDivId) | ||||||
|  |         this._screenhotTaken = true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private async CreatePdf(leaflet: L.Map) { |     private async CreatePdf(leaflet: L.Map) { | ||||||
|  | @ -122,7 +127,8 @@ export default class ExportPDF { | ||||||
|         doc.roundedRect(12, 5, 125, 30, 5, 5, 'FD') |         doc.roundedRect(12, 5, 125, 30, 5, 5, 'FD') | ||||||
| 
 | 
 | ||||||
|         doc.setFontSize(20) |         doc.setFontSize(20) | ||||||
|         doc.text(layout.title.txt, 40, 20, {  maxWidth: 100 |         doc.text(layout.title.txt, 40, 20, { | ||||||
|  |             maxWidth: 100 | ||||||
|         }) |         }) | ||||||
|         doc.setFontSize(10) |         doc.setFontSize(10) | ||||||
|         doc.text(t.attr.txt, 40, 25, { |         doc.text(t.attr.txt, 40, 25, { | ||||||
|  |  | ||||||
|  | @ -63,13 +63,15 @@ export default class FeatureInfoBox extends ScrollableFullScreen { | ||||||
|             } |             } | ||||||
|             return new EditableTagRendering(tags, tr, layerConfig.units); |             return new EditableTagRendering(tags, tr, layerConfig.units); | ||||||
|         }); |         }); | ||||||
|  |          | ||||||
|  |         let editElements : BaseUIElement[] = [] | ||||||
|         if (!questionBoxIsUsed) { |         if (!questionBoxIsUsed) { | ||||||
|             renderings.push(questionBox); |             editElements.push(questionBox); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         if (layerConfig.deletion) { |         if (layerConfig.deletion) { | ||||||
|             renderings.push( |             editElements.push( | ||||||
|                 new VariableUiElement(tags.map(tags => tags.id).map(id => |                 new VariableUiElement(tags.map(tags => tags.id).map(id => | ||||||
|                     new DeleteWizard( |                     new DeleteWizard( | ||||||
|                         id, |                         id, | ||||||
|  | @ -79,7 +81,7 @@ export default class FeatureInfoBox extends ScrollableFullScreen { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (layerConfig.allowSplit) { |         if (layerConfig.allowSplit) { | ||||||
|             renderings.push( |             editElements.push( | ||||||
|                 new VariableUiElement(tags.map(tags => tags.id).map(id => |                 new VariableUiElement(tags.map(tags => tags.id).map(id => | ||||||
|                     new SplitRoadWizard(id)) |                     new SplitRoadWizard(id)) | ||||||
|                 )) |                 )) | ||||||
|  | @ -91,7 +93,7 @@ export default class FeatureInfoBox extends ScrollableFullScreen { | ||||||
|             renderings.push(new TagRenderingAnswer(tags, SharedTagRenderings.SharedTagRendering.get("minimap"))) |             renderings.push(new TagRenderingAnswer(tags, SharedTagRenderings.SharedTagRendering.get("minimap"))) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         renderings.push( |         editElements.push( | ||||||
|             new VariableUiElement( |             new VariableUiElement( | ||||||
|                 State.state.osmConnection.userDetails |                 State.state.osmConnection.userDetails | ||||||
|                     .map(ud => ud.csCount) |                     .map(ud => ud.csCount) | ||||||
|  | @ -109,7 +111,7 @@ export default class FeatureInfoBox extends ScrollableFullScreen { | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         renderings.push( |         editElements.push( | ||||||
|             new VariableUiElement( |             new VariableUiElement( | ||||||
|                 State.state.featureSwitchIsDebugging.map(isDebugging => { |                 State.state.featureSwitchIsDebugging.map(isDebugging => { | ||||||
|                     if (isDebugging) { |                     if (isDebugging) { | ||||||
|  | @ -120,6 +122,16 @@ export default class FeatureInfoBox extends ScrollableFullScreen { | ||||||
|             ) |             ) | ||||||
|         ) |         ) | ||||||
|          |          | ||||||
|  |         const editors = new VariableUiElement(State.state.featureSwitchUserbadge.map( | ||||||
|  |             userbadge => { | ||||||
|  |                 if(!userbadge){ | ||||||
|  |                     return undefined | ||||||
|  |                 } | ||||||
|  |                 return new Combine(editElements) | ||||||
|  |             } | ||||||
|  |         )) | ||||||
|  |         renderings.push(editors) | ||||||
|  | 
 | ||||||
|         return new Combine(renderings).SetClass("block") |         return new Combine(renderings).SetClass("block") | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
|   "startLat": 51, |   "startLat": 51, | ||||||
|   "startLon": 3.75, |   "startLon": 3.75, | ||||||
|   "startZoom": 11, |   "startZoom": 11, | ||||||
|   "widenFactor": 0.05, |   "widenFactor": 0.0, | ||||||
|   "socialImage": "./assets/themes/cycle_infra/cycle-infra.svg", |   "socialImage": "./assets/themes/cycle_infra/cycle-infra.svg", | ||||||
|   "enableDownload": true, |   "enableDownload": true, | ||||||
|   "layers": [ |   "layers": [ | ||||||
|  | @ -33,7 +33,7 @@ | ||||||
|         "en": "Cycleways", |         "en": "Cycleways", | ||||||
|         "nl": "Fietspaden" |         "nl": "Fietspaden" | ||||||
|       }, |       }, | ||||||
|       "minzoom": 14, |       "minzoom": 16, | ||||||
|       "source": { |       "source": { | ||||||
|         "osmTags": { |         "osmTags": { | ||||||
|           "or": [ |           "or": [ | ||||||
|  | @ -1151,7 +1151,7 @@ | ||||||
|       "calculatedTags": [ |       "calculatedTags": [ | ||||||
|         "_comfort_score=feat.score('https://raw.githubusercontent.com/pietervdvn/AspectedRouting/master/Examples/bicycle/aspects/bicycle.comfort.json')" |         "_comfort_score=feat.score('https://raw.githubusercontent.com/pietervdvn/AspectedRouting/master/Examples/bicycle/aspects/bicycle.comfort.json')" | ||||||
|       ], |       ], | ||||||
|       "minzoom": 14, |       "minzoom": 16, | ||||||
|       "wayHandling": 0, |       "wayHandling": 0, | ||||||
|       "title": { |       "title": { | ||||||
|         "render": { |         "render": { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue