MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _graph_tex_input

Method _graph_tex_input

editor/debugger/editor_visual_profiler.cpp:525–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
526 if (last_metric < 0) {
527 return;
528 }
529
530 Ref<InputEventMouse> me = p_ev;
531 Ref<InputEventMouseButton> mb = p_ev;
532 Ref<InputEventMouseMotion> mm = p_ev;
533
534 if (
535 (mb.is_valid() && mb->get_button_index() == MouseButton::LEFT && mb->is_pressed()) ||
536 (mm.is_valid())) {
537 int half_w = graph->get_size().width / 2;
538 int x = me->get_position().x;
539 if (x > half_w) {
540 x -= half_w;
541 }
542 x = x * frame_metrics.size() / half_w;
543
544 bool show_hover = x >= 0 && x < frame_metrics.size();
545
546 if (x < 0) {
547 x = 0;
548 }
549
550 if (x >= frame_metrics.size()) {
551 x = frame_metrics.size() - 1;
552 }
553
554 int metric = frame_metrics.size() - x - 1;
555 metric = last_metric - metric;
556 while (metric < 0) {
557 metric += frame_metrics.size();
558 }
559
560 if (show_hover) {
561 hover_metric = metric;
562
563 } else {
564 hover_metric = -1;
565 }
566
567 if (mb.is_valid() || mm->get_button_mask().has_flag(MouseButtonMask::LEFT)) {
568 //cursor_metric=x;
569 updating_frame = true;
570
571 //metric may be invalid, so look for closest metric that is valid, this makes snap feel better
572 bool valid = false;
573 for (int i = 0; i < frame_metrics.size(); i++) {
574 if (frame_metrics[metric].valid) {
575 valid = true;
576 break;
577 }
578
579 metric++;
580 if (metric >= frame_metrics.size()) {
581 metric = 0;
582 }

Callers

nothing calls this directly

Calls 14

get_button_indexMethod · 0.80
is_processingMethod · 0.80
set_wait_timeMethod · 0.80
sizeMethod · 0.65
is_validMethod · 0.45
is_pressedMethod · 0.45
get_sizeMethod · 0.45
get_positionMethod · 0.45
has_flagMethod · 0.45
get_button_maskMethod · 0.45
set_valueMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected