Home / Function/ _drawSingleSchedulingEvent() — react Function Reference

_drawSingleSchedulingEvent() — react Function Reference

Architecture documentation for the _drawSingleSchedulingEvent() function in SchedulingEventsView.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  e90b4f85_79ff_f7c6_2a8c_0b24621f67c7["_drawSingleSchedulingEvent()"]
  b603a917_4a82_e943_1f8b_6d182bba008b["SchedulingEventsView"]
  e90b4f85_79ff_f7c6_2a8c_0b24621f67c7 -->|defined in| b603a917_4a82_e943_1f8b_6d182bba008b
  bdfbce96_aa1e_92d9_4ef5_88d5170201a6["draw()"]
  bdfbce96_aa1e_92d9_4ef5_88d5170201a6 -->|calls| e90b4f85_79ff_f7c6_2a8c_0b24621f67c7
  83465e3e_5308_9ddc_a12b_a84d78f1c10a["timestampToPosition()"]
  e90b4f85_79ff_f7c6_2a8c_0b24621f67c7 -->|calls| 83465e3e_5308_9ddc_a12b_a84d78f1c10a
  style e90b4f85_79ff_f7c6_2a8c_0b24621f67c7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-timeline/src/content-views/SchedulingEventsView.js lines 78–133

  _drawSingleSchedulingEvent(
    context: CanvasRenderingContext2D,
    rect: Rect,
    event: SchedulingEvent,
    baseY: number,
    scaleFactor: number,
    showHoverHighlight: boolean,
  ) {
    const {frame} = this;
    const {timestamp, type, warning} = event;

    const x = timestampToPosition(timestamp, scaleFactor, frame);
    const radius = REACT_EVENT_DIAMETER / 2;
    const eventRect: Rect = {
      origin: {
        x: x - radius,
        y: baseY,
      },
      size: {width: REACT_EVENT_DIAMETER, height: REACT_EVENT_DIAMETER},
    };
    if (!rectIntersectsRect(eventRect, rect)) {
      return; // Not in view
    }

    let fillStyle = null;

    if (warning !== null) {
      fillStyle = showHoverHighlight
        ? COLORS.WARNING_BACKGROUND_HOVER
        : COLORS.WARNING_BACKGROUND;
    } else {
      switch (type) {
        case 'schedule-render':
        case 'schedule-state-update':
        case 'schedule-force-update':
          fillStyle = showHoverHighlight
            ? COLORS.REACT_SCHEDULE_HOVER
            : COLORS.REACT_SCHEDULE;
          break;
        default:
          if (__DEV__) {
            console.warn('Unexpected event type "%s"', type);
          }
          break;
      }
    }

    if (fillStyle !== null) {
      const y = eventRect.origin.y + radius;

      context.beginPath();
      context.fillStyle = fillStyle;
      context.arc(x, y, radius, 0, 2 * Math.PI);
      context.fill();
    }
  }

Domain

Subdomains

Called By

Frequently Asked Questions

What does _drawSingleSchedulingEvent() do?
_drawSingleSchedulingEvent() is a function in the react codebase, defined in packages/react-devtools-timeline/src/content-views/SchedulingEventsView.js.
Where is _drawSingleSchedulingEvent() defined?
_drawSingleSchedulingEvent() is defined in packages/react-devtools-timeline/src/content-views/SchedulingEventsView.js at line 78.
What does _drawSingleSchedulingEvent() call?
_drawSingleSchedulingEvent() calls 1 function(s): timestampToPosition.
What calls _drawSingleSchedulingEvent()?
_drawSingleSchedulingEvent() is called by 1 function(s): draw.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free