jest-canvas-mock icon indicating copy to clipboard operation
jest-canvas-mock copied to clipboard

Q: where to go for DOMMatrix.invertSelf support

Open monfera opened this issue 4 years ago • 5 comments

DOMMatrix.invertSelf and the other DOMMatrix functions are super useful for working with objects that Canvas2d context functions use natively. Where do people get it from? I'm running things in current Jest, and get an Error: Uncaught [Error: Not implemented]

Specifically I use it via

const { a, d } = ctx.getTransform().invertSelf().scale(ctx.canvas.width, ctx.canvas.height)

monfera avatar Aug 18 '21 07:08 monfera

My guess is that both jest-canvas-mock and jsdom have a DOMMatrix representation, but

  • jest-canvas-mock doesn't implement DOMMatrix.invertSelf because it's NOT a method on the canvas context
  • the jest-canvas-mock version of DOMMatrix is of course different from the jsdom one, and jsdom of course has no idea that it should "take over"

Oblig. banana gorilla problem

monfera avatar Aug 18 '21 11:08 monfera

First and foremost, we are "mocking" an environment, so things like this are going to happen.

Let's fix this today.

jtenner avatar Sep 01 '21 13:09 jtenner

@jtenner today was a long time ago :) need help with it? would a PR be appreciated?

iMoses avatar Apr 15 '24 10:04 iMoses

Hey I appreciate the sarcasm. My work here was a best ditch effort from me as a newbie developer, and I'm sorry for not having enough time to re-contribute back to this project.

jtenner avatar Apr 15 '24 11:04 jtenner

As for help with the project, I'm sure this project could always use a pull request.

jtenner avatar Apr 15 '24 11:04 jtenner