2014-05-21 4 views
0

상속해야합니다. Mover Dojo의 클래스는 기능이 변경되어야하기 때문에 발생할 수있는 그래픽 오류로 인해 변경되어야합니다.Dojo win.doc가 정의되지 않았습니다.

오류

: win.doc가 정의되지

define(["dojo/_base/declare", "dojo/dnd/Mover", "dojo/_base/event", "dojo/dom-geometry","dojo/window"],function(declare,Mover, event,domGeom,win){ 
    console.log("myMover"); 
     return declare([Mover],{ 
     onFirstMove: function(e){ 
     // summary: 
     //  makes the node absolute; it is meant to be called only once. 
     //  relative and absolutely positioned nodes are assumed to use pixel units 
     var s = this.node.style, l, t, h = this.host; 
     switch(s.position){ 
      case "relative": 
      case "absolute": 
       // assume that left and top values are in pixels already 
       l = Math.round(parseFloat(s.left)) || 0; 
       t = Math.round(parseFloat(s.top)) || 0; 
       break; 
      default: 
       var m = domGeom.getMarginBox(this.node); 
       s.position = "absolute"; // enforcing the absolute mode 
       // event.pageX/pageY (which we used to generate the initial 
       // margin box) includes padding and margin set on the body. 
       // However, setting the node's position to absolute and then 
       // doing domGeom.marginBox on it *doesn't* take that additional 
       // space into account - so we need to subtract the combined 
       // padding and margin. We use getComputedStyle and 
       // _getMarginBox/_getContentBox to avoid the extra lookup of 
       // the computed style. 
       var b = win.doc.body;       // Firebug is telling me win.doc is undefined 
       var bs = domStyle.getComputedStyle(b); 
       var bm = domGeom.getMarginBox(b, bs); 
       var bc = domGeom.getContentBox(b, bs); 
       l = m.l - (bc.l - bm.l); 
       t = m.t - (bc.t - bm.t); 
       break; 
     } 
     this.marginBox.l = l - this.marginBox.l; 
     this.marginBox.t = t - this.marginBox.t; 
     if(h && h.onFirstMove){ 
      h.onFirstMove(this, e); 
     } 

     // Disconnect touch.move that call this function 
     this.events.shift().remove(); 
    }, 
    }); 

}); 

나에게 솔루션을 말할 수 누구인가?

인사말 구월

답변

1

dojo/window 모듈과 dojo/_base/window 모듈 사이에 차이가있다. dojo/_base/window 모듈의 속성은 doc입니다. 예를 들어

:

require([ "dojo/_base/window", "dojo/window" ], function(win, win2) { 
    var myDoc = win.doc; // Returns current document 
    var myDoc2 = win2.doc; // Returns undefined 
}); 
관련 문제