Merge branch 'master' into develop

This commit is contained in:
Pieter Vander Vennet 2024-12-13 14:02:03 +01:00
commit fe0929ef6f
8 changed files with 24 additions and 19 deletions

View file

@ -848,5 +848,8 @@
"empty": "Adj meg néhány Wikidata-bejegyzést", "empty": "Adj meg néhány Wikidata-bejegyzést",
"startsWithQ": "A Wikidata-azonosító Q-val kezdődik, amelyet egy szám követ" "startsWithQ": "A Wikidata-azonosító Q-val kezdődik, amelyet egy szám követ"
} }
},
"inspector": {
"menu": "Közreműködő megvizsgálása"
} }
} }

View file

@ -12761,4 +12761,4 @@
"render": "Windrad" "render": "Windrad"
} }
} }
} }

View file

@ -12664,4 +12664,4 @@
"render": "aerogenerador" "render": "aerogenerador"
} }
} }
} }

View file

@ -3700,4 +3700,4 @@
"render": "turbina wiatrowa" "render": "turbina wiatrowa"
} }
} }
} }

View file

@ -107,12 +107,15 @@ export class ImageUploadManager {
* @param file a jpg file to upload * @param file a jpg file to upload
* @param tagsStore The tags of the feature * @param tagsStore The tags of the feature
* @param targetKey Use this key to save the attribute under. Default: 'image' * @param targetKey Use this key to save the attribute under. Default: 'image'
* @param noblur if true, then the api call will indicate that the image is already blurred. The server won't apply blurring in this case
* @param feature the feature this image is about. Will be used as fallback to get the GPS-coordinates
*/ */
public async uploadImageAndApply( public async uploadImageAndApply(
file: File, file: File,
tagsStore: UIEventSource<OsmTags>, tagsStore: UIEventSource<OsmTags>,
targetKey: string, targetKey: string,
noblur: boolean noblur: boolean,
feature: Feature
): Promise<void> { ): Promise<void> {
const canBeUploaded = this.canBeUploaded(file) const canBeUploaded = this.canBeUploaded(file)
if (canBeUploaded !== true) { if (canBeUploaded !== true) {
@ -130,7 +133,8 @@ export class ImageUploadManager {
author, author,
file, file,
targetKey, targetKey,
noblur noblur,
feature
) )
if (!uploadResult) { if (!uploadResult) {
return return
@ -157,7 +161,7 @@ export class ImageUploadManager {
blob: File, blob: File,
targetKey: string | undefined, targetKey: string | undefined,
noblur: boolean, noblur: boolean,
feature?: Feature, feature: Feature,
ignoreGps: boolean = false ignoreGps: boolean = false
): Promise<UploadResult> { ): Promise<UploadResult> {
this.increaseCountFor(this._uploadStarted, featureId) this.increaseCountFor(this._uploadStarted, featureId)
@ -186,7 +190,7 @@ export class ImageUploadManager {
} }
} }
try { try {
;({ key, value, absoluteUrl } = await this._uploader.uploadImage( ({ key, value, absoluteUrl } = await this._uploader.uploadImage(
blob, blob,
location, location,
author, author,
@ -196,7 +200,7 @@ export class ImageUploadManager {
this.increaseCountFor(this._uploadRetried, featureId) this.increaseCountFor(this._uploadRetried, featureId)
console.error("Could not upload image, trying again:", e) console.error("Could not upload image, trying again:", e)
try { try {
;({ key, value, absoluteUrl } = await this._uploader.uploadImage( ({ key, value, absoluteUrl } = await this._uploader.uploadImage(
blob, blob,
location, location,
author, author,

View file

@ -13,10 +13,10 @@
import FileSelector from "../Base/FileSelector.svelte" import FileSelector from "../Base/FileSelector.svelte"
import LoginButton from "../Base/LoginButton.svelte" import LoginButton from "../Base/LoginButton.svelte"
import { Translation } from "../i18n/Translation" import { Translation } from "../i18n/Translation"
import Camera from "@babeard/svelte-heroicons/solid/Camera"
import LayerConfig from "../../Models/ThemeConfig/LayerConfig" import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
import NoteCommentElement from "../Popup/Notes/NoteCommentElement" import NoteCommentElement from "../Popup/Notes/NoteCommentElement"
import type { Feature } from "geojson" import type { Feature } from "geojson"
import Camera from "@babeard/svelte-heroicons/mini/Camera"
export let state: SpecialVisualizationState export let state: SpecialVisualizationState
@ -24,7 +24,7 @@
export let targetKey: string = undefined export let targetKey: string = undefined
export let layer: LayerConfig export let layer: LayerConfig
export let noBlur: boolean = false export let noBlur: boolean = false
export let feature: Feature = undefined export let feature: Feature
/** /**
* Image to show in the button * Image to show in the button
* NOT the image to upload! * NOT the image to upload!
@ -65,13 +65,13 @@
} }
const url = uploadResult.absoluteUrl const url = uploadResult.absoluteUrl
await state.osmConnection.addCommentToNote(tags.data.id, url) await state.osmConnection.addCommentToNote(tags.data.id, url)
NoteCommentElement.addCommentTo(url, <UIEventSource<any>>tags, { NoteCommentElement.addCommentTo(url, <UIEventSource<OsmTags>>tags, {
osmConnection: state.osmConnection, osmConnection: state.osmConnection,
}) })
return return
} }
await state?.imageUploadManager?.uploadImageAndApply(file, tags, targetKey, noBlur) await state?.imageUploadManager?.uploadImageAndApply(file, tags, targetKey, noBlur, feature)
} catch (e) { } catch (e) {
console.error(e) console.error(e)
state.reportError(e, "Could not upload image") state.reportError(e, "Could not upload image")
@ -133,9 +133,9 @@
cls="flex justify-center md:hidden button" cls="flex justify-center md:hidden button"
multiple={true} multiple={true}
on:submit={(e) => { on:submit={(e) => {
return handleFiles(e.detail, true)
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
return handleFiles(e.detail, true)
}} }}
> >
<Tr t={t.selectFile} /> <Tr t={t.selectFile} />

View file

@ -750,7 +750,7 @@ export default class SpecialVisualizations {
feature, feature,
labelText: args[1], labelText: args[1],
image: args[2], image: args[2],
noBlur: noBlur === "true" || noBlur === "yes", noBlur: noBlur === "true" || noBlur === "yes"
}) })
}, },
}, },
@ -1090,7 +1090,7 @@ export default class SpecialVisualizations {
tags tags
.map((tags) => tags[args[0]]) .map((tags) => tags[args[0]])
.map((commentsStr) => { .map((commentsStr) => {
const comments: any[] = JSON.parse(commentsStr) const comments: { text: string }[] = JSON.parse(commentsStr)
const startLoc = Number(args[1] ?? 0) const startLoc = Number(args[1] ?? 0)
if (!isNaN(startLoc) && startLoc > 0) { if (!isNaN(startLoc) && startLoc > 0) {
comments.splice(0, startLoc) comments.splice(0, startLoc)

View file

@ -42,11 +42,9 @@
import DrawerLeft from "./Base/DrawerLeft.svelte" import DrawerLeft from "./Base/DrawerLeft.svelte"
import DrawerRight from "./Base/DrawerRight.svelte" import DrawerRight from "./Base/DrawerRight.svelte"
import SearchResults from "./Search/SearchResults.svelte" import SearchResults from "./Search/SearchResults.svelte"
import { CloseButton } from "flowbite-svelte"
import Hash from "../Logic/Web/Hash" import Hash from "../Logic/Web/Hash"
import Searchbar from "./Base/Searchbar.svelte" import Searchbar from "./Base/Searchbar.svelte"
import ChevronRight from "@babeard/svelte-heroicons/mini/ChevronRight" import ChevronRight from "@babeard/svelte-heroicons/mini/ChevronRight"
import ChevronLeft from "@babeard/svelte-heroicons/solid/ChevronLeft"
import { Drawer } from "flowbite-svelte" import { Drawer } from "flowbite-svelte"
import { linear } from "svelte/easing" import { linear } from "svelte/easing"
@ -201,8 +199,8 @@
</div> </div>
{/if} {/if}
<!-- bottom controls -->
<div class="pointer-events-none absolute bottom-0 left-0 mb-4 w-screen"> <div class="pointer-events-none absolute bottom-0 left-0 mb-4 w-screen">
<!-- bottom controls -->
<div class="flex w-full items-end justify-between px-4"> <div class="flex w-full items-end justify-between px-4">
<div class="flex flex-col"> <div class="flex flex-col">
<If condition={featureSwitches.featureSwitchEnableLogin}> <If condition={featureSwitches.featureSwitchEnableLogin}>
@ -220,7 +218,7 @@
{:else if state.theme.hasPresets()} {:else if state.theme.hasPresets()}
<Tr t={Translations.t.general.add.title} /> <Tr t={Translations.t.general.add.title} />
{:else} {:else}
<Tr t={Translations.t.notes.addAComment} /> <Tr t={Translations.t.notes.createNote} />
{/if} {/if}
</button> </button>
{/if} {/if}