forked from MapComplete/MapComplete
Add separate 'save' button to slope input
This commit is contained in:
parent
32606856f9
commit
de5d10ffa7
1 changed files with 19 additions and 2 deletions
|
@ -8,7 +8,14 @@
|
|||
import If from "../../Base/If.svelte"
|
||||
import type { SpecialVisualizationState } from "../../SpecialVisualization"
|
||||
|
||||
/**
|
||||
* The value exported to outside, saved only when the button is pressed
|
||||
*/
|
||||
export let value: UIEventSource<string> = new UIEventSource<string>(undefined)
|
||||
/**
|
||||
* The continuously updated value
|
||||
*/
|
||||
let _value: UIEventSource<string> = new UIEventSource<string>(undefined)
|
||||
export let mode: "degrees" | "percentage" = "percentage"
|
||||
|
||||
export let feature: Feature = undefined
|
||||
|
@ -62,9 +69,9 @@
|
|||
let valueSign = valuesign.data
|
||||
|
||||
if (mode === "degrees") {
|
||||
value.setData(valueSign * beta + "°")
|
||||
_value.setData(valueSign * beta + "°")
|
||||
} else {
|
||||
value.setData(degreesToPercentage(valueSign * beta))
|
||||
_value.setData(degreesToPercentage(valueSign * beta))
|
||||
}
|
||||
|
||||
previewDegrees.setData(beta + "°")
|
||||
|
@ -72,6 +79,12 @@
|
|||
},
|
||||
[valuesign, beta]
|
||||
)
|
||||
|
||||
function onSave(){
|
||||
if(_value.data){
|
||||
value.setData(_value.data)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $gotMeasurement}
|
||||
|
@ -87,6 +100,10 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<button class="primary" on:click={() => onSave()}>
|
||||
Select this incline
|
||||
</button>
|
||||
|
||||
<div>
|
||||
<Tr t={Translations.t.validation.slope.inputExplanation} />
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue