Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

995 B
Raw Blame
import { GridArea } from 'core-app/shared/components/grids/areas/grid-area';

export class GridGap extends GridArea {
  private type:'row'|'column';

  constructor(startRow:number, endRow:number, startColumn:number, endColumn:number, type:'row'|'column') {
    super(startRow, endRow, startColumn, endColumn);

    this.type = type;
  }

  public get gridStartRow() {
    if (this.isRow) {
      return this.startRow * 2 - 1;
    }
    return this.startRow * 2;
  }

  public get gridEndRow() {
    if (this.isRow) {
      return this.endRow * 2 - 2;
    }
    return this.endRow * 2 - 1;
  }

  public get gridStartColumn() {
    if (this.isRow) {
      return this.startColumn * 2;
    }
    return this.startColumn * 2 - 1;
  }

  public get gridEndColumn() {
    if (this.isRow) {
      return this.endColumn * 2 - 1;
    }
    return this.endColumn * 2 - 2;
  }

  public get isRow() {
    return this.type === 'row';
  }

  public get isColumn() {
    return this.type === 'column';
  }
}