Path2D.addPath got removed?

心已入冬 提交于 2019-12-11 04:27:28

问题


I have been working with Path2D for a while, but now it seems like it's function Path2D.addPath(path, matrix?) got removed (at least in chrome).

Is there actually any replacement?
Is it permanent, or just a mistake on browser part?


回答1:


This is the information on addPath from MDN (and shameless plug):

"addPath" (NOTE: EXPERIMENTAL, on standard track)

  DESKTOP:
  Chrome  | Firefox | Edge    | IE      | Opera   | Safari
  --------+---------+---------+---------+---------+----------
    Yes   |    34   |     -   |     -   |   Yes   |   Yes

  MOBILE:
  Android | Chrome  | Edge    | Firefox | Opera   | Safari
  --------+---------+---------+---------+---------+----------
    Yes   |   Yes   |     -   |    34   |   Yes   |   Yes

Data from MDN - 'npm i -g mdncomp' by K3N / epistemex.com (c) 2018.

But you're right, it seem to be gone from the prototype in current Chrome version(s). My guess is that it is related to changing the API to use DOMMatrix instead of SVGMatrix, though by now that should be in place and there is currently nothing to be found at bugs.chromium.org. In any case, we're left to wait for an update.

There are no good workarounds for this besides from adding the path directly to context. If the scope is limited you might be able to use a secondary context and draw the paths back in from there. A polyfill approach will be extensive as you would need to rebuild the entire Path2D API to get access to the path information.



来源:https://stackoverflow.com/questions/48833460/path2d-addpath-got-removed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!