Home / Class/ ResizeBarView Class — react Architecture

ResizeBarView Class — react Architecture

Architecture documentation for the ResizeBarView class in ResizeBarView.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  bc0823a6_6e22_c24e_dcae_a58df082924b["ResizeBarView"]
  b6da9a74_cd56_c43e_377b_37156f7faf8c["ResizeBarView.js"]
  bc0823a6_6e22_c24e_dcae_a58df082924b -->|defined in| b6da9a74_cd56_c43e_377b_37156f7faf8c
  4a6a9950_a98c_10f0_fc95_3bbeb899f784["constructor()"]
  bc0823a6_6e22_c24e_dcae_a58df082924b -->|method| 4a6a9950_a98c_10f0_fc95_3bbeb899f784
  2dda5c42_4372_409b_6605_094e00a6f99d["desiredSize()"]
  bc0823a6_6e22_c24e_dcae_a58df082924b -->|method| 2dda5c42_4372_409b_6605_094e00a6f99d
  a6f49775_80b0_82ed_3ce3_ec36aa443d4e["draw()"]
  bc0823a6_6e22_c24e_dcae_a58df082924b -->|method| a6f49775_80b0_82ed_3ce3_ec36aa443d4e
  e90ae4ef_4b8c_a5e3_ed50_d72e350e604b["_setInteractionState()"]
  bc0823a6_6e22_c24e_dcae_a58df082924b -->|method| e90ae4ef_4b8c_a5e3_ed50_d72e350e604b
  217ff997_1f0f_fc0a_390d_a2f46c1a2e16["_handleMouseDown()"]
  bc0823a6_6e22_c24e_dcae_a58df082924b -->|method| 217ff997_1f0f_fc0a_390d_a2f46c1a2e16
  686db2c1_9d87_c8ba_dd6a_45815f4456ca["_handleMouseMove()"]
  bc0823a6_6e22_c24e_dcae_a58df082924b -->|method| 686db2c1_9d87_c8ba_dd6a_45815f4456ca
  6cabb0a4_31b0_c458_c4b3_4d244721ec78["_handleMouseUp()"]
  bc0823a6_6e22_c24e_dcae_a58df082924b -->|method| 6cabb0a4_31b0_c458_c4b3_4d244721ec78
  561028c1_37ac_c290_dac9_6fb0e8601077["handleInteraction()"]
  bc0823a6_6e22_c24e_dcae_a58df082924b -->|method| 561028c1_37ac_c290_dac9_6fb0e8601077

Relationship Graph

Source Code

packages/react-devtools-timeline/src/view-base/resizable/ResizeBarView.js lines 33–193

export class ResizeBarView extends View {
  _interactionState: ResizeBarState = 'normal';
  _label: string;

  showLabel: boolean = false;

  constructor(surface: Surface, frame: Rect, label: string) {
    super(surface, frame, noopLayout);

    this._label = label;
  }

  desiredSize(): Size {
    return this.showLabel
      ? {height: RESIZE_BAR_WITH_LABEL_HEIGHT, width: 0}
      : {height: RESIZE_BAR_HEIGHT, width: 0};
  }

  draw(context: CanvasRenderingContext2D, viewRefs: ViewRefs) {
    const {frame} = this;
    const {x, y} = frame.origin;
    const {width, height} = frame.size;

    const isActive =
      this._interactionState === 'dragging' ||
      (this._interactionState === 'hovered' && viewRefs.activeView === null);

    context.fillStyle = isActive
      ? COLORS.REACT_RESIZE_BAR_ACTIVE
      : COLORS.REACT_RESIZE_BAR;
    context.fillRect(x, y, width, height);

    context.fillStyle = COLORS.REACT_RESIZE_BAR_BORDER;
    context.fillRect(x, y, width, BORDER_SIZE);
    context.fillRect(x, y + height - BORDER_SIZE, width, BORDER_SIZE);

    const horizontalCenter = x + width / 2;
    const verticalCenter = y + height / 2;

    if (this.showLabel) {
      // When the resize view is collapsed entirely,
      // rather than showing a resize bar– this view displays a label.
      const labelRect: Rect = {
        origin: {
          x: 0,
          y: y + height - RESIZE_BAR_WITH_LABEL_HEIGHT,
        },
        size: {
          width: frame.size.width,
          height: RESIZE_BAR_WITH_LABEL_HEIGHT,
        },
      };

      drawText(this._label, context, labelRect, frame, {
        fillStyle: COLORS.REACT_RESIZE_BAR_DOT,
        textAlign: 'center',
      });
    } else {
      // Otherwise draw horizontally centered resize bar dots
      context.beginPath();
      context.fillStyle = COLORS.REACT_RESIZE_BAR_DOT;
      context.arc(
        horizontalCenter,
        verticalCenter,
        RESIZE_BAR_DOT_RADIUS,
        0,
        2 * Math.PI,
      );
      context.arc(
        horizontalCenter + RESIZE_BAR_DOT_SPACING,
        verticalCenter,
        RESIZE_BAR_DOT_RADIUS,
        0,
        2 * Math.PI,
      );
      context.arc(
        horizontalCenter - RESIZE_BAR_DOT_SPACING,
        verticalCenter,
        RESIZE_BAR_DOT_RADIUS,
        0,
        2 * Math.PI,

Domain

Frequently Asked Questions

What is the ResizeBarView class?
ResizeBarView is a class in the react codebase, defined in packages/react-devtools-timeline/src/view-base/resizable/ResizeBarView.js.
Where is ResizeBarView defined?
ResizeBarView is defined in packages/react-devtools-timeline/src/view-base/resizable/ResizeBarView.js at line 33.

Analyze Your Own Codebase

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

Try Supermodel Free