Home / File/ SnapshotsView.js — react Source File

SnapshotsView.js — react Source File

Architecture documentation for SnapshotsView.js, a javascript file in the react codebase. 6 imports, 0 dependents.

File javascript BabelCompiler Validation 6 imports 1 classes

Entity Profile

Dependency Diagram

graph LR
  db34ae2a_e9d8_b6b8_047c_808e38392dec["SnapshotsView.js"]
  20cc2065_4b5b_fd6b_be12_28f36b0ff4cf["types.js"]
  db34ae2a_e9d8_b6b8_047c_808e38392dec --> 20cc2065_4b5b_fd6b_be12_28f36b0ff4cf
  bbc225e1_d450_ae58_6679_9240ebe54628["index.js"]
  db34ae2a_e9d8_b6b8_047c_808e38392dec --> bbc225e1_d450_ae58_6679_9240ebe54628
  e39a99ae_faf3_afd9_4fc8_fa9a6210f1d3["positioning.js"]
  db34ae2a_e9d8_b6b8_047c_808e38392dec --> e39a99ae_faf3_afd9_4fc8_fa9a6210f1d3
  6fe722ba_3051_6ecf_abe3_62a190c3ad25["positioningScaleFactor"]
  db34ae2a_e9d8_b6b8_047c_808e38392dec --> 6fe722ba_3051_6ecf_abe3_62a190c3ad25
  83465e3e_5308_9ddc_a12b_a84d78f1c10a["timestampToPosition"]
  db34ae2a_e9d8_b6b8_047c_808e38392dec --> 83465e3e_5308_9ddc_a12b_a84d78f1c10a
  eab2f8f4_2e4c_8e75_87d9_c7d9b524affb["constants.js"]
  db34ae2a_e9d8_b6b8_047c_808e38392dec --> eab2f8f4_2e4c_8e75_87d9_c7d9b524affb
  style db34ae2a_e9d8_b6b8_047c_808e38392dec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import type {Snapshot, TimelineData} from '../types';
import type {
  Interaction,
  Point,
  Rect,
  Size,
  Surface,
  ViewRefs,
} from '../view-base';

import {positioningScaleFactor, timestampToPosition} from './utils/positioning';
import {
  intersectionOfRects,
  rectContainsPoint,
  rectEqualToRect,
  View,
} from '../view-base';
import {BORDER_SIZE, COLORS, SNAPSHOT_SCRUBBER_SIZE} from './constants';

type OnHover = (node: Snapshot | null) => void;

export class SnapshotsView extends View {
  _hoverLocation: Point | null = null;
  _intrinsicSize: Size;
  _profilerData: TimelineData;

  onHover: OnHover | null = null;

  constructor(surface: Surface, frame: Rect, profilerData: TimelineData) {
    super(surface, frame);

    this._intrinsicSize = {
      width: profilerData.duration,
      height: profilerData.snapshotHeight,
    };
    this._profilerData = profilerData;
  }

  desiredSize(): Size {
    return this._intrinsicSize;
  }

  draw(context: CanvasRenderingContext2D) {
    const snapshotHeight = this._profilerData.snapshotHeight;
    const {visibleArea} = this;

    context.fillStyle = COLORS.BACKGROUND;
    context.fillRect(
      visibleArea.origin.x,
      visibleArea.origin.y,
      visibleArea.size.width,
// ... (201 more lines)

Domain

Subdomains

Classes

Frequently Asked Questions

What does SnapshotsView.js do?
SnapshotsView.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What does SnapshotsView.js depend on?
SnapshotsView.js imports 6 module(s): constants.js, index.js, positioning.js, positioningScaleFactor, timestampToPosition, types.js.
Where is SnapshotsView.js in the architecture?
SnapshotsView.js is located at packages/react-devtools-timeline/src/content-views/SnapshotsView.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-timeline/src/content-views).

Analyze Your Own Codebase

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

Try Supermodel Free