44 lines
779 B
JavaScript
44 lines
779 B
JavaScript
/**
|
|
* @file ui_cursor.js
|
|
* @author frtk@tetalab
|
|
*/
|
|
|
|
NPGClient.UICursor = function(n, o) {
|
|
|
|
//
|
|
this.rect = new NPGClient.UIRect(n, o);
|
|
// obj name
|
|
this.name = n !== undefined ? n : '';
|
|
// state
|
|
this.bState = true;
|
|
this.bCount = 0;
|
|
this.bCountMax = 5;
|
|
|
|
};
|
|
|
|
NPGClient.UICursor.prototype = {
|
|
|
|
// Constructor
|
|
constructor: NPGClient.UICursor,
|
|
|
|
//
|
|
draw: function(ctx) {
|
|
var self = this;
|
|
if (self.bState) {
|
|
if (self.bCount == self.bCountMax) {
|
|
self.bCount = 0;
|
|
self.bState = false;
|
|
} else self.rect.draw(ctx);
|
|
self.bCount++;
|
|
} else {
|
|
if (self.bCount == self.bCountMax) {
|
|
self.bCount = 0;
|
|
self.bState = true;
|
|
self.rect.draw(ctx);
|
|
} else self.bCount++;
|
|
}
|
|
},
|
|
|
|
};
|
|
|