| 1 |
define(["dojo", "../util/oo"], |
| 2 |
function(dojo, oo){ |
| 3 |
var surface, surfaceNode; |
| 4 |
|
| 5 |
return oo.declare( |
| 6 |
function(options){ |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
surface = options.surface; |
| 11 |
this.canvas = options.canvas; |
| 12 |
|
| 13 |
|
| 14 |
this.mouse = options.mouse; |
| 15 |
this.keys = options.keys; |
| 16 |
this._mouseHandle = this.mouse.register(this); |
| 17 |
this.stencils = {}; |
| 18 |
}, |
| 19 |
{ |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
register: function(stencil){ |
| 28 |
this.stencils[stencil.id] = stencil; |
| 29 |
return stencil; |
| 30 |
}, |
| 31 |
onUiDown: function(obj){ |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
if(!this._isStencil(obj)){ return; } |
| 36 |
this.stencils[obj.id].onDown(obj); |
| 37 |
}, |
| 38 |
onUiUp: function(obj){ |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
if(!this._isStencil(obj)){ return; } |
| 43 |
this.stencils[obj.id].onUp(obj); |
| 44 |
}, |
| 45 |
onOver: function(obj){ |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
if(!this._isStencil(obj)){ return; } |
| 50 |
this.stencils[obj.id].onOver(obj); |
| 51 |
}, |
| 52 |
onOut: function(obj){ |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
if(!this._isStencil(obj)){ return; } |
| 57 |
this.stencils[obj.id].onOut(obj); |
| 58 |
}, |
| 59 |
_isStencil: function(obj){ |
| 60 |
return !!obj.id && !!this.stencils[obj.id] && this.stencils[obj.id].type == "drawing.library.UI.Button"; |
| 61 |
} |
| 62 |
} |
| 63 |
); |
| 64 |
|
| 65 |
}); |