| 631 | pl.hlines(cmpoint[1], pl.xlim()[0]+0.001, pl.xlim()[1] - 0.001, 'r', '--') |
| 632 | |
| 633 | def mouse_motion_handler(event): |
| 634 | x, y = event.xdata, event.ydata |
| 635 | if x is not None and y is not None: |
| 636 | for coord, (name, text, rect) in rectangles.items(): |
| 637 | x0, y0, x1, y1 = coord |
| 638 | if x0 < x < x1 and y0 < y < y1: |
| 639 | if FLAME_PLOTTER_VARS['hovered_rect'] == rect: |
| 640 | return |
| 641 | |
| 642 | if FLAME_PLOTTER_VARS['hovered_rect'] is not None: |
| 643 | FLAME_PLOTTER_VARS['hovered_rect'].set_alpha(FLAME_PLOTTER_VARS['alpha']) |
| 644 | FLAME_PLOTTER_VARS['hovered_text'].set_color((0, 0, 0, 0)) |
| 645 | FLAME_PLOTTER_VARS['hovered_rect'].set_linewidth(1) |
| 646 | |
| 647 | FLAME_PLOTTER_VARS['hovered_text'] = text |
| 648 | FLAME_PLOTTER_VARS['hovered_rect'] = rect |
| 649 | FLAME_PLOTTER_VARS['alpha'] = rect.get_alpha() |
| 650 | FLAME_PLOTTER_VARS['hovered_rect'].set_alpha(0.8) |
| 651 | FLAME_PLOTTER_VARS['hovered_rect'].set_linewidth(3) |
| 652 | FLAME_PLOTTER_VARS['hovered_text'].set_color((0, 0, 0, 1)) |
| 653 | pl.draw() |
| 654 | return |
| 655 | |
| 656 | if FLAME_PLOTTER_VARS['hovered_rect'] is not None: |
| 657 | FLAME_PLOTTER_VARS['hovered_text'].set_color((0, 0, 0, 0)) |
| 658 | FLAME_PLOTTER_VARS['hovered_rect'].set_alpha(FLAME_PLOTTER_VARS['alpha']) |
| 659 | FLAME_PLOTTER_VARS['hovered_rect'].set_linewidth(1) |
| 660 | pl.draw() |
| 661 | FLAME_PLOTTER_VARS['hovered_rect'] = None |
| 662 | FLAME_PLOTTER_VARS['hovered_text'] = None |
| 663 | |
| 664 | def mouse_click_handler(event): |
| 665 | x, y = event.xdata, event.ydata |