placement, line drawing, and price display fixes (inverted test)

This commit is contained in:
tim
2024-09-21 01:58:16 -04:00
parent e5d5c9c0d8
commit b82171dfb0
5 changed files with 62 additions and 30 deletions

View File

@@ -22,7 +22,7 @@ export function removeSymbolChangedCallback(cb) {
}
function changeSymbol(symbol) {
console.log('change symbol', symbol)
console.error('change symbol', symbol)
if (symbol===null)
co.selectedSymbol = null
else {
@@ -33,8 +33,13 @@ function changeSymbol(symbol) {
}
export function setSymbol(symbol) {
widget.activeChart().setSymbol(symbol.ticker)
export async function setSymbol(symbol) {
await new Promise(resolve => {
if (co.selectedSymbol?.ticker !== symbol.ticker)
widget.activeChart().setSymbol(symbol.ticker, null, resolve)
else
resolve()
})
}
@@ -194,6 +199,9 @@ export function createShape(shapeType, points, options={}, ...callbacks) {
console.error('tvShape could not create', shapeType, points, options, e)
return null
}
if (shapeId===null) {
console.error('could not create shape', points, options)
}
allShapeIds.push(shapeId)
if( callbacks.length )
shapeCallbacks[shapeId] = callbacks