Persistent Drawings

This commit is contained in:
louisnw
2023-11-23 19:25:36 +00:00
parent 631afd450f
commit f798e5f944
2 changed files with 3 additions and 4 deletions

View File

@ -404,7 +404,7 @@ function calculateTrendLine(startDate, startValue, endDate, endValue, chart, ray
} }
if (startIndex === -1) { if (startIndex === -1) {
return [] throw new Error(`Could not calculate start index from time ${stampToDate(startDate)}.`)
} }
let endIndex let endIndex
if (ray) { if (ray) {

View File

@ -403,7 +403,6 @@ if (!window.ToolBox) {
renderDrawings() { renderDrawings() {
this.drawings.forEach((item) => { this.drawings.forEach((item) => {
if ('price' in item) return if ('price' in item) return
console.log('rendering')
let startDate = Math.round(item.from[0]/this.chart.interval)*this.chart.interval let startDate = Math.round(item.from[0]/this.chart.interval)*this.chart.interval
let endDate = Math.round(item.to[0]/this.chart.interval)*this.chart.interval let endDate = Math.round(item.to[0]/this.chart.interval)*this.chart.interval
item.calculateAndSet(startDate, item.from[1], endDate, item.to[1]) item.calculateAndSet(startDate, item.from[1], endDate, item.to[1])
@ -453,8 +452,8 @@ if (!window.ToolBox) {
item.priceLine.lineStyle, item.priceLine.axisLabelVisible) item.priceLine.lineStyle, item.priceLine.axisLabelVisible)
} }
else { else {
let startDate = Math.round(item.from[0]/this.chart.interval)*this.chart.interval let startDate = Math.round((item.from[0]/this.chart.interval)*this.chart.interval)
let endDate = Math.round(item.to[0]/this.chart.interval)*this.chart.interval let endDate = Math.round((item.to[0]/this.chart.interval)*this.chart.interval)
drawing = new TrendLine(this.chart, item.color, item.ray) drawing = new TrendLine(this.chart, item.color, item.ray)
drawing.calculateAndSet(startDate, item.from[1], endDate, item.to[1]) drawing.calculateAndSet(startDate, item.from[1], endDate, item.to[1])