DCA redraw hacks

This commit is contained in:
Tim
2024-04-17 22:18:34 -04:00
parent 45a3d09e2b
commit 1579060024
6 changed files with 248 additions and 58 deletions

View File

@@ -1,7 +1,9 @@
<template>
<rung-builder :name="prices.length>1?'Ladder':'Limit'" :order="order" :builder="builder"
v-model:value-a="priceA" v-model:value-b="priceB" :mode="0" :shape="HLine"
v-model:value-a="priceA" v-model:value-b="priceB" :mode="0" :flip="flipped"
:shape="HLine"
:get-model-value="getModelValue" :set-model-value="setModelValue"
:get-points-value="getPointsValue"
:set-values="setPrices" :set-weights="setWeights"
:std-width="stdWidth" :build-tranches="buildTranches">
<table>
@@ -131,9 +133,9 @@ const higherPrice = computed({
const higherIndex = computed(()=>flipped.value ? 0 : weights.value.length-1)
const lowerIndex = computed(()=>!flipped.value ? 0 : weights.value.length-1)
const innerIndexes = computed(()=>{
const result = []
const n = prices.value.length
const f = flipped.value
const result = []
for (let i=1; i<n-1; i++)
result.push(f?i:n-1-i)
return result
@@ -210,6 +212,10 @@ function getModelValue(model) {
return model.price
}
function getPointsValue(points) {
return points[0].price
}
function setModelValue(model, value) {
// console.log('setModelValue->', {...model}, value)
if (model.price !== value)
@@ -220,12 +226,6 @@ function setModelValue(model, value) {
</script>
<style scoped lang="scss">
:deep(.v-slider.v-input--vertical > .v-input__control) {
min-height: 5em !important;
}
:deep(.v-slider.no-slider-bg .v-slider-track__fill) {
background-color: inherit !important;
}
td.weight {
padding-left: 0.5em;
padding-right: 0.5em;