2 function eventRellay( e ){
5 type = X.UI.Event.NameToID[ e.type ],
7 data = X.UI.currentRootData,
11 if( type !== X.UI.Event._POINTER_MOVE && type !== X.UI.Event._MOUSE_MOVE ){
12 //console.log( type + ' x:' + x + ', y:' + y )
17 if( data && ( data = data.monopolyNodeData ) && ( ret = data.dispatch( e ) ) & X.Callback.MONOPOLY ) return ret;
19 if( X.UI.currentRootData === null ) return ret;
21 list = X.UI.currentRootData.hoverList;
22 data = X.UI.currentRootData.targetNodeData = X.UI.currentRootData;
24 data = X.UI.currentRootData.targetNodeData;
27 _ret = data.dispatch( e, sysOnly );
29 if( _ret & X.Callback.MONOPOLY || _ret & X.Callback.STOP_PROPAGATION || _ret & X.Callback.STOP_NOW ) break; // sysOnly = true;
30 data = data.parentData;
33 for( i = list.length; i; ){
34 parent = data = list[ --i ];
35 while( parent.parentData && parent === parent.parentData.hitChildData ){
36 parent = parent.parentData;
38 if( parent !== X.UI.currentRootData ){
39 data.hoverClassName && data.xnode.removeClass( data.hoverClassName );
40 data._listeners && data._listeners[ X.UI.Event.POINTER_OUT ] && data.dispatch( e, X.UI.Event.POINTER_OUT, false ); // new Event
46 data.hoverClassName && data.xnode.addClassName( data.hoverClassName );
47 data._listeners && data._listeners[ X.UI.Event.POINTER_IN ] && data.dispatch( e, X.UI.Event.POINTER_IN, true ); // new Event
55 * body が存在したら要素を作成、css も指定
56 * 背景画像を読み終える onload で活動開始
59 var _PageRoot = _Box.inherits(
61 X.Class.FINAL | X.Class.PRIVATE_DATA | X.Class.SUPER_ACCESS,
63 layout : X.UI.Layout.Canvas,
67 targetNodeData : null,
68 monopolyNodeData : null,
70 xnodeInteractiveLayer : null,
74 Constructor : function( layout, args ){
75 this.SuperConstructor( layout, args );
77 if( X.Dom.readyState === X.Dom.Event.XDOM_READY ){
78 X.Timer.once( 0, this, this.start );
80 X.Dom.listenOnce( X.Dom.Event.XDOM_READY, this, this.start );
84 this.eventCounter = {};
86 X.UI.currentRootData = this;
90 this.initialize( this.User, this, null, null );
91 X.Timer.once( 0, this, this.addToView );
93 addToView : function(){
94 var counter = this.eventCounter, flg;
96 // this.xnodeInteractiveLayer の前に追加する!
98 this.addToParent( X.Dom.Node.root );
100 this.xnodeInteractiveLayer = X.Dom.Node.root.create( 'div', {
101 'class' : 'mouse-operation-catcher',
105 // hover や rollover rollout のための move イベントの追加
106 // X.Dom.Event.activate, X.Dom.Event.deactivate ?
107 // mouseout, mouseover
108 if( navigator.msPointerEnabled || navigator.pointerEnabled ){
109 this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ], eventRellay );
110 if( counter[ X.UI.Event._POINTER_MOVE ] ){
111 ++counter[ X.UI.Event._POINTER_MOVE ];
113 counter[ X.UI.Event._POINTER_MOVE ] = 1;
116 this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._MOUSE_MOVE ], eventRellay );
117 if( counter[ X.UI.Event._MOUSE_MOVE ] ){
118 ++counter[ X.UI.Event._MOUSE_MOVE ];
120 counter[ X.UI.Event._MOUSE_MOVE ] = 1;
123 X.Timer.once( 0, this, this.afterAddToView );
125 afterAddToView : function(){
126 //this.afterAddition();
127 this.xnode.className( 'PageRoot' );
129 this.creationComplete();
130 X.Timer.once( 0, this, this.doFirstCalc );
133 doFirstCalc : function(){
137 .listen( X.Dom.Event.VIEW_RESIZED, this, this.calculate )
138 .listen( X.Dom.Event.BASE_FONT_RESIZED, this, this.calculate );
141 reserveCalc : function(){
142 if( this.calcReserved === false ){
143 this.calcReserved = true;
144 X.Timer.once( 0, this, this.calculate );
147 calculate : function( e ){
148 var font = X.Dom.baseFontSize,
151 size = X.Dom.getSize();
158 this.layout.calculate( this, false, 0, 0, w / font, h / font );
159 this.calcReserved = false;
162 updateCoursor : function( cursor ){
166 _remove : function(){
167 this.xnodeInteractiveLayer.unlisten();
168 _Box.prototype._remove.call( this );
173 var PageRoot = Box.presets(