bugfixes
This commit is contained in:
@@ -5,6 +5,23 @@ export let widget = null
|
||||
export let chart = null
|
||||
export let crosshairPoint = null
|
||||
|
||||
const subscribeEvents = [
|
||||
'activeChartChanged', 'add_compare', 'chart_load_requested', 'chart_loaded', 'compare_add', 'drawing',
|
||||
'drawing_event', 'edit_object_dialog', 'indicators_dialog', 'layout_about_to_be_changed', 'layout_changed',
|
||||
'load_study_template', 'mouse_down', 'mouse_up', 'onAutoSaveNeeded', 'onMarkClick', 'onPlusClick',
|
||||
'onScreenshotReady', 'onSelectedLineToolChanged', 'onTick', 'onTimescaleMarkClick', 'panes_height_changed',
|
||||
'panes_order_changed', 'redo', 'reset_scales', 'series_event', 'series_properties_changed', 'study', 'study_event',
|
||||
'study_properties_changed', 'toggle_header', 'toggle_sidebar', 'undo', 'undo_redo_state_changed',
|
||||
]
|
||||
|
||||
function mouseDown() {
|
||||
// console.log('mouseDown')
|
||||
// console.log('selection', chart.selection().allSources())
|
||||
}
|
||||
|
||||
function crosshairMoved({time,price}) {
|
||||
console.log('crosshair', time, price)
|
||||
}
|
||||
|
||||
export function initWidget(el) {
|
||||
widget = window.tvWidget = new TradingView.widget({
|
||||
@@ -23,6 +40,12 @@ export function initWidget(el) {
|
||||
widget.subscribe('drawing_event', handleDrawingEvent)
|
||||
widget.subscribe('onSelectedLineToolChanged', onSelectedLineToolChanged)
|
||||
widget.onChartReady(initChart)
|
||||
|
||||
widget.subscribe('mouse_down', mouseDown)
|
||||
|
||||
// for( const event of subscribeEvents )
|
||||
// widget.subscribe(event, ()=>console.log(event, arguments))
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +205,7 @@ function onSelectedLineToolChanged() {
|
||||
}
|
||||
|
||||
function handleDrawingEvent(id, event) {
|
||||
console.log('drawing event', id, event)
|
||||
// console.log('drawing event', id, event)
|
||||
const shape = event === 'remove' ? null : chart.getShapeById(id);
|
||||
if (event === 'create') {
|
||||
const co = useChartOrderStore();
|
||||
|
||||
Reference in New Issue
Block a user