Package Exports
- dommatrix
- dommatrix/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dommatrix) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
DOMMatrix shim
An ES6+ sourced DOMMatrix shim for Node.js apps and legacy browsers. Since this source is modernized, legacy browsers might need some additional shims.
The constructor is almost equivalent with the DOMMatrix in many respects, but tries to keep a sense of simplicity. In that note, we haven't implemented DOMMatrixReadOnly methods like flipX()
or inverse()
or aliases for the main methods like translateSelf
or the old rotate3d
.
WIKI
Head over to the wiki pages for developer guidelines.
More Info
In contrast with the original source there have been a series of changes to the prototype for consistency, performance as well as requirements to better accomodate the DOMMatrix interface:
- changed the order of the initialization parameters of a 3D matrix, now uses the column major order, as described in the specification pages; this change is to accommodate outputs of
toFloat64Array()
of the DOMMatrix constructor (which also returns items in the expected order); - changed how the constructor determines if the matrix is 2D, based on a more accurate method which is actually checking the designated values of the 3D space; in contrast, the old CSSMatrix constructor sets
afine
property at initialization only and based on the number of arguments or the type of the input CSS transform syntax; - fixed the
translate()
,scale()
androtate()
instance methods to work with one axis transformation, also inline with DOMMatrix; - changed
toString()
instance method to utilize the new methodtoArray()
described below; - changed
setMatrixValue()
instance method to do all the heavy duty work with parameters; - removed
afine
property, it's a very old WebKitCSSMatrix defined property; - removed
inverse()
instance method, will be re-added later for other implementations (probably going to be accompanied bydeterminant()
,transpose()
and others); - removed
toFullString()
instance method, probably something also from WebKitCSSMatrix; - added
is2D
(getter and setter) property; - added
isIdentity
(getter and setter) property; - added
feedFromArray
static method, not present in the constructor prototype; - added
fromMatrix
static method, not present in the constructor prototype; - added
fromArray()
,fromFloat64Array()
andfromFloat32Array()
static methods, not present in the constructor prototype, the last 2 are not published sincefromArray()
can also process Float32Array / Float64Array viaArray.from()
; - added
toArray()
,toFloat64Array()
andtoFloat32Array()
instance methods, the last two are not present in the constructor prototype; - added
transformPoint()
instance method which works like the original.
Thanks
- Arian Stolwijk for his CSSMatrix
License
DOMMatrix shim is MIT Licensed.