dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.21k stars 1.57k forks source link

currentTransfrom can't get the trasnform properly #42776

Open xiaoxiaowesley opened 4 years ago

xiaoxiaowesley commented 4 years ago

When I using CanvasRenderingContext2D in devtools project . I found the currentTransfrom can not return the transform properly which it return undefined.

In MDN it said not all the browsers support currentTransfrom feature but getTransform does

Why not use the getTransform and Why not use the getTransform interface .And how I can get the current transform properly in project?

sigmundch commented 4 years ago

Thanks for reporting this issue.

This is unfortunately a result of the codegen strategy in dart:html - we generate code from browser web IDL files that are unfortunately outdated. Rolling these is a big undertaking and it is not planned short term.

For now, the only workaround I can offer is to use methods from dart:js_util to access the underlying APIs, as in: js_util.callMethod(context2d, 'getTransform', [])

Soon we are working on changes to JS-interop to make it easier to extend dart:html outside the SDK, so it is easier to workaround this. When that becomes available you'll be able to define static extension methods that expose the missing functionality and call them as if they were originally available from the browser APIs.