How to use the @gitgraph/core.Orientation.VerticalReverse function in @gitgraph/core

To help you get started, we’ve selected a few @gitgraph/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nicoespeon / gitgraph.js / packages / gitgraph-react / src / Gitgraph.tsx View on Github external
private computeOffsets(
    commits: Element[],
  ): GitgraphState["commitYWithOffsets"] {
    let totalOffsetY = 0;

    // In VerticalReverse orientation, commits are in the same order in the DOM.
    const orientedCommits =
      this.gitgraph.orientation === Orientation.VerticalReverse
        ? commits
        : commits.reverse();

    return orientedCommits.reduce(
      (newOffsets, commit) => {
        const commitY = parseInt(
          commit
            .getAttribute("transform")!
            .split(",")[1]
            .slice(0, -1),
          10,
        );

        const firstForeignObject = commit.getElementsByTagName(
          "foreignObject",
        )[0];
github nicoespeon / gitgraph.js / packages / gitgraph-js / src / gitgraph.ts View on Github external
function computeOffsets(): void {
      const commits: Element[] = Array.from($commits.children);
      let totalOffsetY = 0;

      // In VerticalReverse orientation, commits are in the same order in the DOM.
      const orientedCommits =
        gitgraph.orientation === Orientation.VerticalReverse
          ? commits
          : commits.reverse();

      commitYWithOffsets = orientedCommits.reduce(
        (newOffsets, commit) => {
          const commitY = parseInt(
            commit
              .getAttribute("transform")!
              .split(",")[1]
              .slice(0, -1),
            10,
          );

          const firstForeignObject = commit.getElementsByTagName(
            "foreignObject",
          )[0];

@gitgraph/core

Core of gitgraph, a JavaScript library to draw pretty git graphs

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis