2 function eventRellay( e ){
3 var x = e.clientX / X.Dom.baseFontSize,
4 y = e.clientY / X.Dom.baseFontSize,
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._TOUCH_MOVE && type !== '' + X.UI.Event._MOUSE_MOVE ){
12 //console.log( e.type + ' ' + 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 ( X.UI.currentRootData.targetNodeData = X.UI.currentRootData ).capcher( x, y );
23 data = X.UI.currentRootData.targetNodeData;
25 //data !== X.UI.currentRootData && console.log( data.xnode.text() );
28 _ret = data.dispatch( e, sysOnly );
30 if( _ret & X.Callback.MONOPOLY || _ret & X.Callback.STOP_PROPAGATION || _ret & X.Callback.STOP_NOW ) break; // sysOnly = true;
31 data = data.parentData;
34 for( i = list.length; i; ){
35 parent = data = list[ --i ];
36 while( parent.parentData && parent === parent.parentData.hitChildData ){
37 parent = parent.parentData;
39 if( parent !== X.UI.currentRootData ){
40 data.hoverClassName && data.xnode.removeClass( data.hoverClassName );
41 data._listeners && data._listeners[ X.UI.Event.POINTER_OUT ] && data.dispatch( e, X.UI.Event.POINTER_OUT, false ); // new Event
47 data.hoverClassName && data.xnode.addClassName( data.hoverClassName );
48 data._listeners && data._listeners[ X.UI.Event.POINTER_IN ] && data.dispatch( e, X.UI.Event.POINTER_IN, true ); // new Event
56 * body が存在したら要素を作成、css も指定
57 * 背景画像を読み終える onload で活動開始
60 var _PageRoot = _Box.inherits(
62 X.Class.FINAL | X.Class.PRIVATE_DATA | X.Class.SUPER_ACCESS,
64 layout : X.UI.Layout.Canvas,
68 targetNodeData : null,
69 monopolyNodeData : null,
71 xnodeInteractiveLayer : null,
75 Constructor : function( layout, args ){
76 this.SuperConstructor( layout, args );
78 if( X.Dom.readyState === X.Dom.Event.XDOM_READY ){
79 X.Timer.once( 0, this, this.start );
81 X.Dom.listenOnce( X.Dom.Event.XDOM_READY, this, this.start );
85 this.eventCounter = {};
87 X.UI.currentRootData = this;
91 this.initialize( this.User, this, null, null );
92 X.Timer.once( 0, this, this.addToView );
94 addToView : function(){
95 var counter = this.eventCounter, flg;
97 // this.xnodeInteractiveLayer の前に追加する!
99 this.addToParent( X.Dom.Node.root );
101 this.xnodeInteractiveLayer = X.Dom.Node.root.create( 'div', {
102 'class' : 'mouse-operation-catcher',
106 // hover や rollover rollout のための move イベントの追加
107 // X.Dom.Event.activate, X.Dom.Event.deactivate ?
108 // mouseout, mouseover
109 if( navigator.msPointerEnabled || navigator.pointerEnabled ){
110 this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ], eventRellay );
111 if( counter[ X.UI.Event._POINTER_MOVE ] ){
112 ++counter[ X.UI.Event._POINTER_MOVE ];
114 counter[ X.UI.Event._POINTER_MOVE ] = 1;
117 this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._MOUSE_MOVE ], eventRellay );
118 if( counter[ X.UI.Event._MOUSE_MOVE ] ){
119 ++counter[ X.UI.Event._MOUSE_MOVE ];
121 counter[ X.UI.Event._MOUSE_MOVE ] = 1;
124 X.Timer.once( 0, this, this.afterAddToView );
126 afterAddToView : function(){
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(