The W3C Geometry Interfaces implemented in JavaScript and polyfilled.
npm install geometry-interfacesLet's do some dommetry!
The W3C Geometry
Interfaces implemented in JavaScript and
polyfilled.
npm install geometry-interfaces- DOMMatrixReadOnly \*
- DOMMatrix \*
- DOMPointReadOnly \*
- DOMPoint \*
- DOMQuad \*
- DOMRectReadOnly
- DOMRect
\* Some methods are not implemented yet.
Just import the library after installing it from
NPM and it will polyfill the
global APIs:
``js`
import 'geometry-interfaces' // ES Modules
If you're not using a build tool, just plain JS in a browser, you can set up an
importmap:
`html
`
If you don't want to polyfill the APIs globally, you can import what you need
directly:
`js`
import {DOMMatrix} from 'geometry-interfaces/dist/DOMMatrix.js'
import {DOMPoint} from 'geometry-interfaces/dist/DOMPoint.js'
Make sure you have lib: ["dom"] in tsconfig or DOM types will be missing and
there may be type errors.
To develop the project, run npm clean-install after cloning the repo, thennpm run dev will build the TS to JS in watch mode, and npm run build` will
build it without watch mode.
Any help would be greatly appreciated, as this is a purely free time unpaid
project. If you'd like to contribute, a pull request to add missing features,
APIs, tests, or performance improvements would be awesome. :]
The word "dommetry" is a play on the words "geometry" and "DOMMatrix" put
together. :D