diff --git a/src/.eslintrc b/src/.eslintrc index 107984be5..224b972ed 100644 --- a/src/.eslintrc +++ b/src/.eslintrc @@ -1,6 +1,8 @@ { "extends": "@ijsto", "rules": { - "newIsCap": false + "newIsCap": 0, + "indent": ["error", 2, {"FunctionDeclaration": {"parameters": "first"}, + "FunctionExpression": {"parameters": "first"}}] } } \ No newline at end of file diff --git a/src/mxgraph/util/datatypes/mxCellState.ts b/src/mxgraph/util/datatypes/mxCellState.ts index f755e442f..e3ea594e0 100644 --- a/src/mxgraph/util/datatypes/mxCellState.ts +++ b/src/mxgraph/util/datatypes/mxCellState.ts @@ -14,17 +14,17 @@ import mxText from '../../shape/mxText'; class mxCellState extends mxRectangle { // TODO: Document me!! - cellBounds: mxRectangle; + cellBounds: mxRectangle | undefined; - paintBounds: mxRectangle; + paintBounds: mxRectangle | undefined; - boundingBox: mxRectangle; + boundingBox: mxRectangle | undefined; // Used by mxCellRenderer's createControl() - control: mxShape; + control: mxShape | undefined; // Used by mxCellRenderer's createCellOverlays() - overlays: any[]; + overlays: any[] | null | undefined; /** * Variable: view @@ -76,7 +76,7 @@ class mxCellState extends mxRectangle { * Holds an array of that represent the absolute points of an * edge. */ - absolutePoints: mxPoint[] | null = null; + absolutePoints: (mxPoint | null)[] | null = null; /** * Variable: absoluteOffset @@ -336,7 +336,7 @@ class mxCellState extends mxRectangle { * Returns the unscaled, untranslated bounds. */ getCellBounds(): mxRectangle { - return this.cellBounds; + return this.cellBounds; } /** @@ -347,7 +347,7 @@ class mxCellState extends mxRectangle { * isPaintBoundsInverted returns true. */ getPaintBounds(): mxRectangle { - return this.paintBounds; + return this.paintBounds; } /** @@ -356,8 +356,10 @@ class mxCellState extends mxRectangle { * Updates the cellBounds and paintBounds. */ updateCachedBounds(): void { - const tr = this.view.translate; - const s = this.view.scale; + const view = this.view; + + const tr = view.translate; + const s = view.scale; this.cellBounds = new mxRectangle( this.x / s - tr.x, this.y / s - tr.y, @@ -401,14 +403,14 @@ class mxCellState extends mxRectangle { * Returns a clone of this . */ clone(): mxCellState { - const clone = new mxCellState(this.view, this.cell, this.style); + const clone = new mxCellState(this.view, this.cell, this.style); // Clones the absolute points if (this.absolutePoints != null) { clone.absolutePoints = []; for (let i = 0; i < this.absolutePoints.length; i += 1) { - clone.absolutePoints[i] = this.absolutePoints[i].clone(); + clone.absolutePoints[i] = (this.absolutePoints)[i].clone(); } } @@ -443,7 +445,7 @@ class mxCellState extends mxRectangle { * Destroys the state and all associated resources. */ destroy(): void { - this.view.graph.cellRenderer.destroy(this); + (this.view).graph.cellRenderer.destroy(this); } } diff --git a/src/mxgraph/view/cell/mxCell.ts b/src/mxgraph/view/cell/mxCell.ts index e189e876e..465337b34 100644 --- a/src/mxgraph/view/cell/mxCell.ts +++ b/src/mxgraph/view/cell/mxCell.ts @@ -218,7 +218,7 @@ class mxCell { * * Returns the Id of the cell as a string. */ - getId(): number { + getId(): number | null { return this.id; } @@ -279,7 +279,7 @@ class mxCell { * * Sets the to be used as the . */ - setGeometry(geometry: mxGeometry): void { + setGeometry(geometry: mxGeometry | null): void { this.geometry = geometry; } @@ -297,7 +297,7 @@ class mxCell { * * Sets the string to be used as the