UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

144 lines (127 loc) 4.99 kB
// Class: starling.text.TextOptions var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this $global.Object.defineProperty(exports, "__esModule", {value: true}); var __map_reserved = {}; // Imports var $hxClasses = require("./../../hxClasses_stub").default; var $hxEnums = require("./../../hxEnums_stub").default; var $import = require("./../../import_stub").default; var $extend = require("./../../extend_stub").default; function starling_events_EventDispatcher() {return require("./../../starling/events/EventDispatcher");} function Type() {return require("./../../Type");} function starling_core_Starling() {return require("./../../starling/core/Starling");} function starling_text_TextField() {return require("./../../starling/text/TextField");} // Constructor var TextOptions = function(wordWrap,autoScale) { if(autoScale == null) { autoScale = false; } if(wordWrap == null) { wordWrap = true; } (starling_events_EventDispatcher().default).call(this); this.__wordWrap = wordWrap; this.__autoScale = autoScale; this.__autoSize = "none"; this.__textureScale = (starling_core_Starling().default).get_current() != null ? (starling_core_Starling().default).get_current().get_contentScaleFactor() : 1; this.__textureFormat = (starling_text_TextField().default).get_defaultTextureFormat(); this.__isHtmlText = false; this.__padding = 0.0; } // Meta TextOptions.__name__ = "starling.text.TextOptions"; TextOptions.__isInterface__ = false; TextOptions.__super__ = (starling_events_EventDispatcher().default); TextOptions.prototype = $extend((starling_events_EventDispatcher().default).prototype, { copyFrom: function(options) { this.__wordWrap = options.__wordWrap; this.__autoScale = options.__autoScale; this.__autoSize = options.__autoSize; this.__isHtmlText = options.__isHtmlText; this.__textureScale = options.__textureScale; this.__textureFormat = options.__textureFormat; this.__padding = options.__padding; this.dispatchEventWith("change"); }, clone: function() { var actualClass = (Type().default).getClass(this); var clone = (Type().default).createInstance(actualClass,[]); clone.copyFrom(this); return clone; }, get_wordWrap: function() { return this.__wordWrap; }, set_wordWrap: function(value) { if(this.__wordWrap != value) { this.__wordWrap = value; this.dispatchEventWith("change"); } return value; }, get_autoSize: function() { return this.__autoSize; }, set_autoSize: function(value) { if(this.__autoSize != value) { this.__autoSize = value; this.dispatchEventWith("change"); } return value; }, get_autoScale: function() { return this.__autoScale; }, set_autoScale: function(value) { if(this.__autoScale != value) { this.__autoScale = value; this.dispatchEventWith("change"); } return value; }, get_isHtmlText: function() { return this.__isHtmlText; }, set_isHtmlText: function(value) { if(this.__isHtmlText != value) { this.__isHtmlText = value; this.dispatchEventWith("change"); } return value; }, get_textureScale: function() { return this.__textureScale; }, set_textureScale: function(value) { return this.__textureScale = value; }, get_textureFormat: function() { return this.__textureFormat; }, set_textureFormat: function(value) { if(this.__textureFormat != value) { this.__textureFormat = value; this.dispatchEventWith("change"); } return value; }, get_padding: function() { return this.__padding; }, set_padding: function(value) { if(value < 0) { value = 0; } if(this.__padding != value) { this.__padding = value; this.dispatchEventWith("change"); } return value; } }); TextOptions.prototype.__class__ = TextOptions.prototype.constructor = $hxClasses["starling.text.TextOptions"] = TextOptions; // Init Object.defineProperties(TextOptions.prototype,{ wordWrap : { get : function () { return this.get_wordWrap (); }, set : function (v) { return this.set_wordWrap (v); }}, autoSize : { get : function () { return this.get_autoSize (); }, set : function (v) { return this.set_autoSize (v); }}, autoScale : { get : function () { return this.get_autoScale (); }, set : function (v) { return this.set_autoScale (v); }}, isHtmlText : { get : function () { return this.get_isHtmlText (); }, set : function (v) { return this.set_isHtmlText (v); }}, styleSheet : { get : function () { return this.get_styleSheet (); }, set : function (v) { return this.set_styleSheet (v); }}, textureScale : { get : function () { return this.get_textureScale (); }, set : function (v) { return this.set_textureScale (v); }}, textureFormat : { get : function () { return this.get_textureFormat (); }, set : function (v) { return this.set_textureFormat (v); }}, padding : { get : function () { return this.get_padding (); }, set : function (v) { return this.set_padding (v); }}}); // Statics // Export exports.default = TextOptions;