ordershapes

This commit is contained in:
tim
2024-09-15 00:59:47 -04:00
parent 80e03f648b
commit 09ef4c5f43
10 changed files with 295 additions and 92 deletions

View File

@@ -3,7 +3,6 @@ import {invokeCallbacks, prototype} from "@/common.js";
import {DataFeed, initFeeDropdown, lookupSymbol} from "@/charts/datafeed.js";
import {intervalToSeconds, SingletonCoroutine} from "@/misc.js";
import {useStore} from "@/store/store.js";
import {dirtyPoints} from "@/charts/chart-misc.js";
export let widget = null
export let chart = null
@@ -162,12 +161,17 @@ export function drawShape(shapeType, ...callbacks) {
export function createShape(shapeType, points, options={}, ...callbacks) {
const chart = widget.activeChart()
drawingCallbacks = null
cancelDrawing()
options.shape = shapeType.code
if (typeof shapeType === 'string' )
options.shape = shapeType
else
options.shape = shapeType.code
// programatically adds a shape to the chart
let shapeId
try {
console.log('creating shape', points, options)
if (points.time || points.price)
shapeId = chart.createShape(points, options)
else if (points.length === 1)