forked from fms-cat/nightbird
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathContextMenu.js
50 lines (33 loc) · 1.04 KB
/
ContextMenu.js
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
Nightbird.ContextMenu = function( _nightbird ){
var it = this;
it.nightbird = _nightbird;
it.name = '';
it.posX = 0;
it.posY = 0;
it.width = 100;
it.height = 14;
};
Nightbird.ContextMenu.prototype.move = function( _x, _y ){
var it = this;
it.posX = _x;
it.posY = _y;
};
Nightbird.ContextMenu.prototype.setName = function( _name ){
var it = this;
it.name = _name;
};
Nightbird.ContextMenu.prototype.draw = function(){
var it = this;
it.nightbird.modularContext.fillStyle = '#aaa';
it.nightbird.modularContext.fillRect( it.posX, it.posY, it.width, it.height );
if( it.nightbird.selectContextMenu == it ){
it.nightbird.modularContext.fillStyle = '#444';
it.nightbird.modularContext.fillRect( it.posX+2, it.posY+2, it.width-4, it.height-4 );
it.nightbird.modularContext.fillStyle = '#aaa';
}else{
it.nightbird.modularContext.fillStyle = '#444';
}
it.nightbird.modularContext.textAlign = 'left';
it.nightbird.modularContext.textBaseline = 'middle';
it.nightbird.modularContext.fillText( it.name, it.posX+4, it.posY+7 );
};