On Fri, Jun 6, 2014 at 8:57 AM, Milan Sreckovic <msrecko...@mozilla.com> wrote:
> On Jun 5, 2014, at 18:34 , Rik Cabanier <caban...@gmail.com> wrote: > > On Thu, Jun 5, 2014 at 3:28 PM, Robert O'Callahan <rob...@ocallahan.org> > wrote: > > On Fri, Jun 6, 2014 at 9:07 AM, Rik Cabanier <caban...@gmail.com> wrote: > > ... > > > > Then there's this case: > var m = new DOMMatrix(); > m.translate(-1,-1); > m.translate(1,1); > m.isIdentity() == false > > I'm OK with that. Maybe we do need a better name though. Invert the > meaning and call it "maybeHasTransform()"? > > > That sounds good to me. > > > That just feels very wrong. I understand not having an isIdentity() > method as Benoit proposes. The argument being “is identity question is > more complicated than you think, so we won’t let you ask it, and instead > you have to do it manually, which means you understand what’s going on”. > > I don’t understand having isIdentity() method and having it return false > when you actually have an identity transform. If it was > “hasBeenModified()” or some such, I can understand having it behave that > way. > I could live with that name as well. The problem is what "modified" means. var m = DOMMatrix(2,0,0,1,0,0) ; m. hasBeenModified(); //? I've been thinking more and I'm leaning back towards isIdentity. > I’d much rather have “isIdentityExactly()” or "isCloseToIdentity(float > tolerance)” for a given definition of tolerance. Or not have it at all and > write the JS utility myself. > Yes, you can do this yourself. You should ask yourself though if you would really need to do this... As Benoit said, this might cause inconsistent behavior. Moreover, non-identity matrices are very rare so you should ask yourself if the fixed cost of always checking for true identity is worth it. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform