2013-06-24 2 views
0

다트에서 js.dart를 통해 paper.js를 사용하려고합니다.NoSuchMethodError with dart.js

많은 것이 작동하는 것처럼 보이지만 paper.js의 importSVG 메소드도 필요합니다. js.context.paper.project.importSVG(query("#svg"));으로 액세스하려고하면 NoSuchMethodError이 표시됩니다. 메소드가 프로젝트에 삽입 되었기 때문에 어떻게 든됩니다. 아래의 paper.js 코드를 참조하십시오.

어떻게 Dart에서 importSVG 메서드에 액세스합니까?

/* 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); 
      } 
    }); 
}; 
+0

http : //paper.js를 잠깐 살펴보면 js.context.paper.project.importSVG (query ("# svg"));가 올바르게 호출 된 것으로 보입니다. 전체 오류를 붙여 주실 수 있습니까? –

+0

답변 해 주셔서 감사합니다. "예외 발생 : NoSuchMethodError : 메서드를 찾을 수 없음 : 'importSVG'"js.dart에서 throw 됨 : 1038 –

+0

꽤 이상합니다. _chrome 개발자 도구로 테스트 할 수 있습니까?이 메서드는 javascript에 정의되어 있습니까? 콘솔에서'paper.project.importSVG'를 입력하십시오. 당신은'function (node) {this.activate(); return importSVG (node, true); }' –

답변

0

다트 호출이 올바른 것 같습니다. 질문에 대한 의견은 paper.project.importSVG의 자바 스크립트 가져 오기/선언에 문제가 있음을 보여주는 경향이 있습니다.

0

매우 이상합니다. 사용중인 라이브러리의 버전을 알려주시겠습니까? 그것은 맨 위 commime, 그리고 paper.version 변수에도 이것을 기술해야합니다.

관련 문제