js.dartを介してDartでpaper.jsを使用しようとしています。
多くのことが機能しているように見えますが、importSVG
paper.js のメソッドも必要です。でアクセスしようとすると、 が表示されjs.context.paper.project.importSVG(query("#svg"));
ますNoSuchMethodError
。メソッドがプロジェクトに挿入されているためです。以下の paper.js のコードを参照してください。
importSVG
Dart からメソッドにアクセスするにはどうすればよいですか?
/* paper.js */
new function() {
function importSVG(node, clearDefs) {
// ...
}
Item.inject(/** @lends Item# */{
/**
* Converts the passed node node into a Paper.js item and adds it to the
* children of this item.
*
* @param {SVGSVGElement} node the SVG DOM node to convert
* @return {Item} the converted Paper.js item
*/
importSVG: function(node) {
return this.addChild(importSVG(node, true));
}
});
Project.inject(/** @lends Project# */{
/**
* Converts the passed node node into a Paper.js item and adds it to the
* active layer of this project.
*
* @param {SVGSVGElement} node the SVG DOM node to convert
* @return {Item} the converted Paper.js item
*/
importSVG: function(node) {
this.activate();
return importSVG(node, true);
}
});
};