blob: 840f67ecc8150483e1df9001bf82fa2d42ff9a14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/*
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
if(!dojo._hasResource["dojox.drawing.manager.StencilUI"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo._hasResource["dojox.drawing.manager.StencilUI"] = true;
dojo.provide("dojox.drawing.manager.StencilUI");
(function(){
var surface, surfaceNode;
dojox.drawing.manager.StencilUI = dojox.drawing.util.oo.declare(
// summary:
// Used for handling Stencils as UI components.
// description:
// Replaces manager.Stencil. Handles basic UI mouse
// events like onmouseover. Does not handle selections
// or support delete, etc.
//
function(options){
//
// TODO: mixin props
//
surface = options.surface;
this.canvas = options.canvas;
this.defaults = dojox.drawing.defaults.copy();
this.mouse = options.mouse;
this.keys = options.keys;
this._mouseHandle = this.mouse.register(this);
this.stencils = {};
},
{
register: function(/*Object*/stencil){
this.stencils[stencil.id] = stencil;
return stencil;
},
onUiDown: function(/*EventObject*/obj){
// summary:
// Event fired on mousedown on a stencil
//
if(!this._isStencil(obj)){ return; }
this.stencils[obj.id].onDown(obj);
},
onUiUp: function(/*EventObject*/obj){
// summary:
// Event fired on mousedown on a stencil
//
if(!this._isStencil(obj)){ return; }
this.stencils[obj.id].onUp(obj);
},
onOver: function(/*EventObject*/obj){
// summary:
// Event fired on mousedown on a stencil
//
if(!this._isStencil(obj)){ return; }
this.stencils[obj.id].onOver(obj);
},
onOut: function(/*EventObject*/obj){
// summary:
// Event fired on mousedown on a stencil
//
if(!this._isStencil(obj)){ return; }
this.stencils[obj.id].onOut(obj);
},
_isStencil: function(/*EventObject*/obj){
return !!obj.id && !!this.stencils[obj.id] && this.stencils[obj.id].type == "drawing.library.UI.Button";
}
}
);
})();
}
|