massive Shape rework: keep both tvPoints/Props and ourPoints/Props; delegate model updates to subclasses; DCA/VLine working but Ladder/HLine not done.

This commit is contained in:
Tim
2024-04-16 16:25:31 -04:00
parent 8befffe1c5
commit 65be28fb0a
11 changed files with 874 additions and 208 deletions

View File

@@ -1,6 +1,7 @@
import {useChartOrderStore} from "@/orderbuild.js";
import {invokeCallbacks, prototype} from "@/common.js";
import {DataFeed, initFeeDropdown, lookupSymbol} from "@/charts/datafeed.js";
import {intervalToSeconds} from "@/misc.js";
export let widget = null
export let chart = null
@@ -24,6 +25,11 @@ function changeSymbol(symbol) {
}
function changeInterval(interval, _timeframe) {
useChartOrderStore().intervalSecs = intervalToSeconds(interval)
}
/* TradingView event keystrings
const subscribeEvents = [
'toggle_sidebar', 'indicators_dialog', 'toggle_header', 'edit_object_dialog', 'chart_load_requested',
@@ -69,8 +75,10 @@ function initChart() {
console.log('init chart')
chart = widget.activeChart()
chart.crossHairMoved().subscribe(null, (point)=>setTimeout(()=>handleCrosshairMovement(point),0) )
chart.onSymbolChanged().subscribe(null, changeSymbol);
chart.onSymbolChanged().subscribe(null, changeSymbol)
chart.onIntervalChanged().subscribe(null, changeInterval)
changeSymbol(chart.symbolExt())
changeInterval(widget.symbolInterval().interval)
useChartOrderStore().chartReady = true
console.log('chart ready')
}
@@ -242,7 +250,6 @@ function drawingEventWorker() {
const queue = drawingEventQueue
drawingEventQueue = []
propsEvents = {}
// console.log('events locked', queue)
for (const [id, event] of queue) {
if (event === 'properties_changed')
propsEvents[id] = event
@@ -259,8 +266,18 @@ function drawingEventWorker() {
}
function doHandleDrawingEvent(id, event) {
// console.log('drawing event', id, event)
const shape = event === 'remove' ? null : chart.getShapeById(id);
console.log('drawing event', id, event)
let shape
if (event==='remove')
shape = null
else {
try {
shape = chart.getShapeById(id)
}
catch {
return
}
}
if (event === 'create') {
const co = useChartOrderStore();
const callbacks = co.drawingCallbacks