wip
This commit is contained in:
@@ -305,14 +305,19 @@ class ChartManager {
|
||||
|
||||
// Add click handler for annotations
|
||||
plotElement.on('plotly_clickannotation', (eventData) => {
|
||||
console.log('Annotation clicked:', eventData);
|
||||
console.log('=== plotly_clickannotation event fired ===');
|
||||
console.log('Event data:', eventData);
|
||||
console.log('Annotation:', eventData.annotation);
|
||||
|
||||
const annotationName = eventData.annotation.name;
|
||||
console.log('Annotation name:', annotationName);
|
||||
|
||||
if (annotationName) {
|
||||
const parts = annotationName.split('_');
|
||||
const action = parts[0]; // 'entry', 'exit', or 'delete'
|
||||
const annotationId = parts[1];
|
||||
|
||||
console.log(`Annotation action: ${action}, ID: ${annotationId}`);
|
||||
console.log(`Parsed - Action: ${action}, ID: ${annotationId}`);
|
||||
|
||||
if (action === 'delete') {
|
||||
this.handleAnnotationClick(annotationId, 'delete');
|
||||
@@ -694,15 +699,27 @@ class ChartManager {
|
||||
* Handle annotation click for editing/deleting
|
||||
*/
|
||||
handleAnnotationClick(annotationId, action) {
|
||||
console.log(`Annotation ${action}:`, annotationId);
|
||||
console.log(`=== handleAnnotationClick called ===`);
|
||||
console.log(` Action: ${action}`);
|
||||
console.log(` Annotation ID: ${annotationId}`);
|
||||
console.log(` window.deleteAnnotation type: ${typeof window.deleteAnnotation}`);
|
||||
|
||||
if (action === 'delete') {
|
||||
console.log('Delete action confirmed, showing confirm dialog...');
|
||||
if (confirm('Delete this annotation?')) {
|
||||
console.log('User confirmed deletion');
|
||||
if (window.deleteAnnotation) {
|
||||
console.log('Calling window.deleteAnnotation...');
|
||||
window.deleteAnnotation(annotationId);
|
||||
} else {
|
||||
console.error('window.deleteAnnotation is not available!');
|
||||
alert('Delete function not available. Please refresh the page.');
|
||||
}
|
||||
} else {
|
||||
console.log('User cancelled deletion');
|
||||
}
|
||||
} else if (action === 'edit') {
|
||||
console.log('Edit action');
|
||||
if (window.appState && window.appState.chartManager) {
|
||||
window.appState.chartManager.editAnnotation(annotationId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user