openfl
Version:
A fast, productive library for 2D cross-platform development.
1,509 lines (1,500 loc) • 65.2 kB
JavaScript
// Class: openfl.text.TextField
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 $bind = require("./../../bind_stub").default;
var $extend = require("./../../extend_stub").default;
function openfl_display_InteractiveObject() {return require("./../../openfl/display/InteractiveObject");}
function openfl_geom_Rectangle() {return require("./../../openfl/geom/Rectangle");}
function openfl__$Vector_VectorIterator() {return require("./../../openfl/_Vector/VectorIterator");}
function openfl_text_TextLineMetrics() {return require("./../../openfl/text/TextLineMetrics");}
function js__$Boot_HaxeError() {return require("./../../js/_Boot/HaxeError");}
function openfl_errors_RangeError() {return require("./../../openfl/errors/RangeError");}
function openfl_text_TextFormat() {return require("./../../openfl/text/TextFormat");}
function openfl_text__$internal_TextFormatRange() {return require("./../../openfl/text/_internal/TextFormatRange");}
function openfl__$Vector_Vector_$Impl_$() {return require("./../../openfl/_Vector/Vector_Impl_");}
function lime_utils_Log() {return require("./../../lime/utils/Log");}
function StringTools() {return require("./../../StringTools");}
function openfl_events_TextEvent() {return require("./../../openfl/events/TextEvent");}
function HxOverrides() {return require("./../../HxOverrides");}
function openfl_Lib() {return require("./../../openfl/Lib");}
function openfl_net_URLRequest() {return require("./../../openfl/net/URLRequest");}
function haxe_CallStack() {return require("./../../haxe/CallStack");}
function openfl_VectorData() {return require("./../../openfl/VectorData");}
function haxe_Timer() {return require("./../../haxe/Timer");}
function openfl_display_DisplayObject() {return require("./../../openfl/display/DisplayObject");}
function Std() {return require("./../../Std");}
function openfl_errors_TypeError() {return require("./../../openfl/errors/TypeError");}
function EReg() {return require("./../../EReg");}
function openfl_text__$internal_HTMLParser() {return require("./../../openfl/text/_internal/HTMLParser");}
function openfl_events_Event() {return require("./../../openfl/events/Event");}
function lime_system_Clipboard() {return require("./../../lime/system/Clipboard");}
function lime_ui__$KeyModifier_KeyModifier_$Impl_$() {return require("./../../lime/ui/_KeyModifier/KeyModifier_Impl_");}
function haxe_ds_StringMap() {return require("./../../haxe/ds/StringMap");}
function openfl_display_Graphics() {return require("./../../openfl/display/Graphics");}
function openfl_text__$internal_TextEngine() {return require("./../../openfl/text/_internal/TextEngine");}
// Constructor
var TextField = function() {
this.__forceCachedBitmapUpdate = false;
this.__renderedOnCanvasWhileOnDOM = false;
this.__mouseScrollVCounter = 0;
this.condenseWhite = false;
(openfl_display_InteractiveObject().default).call(this);
this.__wordSelection = false;
this.__drawableType = 7;
this.__caretIndex = -1;
this.__selectionIndex = -1;
this.__displayAsPassword = false;
this.__graphics = new (openfl_display_Graphics().default)(this);
this.__textEngine = new (openfl_text__$internal_TextEngine().default)(this);
this.__layoutDirty = true;
this.__offsetX = 0;
this.__offsetY = 0;
this.__mouseWheelEnabled = true;
this.__text = "";
if(TextField.__defaultTextFormat == null) {
TextField.__defaultTextFormat = new (openfl_text_TextFormat().default)("Times New Roman",12,0,false,false,false,"","","left",0,0,0,0);
TextField.__defaultTextFormat.blockIndent = 0;
TextField.__defaultTextFormat.bullet = false;
TextField.__defaultTextFormat.letterSpacing = 0;
TextField.__defaultTextFormat.kerning = false;
}
this.__textFormat = TextField.__defaultTextFormat.clone();
(openfl__$Vector_Vector_$Impl_$().default).push(this.__textEngine.textFormatRanges,new (openfl_text__$internal_TextFormatRange().default)(this.__textFormat,0,0));
this.addEventListener("mouseDown",$bind(this,this.this_onMouseDown));
this.addEventListener("focusIn",$bind(this,this.this_onFocusIn));
this.addEventListener("focusOut",$bind(this,this.this_onFocusOut));
this.addEventListener("keyDown",$bind(this,this.this_onKeyDown));
this.addEventListener("mouseWheel",$bind(this,this.this_onMouseWheel));
}
// Meta
TextField.__name__ = "openfl.text.TextField";
TextField.__isInterface__ = false;
TextField.__super__ = (openfl_display_InteractiveObject().default);
TextField.prototype = $extend((openfl_display_InteractiveObject().default).prototype, {
appendText: function(text) {
if(text == null || text == "") {
return;
}
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
this.__updateText(this.__text + text);
this.__textEngine.textFormatRanges[this.__textEngine.textFormatRanges.get_length() - 1].end = this.__text.length;
this.__selectionIndex = this.__caretIndex = this.__text.length;
},
getCharBoundaries: function(charIndex) {
if(charIndex < 0 || charIndex > this.__text.length - 1) {
return null;
}
var rect = new (openfl_geom_Rectangle().default)();
if(this.__getCharBoundaries(charIndex,rect)) {
return rect;
} else {
return null;
}
},
getCharIndexAtPoint: function(x,y) {
if(x <= 2 || x > this.get_width() + 4 || y <= 0 || y > this.get_height() + 4) {
return -1;
}
this.__updateLayout();
x += this.get_scrollH();
var _g = 0;
var _g1 = this.get_scrollV() - 1;
while(_g < _g1) {
var i = _g++;
y += this.__textEngine.lineHeights[i];
}
var group = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.layoutGroups);
while(group.hasNext()) {
var group1 = group.next();
if(y >= group1.offsetY && y <= group1.offsetY + group1.height) {
if(x >= group1.offsetX && x <= group1.offsetX + group1.width) {
var advance = 0.0;
var _g3 = 0;
var _g4 = group1.positions.length;
while(_g3 < _g4) {
var i1 = _g3++;
advance += group1.getAdvance(i1);
if(x <= group1.offsetX + advance) {
return group1.startIndex + i1;
}
}
return group1.endIndex;
}
}
}
return -1;
},
getFirstCharInParagraph: function(charIndex) {
if(charIndex < 0 || charIndex > this.get_text().length) {
return -1;
}
if(this.__textEngine.lineBreaks.get_length() == 0) {
return 0;
}
var _g = 0;
var _g1 = this.__textEngine.lineBreaks.get_length();
while(_g < _g1) {
var i = _g++;
if(charIndex <= this.__textEngine.lineBreaks[i]) {
if(i == 0) {
return 0;
} else {
return this.__textEngine.lineBreaks[i - 1] + 1;
}
}
}
return this.__textEngine.lineBreaks[this.__textEngine.lineBreaks.get_length() - 1] + 1;
},
getLineIndexAtPoint: function(x,y) {
this.__updateLayout();
if(x <= 2 || x > this.get_width() + 4 || y <= 0 || y > this.get_height() + 4) {
return -1;
}
var _g = 0;
var _g1 = this.get_scrollV() - 1;
while(_g < _g1) {
var i = _g++;
y += this.__textEngine.lineHeights[i];
}
var group = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.layoutGroups);
while(group.hasNext()) {
var group1 = group.next();
if(y >= group1.offsetY && y <= group1.offsetY + group1.height) {
return group1.lineIndex;
}
}
return -1;
},
getLineIndexOfChar: function(charIndex) {
if(charIndex < 0 || charIndex > this.__text.length) {
return -1;
}
this.__updateLayout();
var group = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.layoutGroups);
while(group.hasNext()) {
var group1 = group.next();
if(group1.startIndex <= charIndex && group1.endIndex >= charIndex) {
return group1.lineIndex;
}
}
return -1;
},
getLineLength: function(lineIndex) {
this.__updateLayout();
if(lineIndex < 0 || lineIndex > this.__textEngine.numLines - 1) {
return 0;
}
var startIndex = -1;
var endIndex = -1;
var group = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.layoutGroups);
while(group.hasNext()) {
var group1 = group.next();
if(group1.lineIndex == lineIndex) {
if(startIndex == -1) {
startIndex = group1.startIndex;
}
} else if(group1.lineIndex == lineIndex + 1) {
endIndex = group1.startIndex;
break;
}
}
if(endIndex == -1) {
endIndex = this.__text.length;
}
return endIndex - startIndex;
},
getLineMetrics: function(lineIndex) {
this.__updateLayout();
var ascender = this.__textEngine.lineAscents[lineIndex];
var descender = this.__textEngine.lineDescents[lineIndex];
var leading = this.__textEngine.lineLeadings[lineIndex];
var lineHeight = this.__textEngine.lineHeights[lineIndex];
var lineWidth = this.__textEngine.lineWidths[lineIndex];
var margin;
switch(this.__textFormat.align) {
case "center":
margin = (this.__textEngine.width - lineWidth) / 2;
break;
case "end":case "right":
margin = this.__textEngine.width - lineWidth - 2;
break;
case "justify":case "left":case "start":
margin = 2;
break;
}
return new (openfl_text_TextLineMetrics().default)(margin,lineWidth,lineHeight,ascender,descender,leading);
},
getLineOffset: function(lineIndex) {
this.__updateLayout();
if(lineIndex < 0 || lineIndex > this.__textEngine.numLines - 1) {
return -1;
}
var group = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.layoutGroups);
while(group.hasNext()) {
var group1 = group.next();
if(group1.lineIndex == lineIndex) {
return group1.startIndex;
}
}
return 0;
},
getLineText: function(lineIndex) {
this.__updateLayout();
if(lineIndex < 0 || lineIndex > this.__textEngine.numLines - 1) {
return null;
}
var startIndex = -1;
var endIndex = -1;
var group = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.layoutGroups);
while(group.hasNext()) {
var group1 = group.next();
if(group1.lineIndex == lineIndex) {
if(startIndex == -1) {
startIndex = group1.startIndex;
}
} else if(group1.lineIndex == lineIndex + 1) {
endIndex = group1.startIndex;
break;
}
}
if(endIndex == -1) {
endIndex = this.__text.length;
}
return this.__textEngine.text.substring(startIndex,endIndex);
},
getParagraphLength: function(charIndex) {
if(charIndex < 0 || charIndex > this.get_text().length) {
return -1;
}
var startIndex = this.getFirstCharInParagraph(charIndex);
if(charIndex >= this.get_text().length) {
return this.get_text().length - startIndex + 1;
}
var endIndex = this.__textEngine.getLineBreakIndex(charIndex) + 1;
if(endIndex == 0) {
endIndex = this.__text.length;
}
return endIndex - startIndex;
},
getTextFormat: function(beginIndex,endIndex) {
if(endIndex == null) {
endIndex = -1;
}
if(beginIndex == null) {
beginIndex = -1;
}
var format = null;
if(beginIndex >= this.get_text().length || beginIndex < -1 || endIndex > this.get_text().length || endIndex < -1) {
throw new (js__$Boot_HaxeError().default)(new (openfl_errors_RangeError().default)("The supplied index is out of bounds"));
}
if(beginIndex == -1) {
beginIndex = 0;
}
if(endIndex == -1) {
endIndex = this.get_text().length;
}
if(beginIndex >= endIndex) {
return new (openfl_text_TextFormat().default)();
}
var group = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.textFormatRanges);
while(group.hasNext()) {
var group1 = group.next();
if(group1.start <= beginIndex && group1.end > beginIndex || group1.start < endIndex && group1.end >= endIndex) {
if(format == null) {
format = group1.format.clone();
} else {
if(group1.format.font != format.font) {
format.font = null;
}
if(group1.format.size != format.size) {
format.size = null;
}
if(group1.format.color != format.color) {
format.color = null;
}
if(group1.format.bold != format.bold) {
format.bold = null;
}
if(group1.format.italic != format.italic) {
format.italic = null;
}
if(group1.format.underline != format.underline) {
format.underline = null;
}
if(group1.format.url != format.url) {
format.url = null;
}
if(group1.format.target != format.target) {
format.target = null;
}
if(group1.format.align != format.align) {
format.align = null;
}
if(group1.format.leftMargin != format.leftMargin) {
format.leftMargin = null;
}
if(group1.format.rightMargin != format.rightMargin) {
format.rightMargin = null;
}
if(group1.format.indent != format.indent) {
format.indent = null;
}
if(group1.format.leading != format.leading) {
format.leading = null;
}
if(group1.format.blockIndent != format.blockIndent) {
format.blockIndent = null;
}
if(group1.format.bullet != format.bullet) {
format.bullet = null;
}
if(group1.format.kerning != format.kerning) {
format.kerning = null;
}
if(group1.format.letterSpacing != format.letterSpacing) {
format.letterSpacing = null;
}
if(group1.format.tabStops != format.tabStops) {
format.tabStops = null;
}
}
}
}
if(format == null) {
format = new (openfl_text_TextFormat().default)();
}
return format;
},
replaceSelectedText: function(value) {
this.__replaceSelectedText(value,false);
},
replaceText: function(beginIndex,endIndex,newText) {
this.__replaceText(beginIndex,endIndex,newText,false);
},
setSelection: function(beginIndex,endIndex) {
this.__selectionIndex = beginIndex;
this.__caretIndex = endIndex;
this.__updateScrollV();
this.__updateScrollH();
if(this.stage != null && this.stage.get_focus() == this) {
this.__stopCursorTimer();
this.__startCursorTimer();
}
},
setTextFormat: function(format,beginIndex,endIndex) {
if(endIndex == null) {
endIndex = -1;
}
if(beginIndex == null) {
beginIndex = -1;
}
var max = this.get_text().length;
var range;
if(beginIndex == -1) {
if(endIndex == -1) {
endIndex = max;
}
beginIndex = 0;
} else if(endIndex == -1) {
endIndex = beginIndex + 1;
}
if(beginIndex == endIndex) {
return;
}
if(beginIndex < 0 || endIndex <= 0 || endIndex < beginIndex || beginIndex >= max || endIndex > max) {
throw new (js__$Boot_HaxeError().default)(new (openfl_errors_RangeError().default)());
}
if(beginIndex == 0 && endIndex == max) {
this.__textEngine.textFormatRanges.set_length(1);
range = this.__textEngine.textFormatRanges[0];
range.start = 0;
range.end = max;
range.format.__merge(format);
} else {
var index = 0;
var newRange;
while(index < this.__textEngine.textFormatRanges.get_length()) {
range = this.__textEngine.textFormatRanges[index];
if(range.end <= beginIndex) {
++index;
} else if(range.start >= endIndex) {
break;
} else if(range.start <= beginIndex && range.end >= endIndex) {
if(range.start == beginIndex && range.end == endIndex) {
range.format = range.format.clone();
range.format.__merge(format);
break;
} else if(range.start == beginIndex) {
newRange = new (openfl_text__$internal_TextFormatRange().default)(range.format.clone(),beginIndex,endIndex);
newRange.format.__merge(format);
(openfl__$Vector_Vector_$Impl_$().default).insertAt(this.__textEngine.textFormatRanges,index,newRange);
range.start = endIndex;
index += 2;
} else if(range.end == endIndex) {
newRange = new (openfl_text__$internal_TextFormatRange().default)(range.format.clone(),beginIndex,endIndex);
newRange.format.__merge(format);
(openfl__$Vector_Vector_$Impl_$().default).insertAt(this.__textEngine.textFormatRanges,index + 1,newRange);
range.end = beginIndex;
break;
} else {
newRange = new (openfl_text__$internal_TextFormatRange().default)(range.format.clone(),beginIndex,endIndex);
newRange.format.__merge(format);
(openfl__$Vector_Vector_$Impl_$().default).insertAt(this.__textEngine.textFormatRanges,index + 1,newRange);
newRange = new (openfl_text__$internal_TextFormatRange().default)(range.format.clone(),endIndex,range.end);
(openfl__$Vector_Vector_$Impl_$().default).insertAt(this.__textEngine.textFormatRanges,index + 2,newRange);
range.end = beginIndex;
break;
}
} else if(range.start >= beginIndex && range.end <= endIndex) {
if(range.start == beginIndex) {
range.format = range.format.clone();
range.format.__merge(format);
range.end = endIndex;
} else {
(openfl__$Vector_Vector_$Impl_$().default).removeAt(this.__textEngine.textFormatRanges,index);
}
} else if(range.start > beginIndex && range.end > beginIndex) {
range.start = endIndex;
break;
} else if(range.start < beginIndex && range.end <= endIndex) {
newRange = new (openfl_text__$internal_TextFormatRange().default)(range.format.clone(),beginIndex,endIndex);
newRange.format.__merge(format);
(openfl__$Vector_Vector_$Impl_$().default).insertAt(this.__textEngine.textFormatRanges,index + 1,newRange);
range.end = beginIndex;
index += 2;
} else {
++index;
(lime_utils_Log().default).warn("You found a bug in OpenFL's text code! Please save a copy of your project and create an issue on GitHub so we can fix this.",{ fileName : "../node_modules/openfl-haxelib/src/openfl/text/TextField.hx", lineNumber : 1610, className : "openfl.text.TextField", methodName : "setTextFormat"});
}
}
}
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
},
__setStageReference: function(stage) {
this.__stopTextInput();
(openfl_display_InteractiveObject().default).prototype.__setStageReference.call(this,stage);
},
__allowMouseFocus: function() {
return this.mouseEnabled;
},
__caretBeginningOfLine: function() {
this.__caretIndex = this.getLineOffset(this.getLineIndexOfChar(this.__caretIndex));
},
__caretBeginningOfNextLine: function() {
var lineIndex = this.getLineIndexOfChar(this.__caretIndex);
if(lineIndex < this.__textEngine.numLines - 1) {
this.__caretIndex = this.getLineOffset(lineIndex + 1);
} else {
this.__caretIndex = this.__text.length;
}
},
__caretBeginningOfPreviousLine: function() {
var lineIndex = this.getLineIndexOfChar(this.__caretIndex);
if(lineIndex > 0) {
var index = this.getLineOffset(this.getLineIndexOfChar(this.__caretIndex));
if(this.__caretIndex == index) {
this.__caretIndex = this.getLineOffset(lineIndex - 1);
} else {
this.__caretIndex = index;
}
}
},
__caretEndOfLine: function() {
var lineIndex = this.getLineIndexOfChar(this.__caretIndex);
if(lineIndex < this.__textEngine.numLines - 1) {
this.__caretIndex = this.getLineOffset(lineIndex + 1) - 1;
} else {
this.__caretIndex = this.__text.length;
}
},
__caretNextCharacter: function() {
if(this.__caretIndex < this.__text.length) {
this.__caretIndex++;
}
},
__caretNextLine: function() {
var lineIndex = this.getLineIndexOfChar(this.__caretIndex);
if(lineIndex < this.__textEngine.numLines - 1) {
this.__caretIndex = this.__getCharIndexOnDifferentLine(this.get_caretIndex(),lineIndex + 1);
}
},
__caretPreviousCharacter: function() {
if(this.__caretIndex > 0) {
this.__caretIndex--;
}
},
__caretPreviousLine: function() {
var lineIndex = this.getLineIndexOfChar(this.__caretIndex);
if(lineIndex > 0) {
this.__caretIndex = this.__getCharIndexOnDifferentLine(this.get_caretIndex(),lineIndex - 1);
}
},
__disableInput: function() {
if(this.__inputEnabled && this.stage != null) {
this.stage.window.set_textInputEnabled(false);
this.stage.window.onTextInput.remove($bind(this,this.window_onTextInput));
this.stage.window.onKeyDown.remove($bind(this,this.window_onKeyDown));
this.__inputEnabled = false;
this.__stopCursorTimer();
}
},
__dispatch: function(event) {
if(event.eventPhase == 2 && event.type == "mouseUp") {
var event1 = event;
var group = this.__getGroup(this.get_mouseX(),this.get_mouseY(),true);
if(group != null) {
var url = group.format.url;
if(url != null && url != "") {
if((StringTools().default).startsWith(url,"event:")) {
this.dispatchEvent(new (openfl_events_TextEvent().default)("link",true,false,(HxOverrides().default).substr(url,6,null)));
} else {
(openfl_Lib().default).getURL(new (openfl_net_URLRequest().default)(url));
}
}
}
}
return (openfl_display_InteractiveObject().default).prototype.__dispatch.call(this,event);
},
__enableInput: function() {
if(this.stage != null) {
this.stage.window.set_textInputEnabled(true);
if(!this.__inputEnabled) {
this.stage.window.set_textInputEnabled(true);
if(!this.stage.window.onTextInput.has($bind(this,this.window_onTextInput))) {
this.stage.window.onTextInput.add($bind(this,this.window_onTextInput));
this.stage.window.onKeyDown.add($bind(this,this.window_onKeyDown));
}
this.__inputEnabled = true;
this.__stopCursorTimer();
this.__startCursorTimer();
}
}
},
__getAdvance: function(position) {
return position;
},
__getBounds: function(rect,matrix) {
this.__updateLayout();
var bounds = (openfl_geom_Rectangle().default).__pool.get();
bounds.copyFrom(this.__textEngine.bounds);
bounds.offset(this.__offsetX,this.__offsetY);
bounds.__transform(bounds,matrix);
rect.__expand(bounds.x,bounds.y,bounds.width,bounds.height);
(openfl_geom_Rectangle().default).__pool.release(bounds);
},
__getCharBoundaries: function(charIndex,rect) {
if(charIndex < 0 || charIndex > this.__text.length - 1) {
return false;
}
this.__updateLayout();
var group = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.layoutGroups);
while(group.hasNext()) {
var group1 = group.next();
if(charIndex >= group1.startIndex && charIndex < group1.endIndex) {
try {
var x = group1.offsetX;
var _g1 = 0;
var _g2 = charIndex - group1.startIndex;
while(_g1 < _g2) {
var i = _g1++;
x += group1.getAdvance(i);
}
var lastPosition = group1.getAdvance(charIndex - group1.startIndex);
rect.setTo(x,group1.offsetY,lastPosition,group1.ascent + group1.descent);
return true;
} catch( e ) {
(haxe_CallStack().default).lastException = e;
var e1 = ((e) instanceof (js__$Boot_HaxeError().default)) ? e.val : e;
}
}
}
return false;
},
__getCharIndexOnDifferentLine: function(charIndex,lineIndex) {
if(charIndex < 0 || charIndex > this.__text.length) {
return -1;
}
if(lineIndex < 0 || lineIndex > this.__textEngine.numLines - 1) {
return -1;
}
var x = null;
var y = null;
var group = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.layoutGroups);
while(group.hasNext()) {
var group1 = group.next();
if(charIndex >= group1.startIndex && charIndex <= group1.endIndex) {
x = group1.offsetX;
var _g1 = 0;
var _g2 = charIndex - group1.startIndex;
while(_g1 < _g2) {
var i = _g1++;
x += group1.getAdvance(i);
}
if(y != null) {
return this.__getPosition(x,y);
}
}
if(group1.lineIndex == lineIndex) {
y = group1.offsetY + group1.height / 2;
var _g11 = 0;
var _g21 = this.get_scrollV() - 1;
while(_g11 < _g21) {
var i1 = _g11++;
y -= this.__textEngine.lineHeights[i1];
}
if(x != null) {
return this.__getPosition(x,y);
}
}
}
return -1;
},
__getCursor: function() {
var group = this.__getGroup(this.get_mouseX(),this.get_mouseY(),true);
if(group != null && group.format.url != "") {
return "button";
} else if(this.__textEngine.selectable) {
return "ibeam";
}
return null;
},
__getGroup: function(x,y,precise) {
if(precise == null) {
precise = false;
}
this.__updateLayout();
x += this.get_scrollH();
var _g = 0;
var _g1 = this.get_scrollV() - 1;
while(_g < _g1) {
var i = _g++;
y += this.__textEngine.lineHeights[i];
}
if(!precise && y > this.__textEngine.textHeight) {
y = this.__textEngine.textHeight;
}
var firstGroup = true;
var group;
var nextGroup;
var _g2 = 0;
var _g3 = this.__textEngine.layoutGroups.get_length();
while(_g2 < _g3) {
var i1 = _g2++;
group = this.__textEngine.layoutGroups[i1];
if(i1 < this.__textEngine.layoutGroups.get_length() - 1) {
nextGroup = this.__textEngine.layoutGroups[i1 + 1];
} else {
nextGroup = null;
}
if(firstGroup) {
if(y < group.offsetY) {
y = group.offsetY;
}
if(x < group.offsetX) {
x = group.offsetX;
}
firstGroup = false;
}
if(y >= group.offsetY && y <= group.offsetY + group.height || !precise && nextGroup == null) {
if(x >= group.offsetX && x <= group.offsetX + group.width || !precise && (nextGroup == null || nextGroup.lineIndex != group.lineIndex)) {
return group;
}
}
}
return null;
},
__getPosition: function(x,y) {
var group = this.__getGroup(x,y);
if(group == null) {
return this.__text.length;
}
var advance = 0.0;
var _g = 0;
var _g1 = group.positions.length;
while(_g < _g1) {
var i = _g++;
advance += group.getAdvance(i);
if(x <= group.offsetX + advance) {
if(x <= group.offsetX + (advance - group.getAdvance(i)) + group.getAdvance(i) / 2) {
return group.startIndex + i;
} else if(group.startIndex + i < group.endIndex) {
return group.startIndex + i + 1;
} else {
return group.endIndex;
}
}
}
return group.endIndex;
},
__getPositionByIdentifier: function(x,y,line) {
var position = this.__getPosition(x,y);
var delimiters = line ? "\n" : " .,;:!?()[]{}<>/\\|-=+*&^%$#@~`'\"";
var char = this.__text.charAt(position);
if(this.__specialSelectionInitialIndex <= position) {
while(delimiters.indexOf(char) == -1 && position < this.__text.length) {
++position;
char = this.__text.charAt(position);
}
} else {
while(delimiters.indexOf(char) == -1 && position > 0) {
--position;
char = this.__text.charAt(position);
}
if(position == 0) {
return position;
}
++position;
}
return position;
},
__getOppositeIdentifierBound: function(charIndex,line) {
var position = charIndex;
var delimiters = line ? "\n" : " .,;:!?()[]{}<>/\\|-=+*&^%$#@~`'\"";
var char = this.__text.charAt(position);
if(position <= this.__caretIndex) {
while(delimiters.indexOf(char) == -1 && position > 0) {
--position;
char = this.__text.charAt(position);
}
if(position == 0) {
return position;
}
++position;
} else {
while(delimiters.indexOf(char) == -1 && position < this.__text.length) {
++position;
char = this.__text.charAt(position);
}
}
return position;
},
__hitTest: function(x,y,shapeFlag,stack,interactiveOnly,hitObject) {
if(!hitObject.get_visible() || this.__isMask || interactiveOnly && !this.mouseEnabled) {
return false;
}
if(this.get_mask() != null && !this.get_mask().__hitTestMask(x,y)) {
return false;
}
this.__getRenderTransform();
this.__updateLayout();
var px = this.__renderTransform.__transformInverseX(x,y);
var py = this.__renderTransform.__transformInverseY(x,y);
if(this.__textEngine.bounds.contains(px,py)) {
if(stack != null) {
stack.push(hitObject);
}
return true;
}
return false;
},
__hitTestMask: function(x,y) {
this.__getRenderTransform();
this.__updateLayout();
var px = this.__renderTransform.__transformInverseX(x,y);
var py = this.__renderTransform.__transformInverseY(x,y);
if(this.__textEngine.bounds.contains(px,py)) {
return true;
}
return false;
},
__replaceSelectedText: function(value,restrict) {
if(restrict == null) {
restrict = true;
}
if(value == null) {
value = "";
}
if(value == "" && this.__selectionIndex == this.__caretIndex) {
return;
}
var startIndex = this.__caretIndex < this.__selectionIndex ? this.__caretIndex : this.__selectionIndex;
var endIndex = this.__caretIndex > this.__selectionIndex ? this.__caretIndex : this.__selectionIndex;
if(startIndex == endIndex && this.__textEngine.maxChars > 0 && this.__text.length == this.__textEngine.maxChars) {
return;
}
if(startIndex > this.__text.length) {
startIndex = this.__text.length;
}
if(endIndex > this.__text.length) {
endIndex = this.__text.length;
}
if(endIndex < startIndex) {
var cache = endIndex;
endIndex = startIndex;
startIndex = cache;
}
if(startIndex < 0) {
startIndex = 0;
}
this.__replaceText(startIndex,endIndex,value,restrict);
},
__replaceText: function(beginIndex,endIndex,newText,restrict) {
if(endIndex < beginIndex || beginIndex < 0 || endIndex > this.__text.length || newText == null) {
return;
}
if(restrict) {
newText = this.__textEngine.restrictText(newText);
if(this.__textEngine.maxChars > 0) {
var removeLength = endIndex - beginIndex;
var maxLength = this.__textEngine.maxChars - this.__text.length + removeLength;
if(maxLength <= 0) {
newText = "";
} else if(maxLength < newText.length) {
newText = (HxOverrides().default).substr(newText,0,maxLength);
}
}
}
this.__updateText(this.__text.substring(0,beginIndex) + newText + this.__text.substring(endIndex));
var offset = newText.length - (endIndex - beginIndex);
var i = 0;
var range;
while(i < this.__textEngine.textFormatRanges.get_length()) {
range = this.__textEngine.textFormatRanges[i];
if(beginIndex == endIndex) {
if(range.start == range.end) {
if(range.start != 0) {
(lime_utils_Log().default).warn("You found a bug in OpenFL's text code! Please save a copy of your project and create an issue on GitHub so we can fix this.",{ fileName : "../node_modules/openfl-haxelib/src/openfl/text/TextField.hx", lineNumber : 2184, className : "openfl.text.TextField", methodName : "__replaceText"});
} else {
range.end += offset;
}
} else if(range.end >= beginIndex) {
if(range.start >= beginIndex) {
range.start += offset;
range.end += offset;
} else if(range.start < beginIndex && range.end >= endIndex) {
range.end += offset;
}
}
} else if(range.end > beginIndex) {
if(range.start > endIndex) {
range.start += offset;
range.end += offset;
} else if(range.start <= beginIndex && range.end > endIndex) {
range.end += offset;
} else if(range.start >= beginIndex && range.end <= endIndex) {
var this1 = this.__textEngine.textFormatRanges;
(openfl_VectorData().default).ofArray((Array.prototype.splice.call)(this1,i--,1));
} else if(range.end > endIndex && range.start > beginIndex && range.start <= endIndex) {
range.start = beginIndex;
range.end += offset;
} else if(range.start < beginIndex && range.end > beginIndex && range.end <= endIndex) {
range.end = beginIndex;
}
}
++i;
}
if(this.__textEngine.textFormatRanges.get_length() == 0) {
(openfl__$Vector_Vector_$Impl_$().default).push(this.__textEngine.textFormatRanges,new (openfl_text__$internal_TextFormatRange().default)(this.get_defaultTextFormat().clone(),0,newText.length));
} else if(beginIndex == endIndex && this.__textEngine.textFormatRanges[0].start > 0) {
(openfl__$Vector_Vector_$Impl_$().default).unshift(this.__textEngine.textFormatRanges,new (openfl_text__$internal_TextFormatRange().default)(this.get_defaultTextFormat().clone(),0,this.__textEngine.textFormatRanges[0].start));
} else if(beginIndex != endIndex && this.__textEngine.textFormatRanges[this.__textEngine.textFormatRanges.get_length() - 1].end < this.__text.length) {
(openfl__$Vector_Vector_$Impl_$().default).push(this.__textEngine.textFormatRanges,new (openfl_text__$internal_TextFormatRange().default)(this.get_defaultTextFormat().clone(),this.__textEngine.textFormatRanges[this.__textEngine.textFormatRanges.get_length() - 1].end,this.__text.length));
}
this.__selectionIndex = this.__caretIndex = beginIndex + newText.length;
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
},
__startCursorTimer: function() {
if(this.get_type() == "input") {
if(this.__inputEnabled) {
this.__cursorTimer = (haxe_Timer().default).delay($bind(this,this.__startCursorTimer),600);
this.__showCursor = !this.__showCursor;
}
this.__dirty = true;
this.__setRenderDirty();
} else if(this.get_selectable()) {
this.__dirty = true;
this.__setRenderDirty();
}
},
__startTextInput: function() {
if(this.__caretIndex < 0) {
this.__caretIndex = this.__text.length;
this.__selectionIndex = this.__caretIndex;
}
var enableInput = (openfl_display_DisplayObject().default).__supportDOM ? this.__renderedOnCanvasWhileOnDOM : true;
if(enableInput) {
this.__enableInput();
}
},
__stopCursorTimer: function() {
if(this.__cursorTimer != null) {
this.__cursorTimer.stop();
this.__cursorTimer = null;
}
if(this.__showCursor) {
this.__showCursor = false;
this.__dirty = true;
this.__setRenderDirty();
}
},
__stopTextInput: function() {
var disableInput = (openfl_display_DisplayObject().default).__supportDOM ? this.__renderedOnCanvasWhileOnDOM : true;
if(disableInput) {
this.__disableInput();
}
},
__updateLayout: function() {
if(this.__layoutDirty) {
var cacheWidth = this.__textEngine.width;
this.__textEngine.update();
if(this.__textEngine.autoSize != "none") {
if(this.__textEngine.width != cacheWidth) {
switch(this.__textEngine.autoSize) {
case "center":
var _g = this;
_g.set_x(_g.get_x() + (cacheWidth - this.__textEngine.width) / 2);
break;
case "right":
var _g1 = this;
_g1.set_x(_g1.get_x() + (cacheWidth - this.__textEngine.width));
break;
default:
}
}
this.__textEngine.getBounds();
}
this.__layoutDirty = false;
this.setSelection(this.__selectionIndex,this.__caretIndex);
}
},
__updateMouseDrag: function() {
if(this.stage == null) {
return;
}
var bounds = this.getBounds(this);
if(this.get_mouseX() > bounds.width - 1) {
var _g = this;
_g.set_scrollH(_g.get_scrollH() + (Std().default).int(Math.max(Math.min((this.get_mouseX() - bounds.width) * .1,10),1)));
} else if(this.get_mouseX() < 1) {
var _g1 = this;
_g1.set_scrollH(_g1.get_scrollH() - (Std().default).int(Math.max(Math.min(this.get_mouseX() * -.1,10),1)));
}
this.__mouseScrollVCounter++;
if(this.__mouseScrollVCounter > this.stage.get_frameRate() / 10) {
if(this.get_mouseY() > bounds.height - 2) {
this.set_scrollV((Std().default).int(Math.min(this.get_scrollV() + Math.max(Math.min((this.get_mouseY() - bounds.height) * .03,5),1),this.get_maxScrollV())));
} else if(this.get_mouseY() < 2) {
var _g2 = this;
_g2.set_scrollV(_g2.get_scrollV() - (Std().default).int(Math.max(Math.min(this.get_mouseY() * -.03,5),1)));
}
this.__mouseScrollVCounter = 0;
}
this.stage_onMouseMove(null);
},
__updateScrollH: function() {
this.__updateLayout();
var bounds = this.getBounds(this);
if(this.get_textWidth() <= bounds.width - 4) {
this.set_scrollH(0);
return;
}
var tempScrollH = this.get_scrollH();
if(this.__caretIndex == 0 || this.getLineOffset(this.getLineIndexOfChar(this.__caretIndex)) == this.__caretIndex) {
tempScrollH = 0;
} else {
var caret = (openfl_geom_Rectangle().default).__pool.get();
var written = false;
if(this.__caretIndex < this.__text.length) {
written = this.__getCharBoundaries(this.__caretIndex,caret);
}
if(!written) {
this.__getCharBoundaries(this.__caretIndex - 1,caret);
caret.x += caret.width;
}
while(caret.x < tempScrollH && tempScrollH > 0) tempScrollH -= 24;
while(caret.x > tempScrollH + bounds.width - 4) tempScrollH += 24;
(openfl_geom_Rectangle().default).__pool.release(caret);
}
if(tempScrollH > 0 && this.get_type() != "input") {
var lineLength = this.getLineLength(this.getLineIndexOfChar(this.__caretIndex));
if(this.get_scrollH() + bounds.width - 4 > lineLength) {
this.set_scrollH(Math.ceil(lineLength - bounds.width + 4));
}
}
if(tempScrollH < 0) {
this.set_scrollH(0);
} else if(tempScrollH > this.get_maxScrollH()) {
this.set_scrollH(this.get_maxScrollH());
} else {
this.set_scrollH(tempScrollH);
}
},
__updateScrollV: function() {
this.__updateLayout();
if(this.get_textHeight() <= this.get_height() - 4) {
this.set_scrollV(1);
return;
}
var lineIndex = this.getLineIndexOfChar(this.__caretIndex);
if(lineIndex == -1 && this.__caretIndex > 0) {
lineIndex = this.getLineIndexOfChar(this.__caretIndex - 1) + 1;
}
if(lineIndex + 1 < this.get_scrollV()) {
this.set_scrollV(lineIndex + 1);
} else if(lineIndex + 1 > this.get_bottomScrollV()) {
var i = lineIndex;
var tempHeight = 0.0;
if(i >= this.__textEngine.lineHeights.get_length()) {
i = this.__textEngine.lineHeights.get_length() - 1;
}
while(i >= 0) {
tempHeight += this.__textEngine.lineHeights[i];
if(tempHeight > this.get_height() - 4) {
i += tempHeight - this.get_height() < 0 ? 1 : 2;
break;
}
--i;
}
this.set_scrollV(i);
} else {
this.set_scrollV(this.get_scrollV());
}
},
__updateText: function(value) {
if((openfl_display_DisplayObject().default).__supportDOM && this.__renderedOnCanvasWhileOnDOM) {
this.__forceCachedBitmapUpdate = this.__text != value;
}
this.__textEngine.set_text(value);
this.__text = this.__textEngine.text;
if(this.stage != null && this.stage.get_focus() == this) {
if(this.__text.length < this.__selectionIndex) {
this.__selectionIndex = this.__text.length;
}
if(this.__text.length < this.__caretIndex) {
this.__caretIndex = this.__text.length;
}
} else if(this.__isHTML) {
this.__selectionIndex = this.__caretIndex = this.__text.length;
} else {
this.__selectionIndex = 0;
this.__caretIndex = 0;
}
if(!this.__displayAsPassword || (openfl_display_DisplayObject().default).__supportDOM && !this.__renderedOnCanvasWhileOnDOM) {
this.__textEngine.set_text(this.__text);
} else {
var length = this.get_text().length;
var mask = "";
var _g = 0;
var _g1 = length;
while(_g < _g1) {
var i = _g++;
mask += "*";
}
this.__textEngine.set_text(mask);
}
},
__updateTransforms: function(overrideTransform) {
(openfl_display_InteractiveObject().default).prototype.__updateTransforms.call(this,overrideTransform);
this.__renderTransform.__translateTransformed(this.__offsetX,this.__offsetY);
},
get_antiAliasType: function() {
return this.__textEngine.antiAliasType;
},
set_antiAliasType: function(value) {
var tmp = value != this.__textEngine.antiAliasType;
return this.__textEngine.antiAliasType = value;
},
get_autoSize: function() {
return this.__textEngine.autoSize;
},
set_autoSize: function(value) {
if(value != this.__textEngine.autoSize) {
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
}
return this.__textEngine.autoSize = value;
},
get_background: function() {
return this.__textEngine.background;
},
set_background: function(value) {
if(value != this.__textEngine.background) {
this.__dirty = true;
this.__setRenderDirty();
}
return this.__textEngine.background = value;
},
get_backgroundColor: function() {
return this.__textEngine.backgroundColor;
},
set_backgroundColor: function(value) {
if(value != this.__textEngine.backgroundColor) {
this.__dirty = true;
this.__setRenderDirty();
}
return this.__textEngine.backgroundColor = value;
},
get_border: function() {
return this.__textEngine.border;
},
set_border: function(value) {
if(value != this.__textEngine.border) {
this.__dirty = true;
this.__setRenderDirty();
}
return this.__textEngine.border = value;
},
get_borderColor: function() {
return this.__textEngine.borderColor;
},
set_borderColor: function(value) {
if(value != this.__textEngine.borderColor) {
this.__dirty = true;
this.__setRenderDirty();
}
return this.__textEngine.borderColor = value;
},
get_bottomScrollV: function() {
this.__updateLayout();
return this.__textEngine.get_bottomScrollV();
},
get_caretIndex: function() {
return this.__caretIndex;
},
get_defaultTextFormat: function() {
return this.__textFormat.clone();
},
set_defaultTextFormat: function(value) {
this.__textFormat.__merge(value);
this.__layoutDirty = true;
this.__dirty = true;
this.__setRenderDirty();
return value;
},
get_displayAsPassword: function() {
return this.__displayAsPassword;
},
set_displayAsPassword: function(value) {
if(value != this.__displayAsPassword) {
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
this.__displayAsPassword = value;
this.__updateText(this.__text);
}
return value;
},
get_embedFonts: function() {
return this.__textEngine.embedFonts;
},
set_embedFonts: function(value) {
return this.__textEngine.embedFonts = value;
},
get_gridFitType: function() {
return this.__textEngine.gridFitType;
},
set_gridFitType: function(value) {
return this.__textEngine.gridFitType = value;
},
get_height: function() {
this.__updateLayout();
return this.__textEngine.height * Math.abs(this.get_scaleY());
},
set_height: function(value) {
if(value != this.__textEngine.height) {
this.__setTransformDirty();
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
this.__textEngine.height = value;
}
return this.__textEngine.height * Math.abs(this.get_scaleY());
},
get_htmlText: function() {
if(this.__isHTML) {
return this.__htmlText;
} else {
return this.__text;
}
},
set_htmlText: function(value) {
if(value == null) {
var error = new (openfl_errors_TypeError().default)("Error #2007: Parameter text must be non-null.");
error.errorID = 2007;
throw new (js__$Boot_HaxeError().default)(error);
}
if(!this.__isHTML || this.__text != value) {
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
}
this.__isHTML = true;
if(this.condenseWhite) {
value = new (EReg().default)("\\s+","g").replace(value," ");
}
this.__htmlText = value;
value = (openfl_text__$internal_HTMLParser().default).parse(value,this.get_multiline(),this.__styleSheet,this.__textFormat,this.__textEngine.textFormatRanges);
this.__updateText(value);
return value;
},
get_length: function() {
if(this.__text != null) {
return this.__text.length;
}
return 0;
},
get_maxChars: function() {
return this.__textEngine.maxChars;
},
set_maxChars: function(value) {
if(value != this.__textEngine.maxChars) {
this.__textEngine.maxChars = value;
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
}
return value;
},
get_maxScrollH: function() {
this.__updateLayout();
return this.__textEngine.maxScrollH;
},
get_maxScrollV: function() {
this.__updateLayout();
return this.__textEngine.get_maxScrollV();
},
get_mouseWheelEnabled: function() {
return this.__mouseWheelEnabled;
},
set_mouseWheelEnabled: function(value) {
return this.__mouseWheelEnabled = value;
},
get_multiline: function() {
return this.__textEngine.multiline;
},
set_multiline: function(value) {
return this.__textEngine.multiline = value;
},
get_numLines: function() {
this.__updateLayout();
return this.__textEngine.numLines;
},
get_restrict: function() {
return this.__textEngine.restrict;
},
set_restrict: function(value) {
if(this.__textEngine.restrict != value) {
this.__textEngine.set_restrict(value);
this.__updateText(this.__text);
}
return value;
},
get_scrollH: function() {
return this.__textEngine.scrollH;
},
set_scrollH: function(value) {
this.__updateLayout();
if(value > this.__textEngine.maxScrollH) {
value = this.__textEngine.maxScrollH;
}
if(value < 0) {
value = 0;
}
if(value != this.__textEngine.scrollH) {
this.__dirty = true;
this.__setRenderDirty();
this.__textEngine.scrollH = value;
this.dispatchEvent(new (openfl_events_Event().default)("scroll"));
}
return this.__textEngine.scrollH;
},
get_scrollV: function() {
return this.__textEngine.get_scrollV();
},
set_scrollV: function(value) {
this.__updateLayout();
if(value > this.__textEngine.get_maxScrollV()) {
value = this.__textEngine.get_maxScrollV();
}
if(value < 1) {
value = 1;
}
if(value != this.__textEngine.get_scrollV() || this.__textEngine.get_scrollV() == 0) {
this.__dirty = true;
this.__setRenderDirty();
this.__textEngine.set_scrollV(value);
this.dispatchEvent(new (openfl_events_Event().default)("scroll"));
}
return this.__textEngine.get_scrollV();
},
get_selectable: function() {
return this.__textEngine.selectable;
},
set_selectable: function(value) {
if(value != this.__textEngine.selectable && this.get_type() == "input") {
if(this.stage != null && this.stage.get_focus() == this) {
this.__startTextInput();
} else if(!value) {
this.__stopTextInput();
}
}
return this.__textEngine.selectable = value;
},
get_selectionBeginIndex: function() {
return (Std().default).int(Math.min(this.__caretIndex,this.__selectionIndex));
},
get_selectionEndIndex: function() {
return (Std().default).int(Math.max(this.__caretIndex,this.__selectionIndex));
},
get_sharpness: function() {
return this.__textEngine.sharpness;
},
set_sharpness: function(value) {
if(value != this.__textEngine.sharpness) {
this.__dirty = true;
this.__setRenderDirty();
}
return this.__textEngine.sharpness = value;
},
get_styleSheet: function() {
return this.__styleSheet;
},
set_styleSheet: function(value) {
if(!(this.__styleSheet != null && value == null)) {
if(value != null) {
if(this.__isHTML && value != this.__styleSheet) {
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
this.set_htmlText(this.__htmlText);
}
this.set_type("dynamic");
}
}
return this.__styleSheet = value;
},
get_tabEnabled: function() {
if(this.__tabEnabled == null) {
return this.__textEngine.type == "input";
} else {
return this.__tabEnabled;
}
},
get_text: function() {
return this.__text;
},
set_text: function(value) {
if(value == null) {
var error = new (openfl_errors_TypeError().default)("Error #2007: Parameter text must be non-null.");
error.errorID = 2007;
throw new (js__$Boot_HaxeError().default)(error);
}
if(this.__styleSheet != null) {
return this.set_htmlText(value);
}
if(this.__isHTML || this.__text != value) {
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
} else {
return value;
}
if(this.__textEngine.textFormatRanges.get_length() > 1) {
var this1 = this.__textEngine.textFormatRanges;
var len = this.__textEngine.textFormatRanges.get_length() - 1;
(openfl_VectorData().default).ofArray((Array.prototype.splice.call)(this1,1,len));
}
var utfValue = value;
var range = this.__textEngine.textFormatRanges[0];
range.format = this.__textFormat;
range.start = 0;
range.end = utfValue.length;
this.__isHTML = false;
this.__updateText(value);
return value;
},
get_textColor: function() {
return this.__textFormat.color;
},
set_textColor: function(value) {
if(value != this.__textFormat.color) {
this.__dirty = true;
this.__setRenderDirty();
}
var range = new (openfl__$Vector_VectorIterator().default)(this.__textEngine.textFormatRanges);
while(range.hasNext()) {
var range1 = range.next();
range1.format.color = value;
}
return this.__textFormat.color = value;
},
get_textWidth: function() {
this.__updateLayout();
return this.__textEngine.textWidth;
},
get_textHeight: function() {
this.__updateLayout();
return this.__textEngine.textHeight;
},
get_type: function() {
return this.__textEngine.type;
},
set_type: function(value) {
if(this.__styleSheet != null) {
value = "dynamic";
}
if(value != this.__textEngine.type) {
this.__textEngine.type = value;
if(value == "input") {
this.addEventListener("addedToStage",$bind(this,this.this_onAddedToStage));
this.this_onFocusIn(null);
this.__textEngine.__useIntAdvances = true;
} else {
this.removeEventListener("addedToStage",$bind(this,this.this_onAddedToStage));
this.__stopTextInput();
this.__textEngine.__useIntAdvances = null;
}
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
}
return this.__textEngine.type;
},
get_width: function() {
this.__updateLayout();
return this.__textEngine.width * Math.abs(this.__scaleX);
},
set_width: function(value) {
if(value != this.__textEngine.width) {
this.__setTransformDirty();
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
this.__textEngine.width = value;
}
return this.__textEngine.width * Math.abs(this.__scaleX);
},
get_wordWrap: function() {
return this.__textEngine.wordWrap;
},
set_wordWrap: function(value) {
if(value != this.__textEngine.wordWrap) {
this.__dirty = true;
this.__layoutDirty = true;
this.__setRenderDirty();
}
return this.__textEngine.wordWrap = value;
},
get_x: function() {
return this.__transform.tx + this.__offsetX;
},
set_x: function(value) {
if(value != this.__transform.tx + this.__offsetX) {
this.__setTransformDirty();
}
this.__transform.tx = value - this.__offsetX;
return value;
},
get_y