mirror of
https://github.com/projectstorm/react-diagrams.git
synced 2025-08-14 08:43:42 +08:00
pretty
This commit is contained in:
@ -5,23 +5,18 @@ export class Matrix {
|
|||||||
this.matrix = matrix;
|
this.matrix = matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
mmul = (matrix: Matrix): Matrix => {
|
mmul(matrix: Matrix): Matrix {
|
||||||
// prettier-ignore
|
|
||||||
this.matrix = this.matrix.map((row, i) =>
|
this.matrix = this.matrix.map((row, i) =>
|
||||||
matrix.asArray()[0].map((_, j) =>
|
matrix.asArray()[0].map((_, j) => row.reduce((acc, _, n) => acc + this.matrix[i][n] * matrix.asArray()[n][j], 0))
|
||||||
row.reduce((acc, _, n) =>
|
);
|
||||||
acc + this.matrix[i][n] * matrix.asArray()[n][j], 0
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return this;
|
return this;
|
||||||
};
|
}
|
||||||
|
|
||||||
asArray = (): number[][] => {
|
asArray(): number[][] {
|
||||||
return this.matrix;
|
return this.matrix;
|
||||||
};
|
}
|
||||||
|
|
||||||
get = (rowIndex: number, columnIndex: number): number => {
|
get(rowIndex: number, columnIndex: number): number {
|
||||||
return this.asArray()[rowIndex][columnIndex];
|
return this.asArray()[rowIndex][columnIndex];
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ export abstract class AbstractDisplacementState<E extends CanvasEngine = CanvasE
|
|||||||
// If buttons is 0, it means the mouse is not down, the user may have released it
|
// If buttons is 0, it means the mouse is not down, the user may have released it
|
||||||
// outside of the canvas, then we eject the state
|
// outside of the canvas, then we eject the state
|
||||||
this.eject();
|
this.eject();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user