DOMMatrixReadOnly: isIdentity Eigenschaft

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

Hinweis: Diese Funktion ist in Web Workers verfügbar.

Die schreibgeschützte isIdentity Eigenschaft des DOMMatrixReadOnly Interfaces ist ein Boolean, dessen Wert true ist, wenn die Matrix die Einheitsmatrix ist.

Die Einheitsmatrix ist eine, in der jeder Wert 0 ist, außer denen auf der Hauptdiagonale von der oberen linken bis zur unteren rechten Ecke (mit anderen Worten, wo die Offsets in jede Richtung gleich sind).

Wert

Ein Boolean-Wert.

Beispiele

js
// Initialize a 2D matrix
const matrix = new DOMMatrix(); // create a matrix
console.log(matrix.isIdentity); // output: true

// Apply a transform that has no effect
console.log(matrix.translate(0).isIdentity); // output: true

// Apply a transform with effect: this rotates the matrix by 30deg
console.log(matrix.rotate(30).isIdentity); // output: false

Spezifikationen

Specification
Geometry Interfaces Module Level 1
# dom-dommatrixreadonly-isidentity

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
isIdentity

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Siehe auch