Home / File/ geometry.js — react Source File

geometry.js — react Source File

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

File javascript BabelCompiler Validation 11 dependents 11 functions

Entity Profile

Dependency Diagram

graph LR
  1d481b0c_03e1_6f28_eff1_74d4566b3dc8["geometry.js"]
  651fe3e5_90b9_93e1_39f6_c335dae25ac7["HorizontalPanAndZoomView.js"]
  651fe3e5_90b9_93e1_39f6_c335dae25ac7 --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  2fbafaf8_32f6_4129_38fc_89470d906d24["Surface.js"]
  2fbafaf8_32f6_4129_38fc_89470d906d24 --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  be7fceed_f363_2288_8ab1_9e46ccc7de65["VerticalScrollView.js"]
  be7fceed_f363_2288_8ab1_9e46ccc7de65 --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  82f60adf_9325_5735_ba06_dcbbfcf32cc9["View.js"]
  82f60adf_9325_5735_ba06_dcbbfcf32cc9 --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  81e6e62a_029e_26ae_c156_923afbde7654["geometry-test.js"]
  81e6e62a_029e_26ae_c156_923afbde7654 --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  967225f1_4dbc_efd7_073f_8182bb20aa4f["layouter.js"]
  967225f1_4dbc_efd7_073f_8182bb20aa4f --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  6e3184c5_8737_3bc9_5c7e_598f40316d02["ResizableView.js"]
  6e3184c5_8737_3bc9_5c7e_598f40316d02 --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  b6da9a74_cd56_c43e_377b_37156f7faf8c["ResizeBarView.js"]
  b6da9a74_cd56_c43e_377b_37156f7faf8c --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  c31109e4_56cc_8bde_2f0a_c3a35a729719["useCanvasInteraction.js"]
  c31109e4_56cc_8bde_2f0a_c3a35a729719 --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  4a10df0d_a8e2_1549_3912_4d2e6db4d890["VerticalScrollBarView.js"]
  4a10df0d_a8e2_1549_3912_4d2e6db4d890 --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  9576b70a_cfcb_5729_1030_479df0856820["VerticalScrollOverflowView.js"]
  9576b70a_cfcb_5729_1030_479df0856820 --> 1d481b0c_03e1_6f28_eff1_74d4566b3dc8
  style 1d481b0c_03e1_6f28_eff1_74d4566b3dc8 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
 */

export type Point = $ReadOnly<{x: number, y: number}>;
export type Size = $ReadOnly<{width: number, height: number}>;
export type IntrinsicSize = {
  ...Size,

  // If content is this height or less, hide the scrollbar entirely,
  // so that it doesn't take up vertical space unnecessarily (e.g. for a single row of content).
  hideScrollBarIfLessThanHeight?: number,

  // The initial height should be the height of the content, or this, whichever is less.
  maxInitialHeight?: number,
};
export type Rect = $ReadOnly<{origin: Point, size: Size}>;

/**
 * Alternative representation of `Rect`.
 * A tuple of (`top`, `right`, `bottom`, `left`) coordinates.
 */
type Box = [number, number, number, number];

export const zeroPoint: Point = Object.freeze({x: 0, y: 0});
export const zeroSize: Size = Object.freeze({width: 0, height: 0});
export const zeroRect: Rect = Object.freeze({
  origin: zeroPoint,
  size: zeroSize,
});

export function pointEqualToPoint(point1: Point, point2: Point): boolean {
  return point1.x === point2.x && point1.y === point2.y;
}

export function sizeEqualToSize(size1: Size, size2: Size): boolean {
  return size1.width === size2.width && size1.height === size2.height;
}

export function rectEqualToRect(rect1: Rect, rect2: Rect): boolean {
  return (
    pointEqualToPoint(rect1.origin, rect2.origin) &&
    sizeEqualToSize(rect1.size, rect2.size)
  );
}

export function sizeIsValid({width, height}: Size): boolean {
  return width >= 0 && height >= 0;
}

export function sizeIsEmpty({width, height}: Size): boolean {
  return width <= 0 || height <= 0;
}

function rectToBox(rect: Rect): Box {
// ... (88 more lines)

Domain

Subdomains

Frequently Asked Questions

What does geometry.js do?
geometry.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in geometry.js?
geometry.js defines 11 function(s): boxToRect, intersectionOfRects, pointEqualToPoint, rectContainsPoint, rectEqualToRect, rectIntersectsRect, rectToBox, sizeEqualToSize, sizeIsEmpty, sizeIsValid, and 1 more.
What files import geometry.js?
geometry.js is imported by 11 file(s): HorizontalPanAndZoomView.js, ResizableView.js, ResizeBarView.js, Surface.js, VerticalScrollBarView.js, VerticalScrollOverflowView.js, VerticalScrollView.js, View.js, and 3 more.
Where is geometry.js in the architecture?
geometry.js is located at packages/react-devtools-timeline/src/view-base/geometry.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-timeline/src/view-base).

Analyze Your Own Codebase

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

Try Supermodel Free