2016-02-14 07:06:40 +11:00
|
|
|
/**
|
|
|
|
* @file ui_label.js
|
|
|
|
* @author frtk@tetalab
|
|
|
|
*/
|
|
|
|
|
2016-02-26 09:35:06 +11:00
|
|
|
NPGClient.UILabel = function(o) {
|
|
|
|
//
|
|
|
|
NPGClient.UIObject.call(this, o);
|
2016-02-14 07:06:40 +11:00
|
|
|
// obj name
|
2016-02-26 09:35:06 +11:00
|
|
|
this.name = o.name !== undefined ? o.name : '';
|
2016-02-14 07:06:40 +11:00
|
|
|
// pos
|
|
|
|
this.x = o.x !== undefined ? o.x : 0;
|
|
|
|
this.y = o.y !== undefined ? o.y : 0;
|
|
|
|
// text
|
|
|
|
this.text = o.text !== undefined ? o.text : '';
|
2016-02-14 10:23:22 +11:00
|
|
|
// text style
|
2016-02-26 09:35:06 +11:00
|
|
|
this.s = o.style !== undefined ? o.style : '';
|
2016-02-14 07:06:40 +11:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-02-26 09:35:06 +11:00
|
|
|
/**
|
|
|
|
* Inheritance
|
|
|
|
*/
|
|
|
|
NPGClient.UILabel.prototype = Object.create(NPGClient.UIObject.prototype);
|
|
|
|
|
2016-02-14 07:06:40 +11:00
|
|
|
|
2016-02-26 09:35:06 +11:00
|
|
|
/**
|
|
|
|
* Functions
|
|
|
|
*/
|
|
|
|
//
|
|
|
|
NPGClient.UILabel.prototype.constructor = NPGClient.UILabel;
|
|
|
|
|
|
|
|
//
|
|
|
|
NPGClient.UILabel.prototype.draw = function(ctx) {
|
|
|
|
var self = this;
|
|
|
|
NPGClient.Utils.setTxtStyle(ctx, self.s);
|
|
|
|
ctx.fillText(self.text, self.x, self.y);
|
2016-02-14 07:06:40 +11:00
|
|
|
|
|
|
|
};
|
|
|
|
|