@awayjs/scene 0.13.247 → 0.13.248

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  import { __extends } from "tslib";
2
- import { ColorUtils, Matrix, Rectangle, Point, Vector3D, AssetEvent } from '@awayjs/core';
2
+ import { ColorUtils, Matrix, Rectangle, Point, Vector3D } from '@awayjs/core';
3
3
  import { ImageSampler, Float2Attributes } from '@awayjs/stage';
4
- import { PartitionBase, EntityNode } from '@awayjs/view';
5
4
  import { Style, TriangleElements } from '@awayjs/renderer';
6
5
  import { Graphics, Shape, GraphicsFactoryHelper, MaterialManager } from '@awayjs/graphics';
7
6
  import { TextFieldAutoSize } from '../text/TextFieldAutoSize';
@@ -230,7 +229,6 @@ var TextField = /** @class */ (function (_super) {
230
229
  _this.startSelectionByMouseDelegate = function (event) { return _this.startSelectionByMouse(event); };
231
230
  _this.stopSelectionByMouseDelegate = function (event) { return _this.stopSelectionByMouse(event); };
232
231
  _this.updateSelectionByMouseDelegate = function (event) { return _this.updateSelectionByMouse(event); };
233
- _this._onGraphicsInvalidateDelegate = function (event) { return _this._onGraphicsInvalidate(event); };
234
232
  _this._onClipboardPasteDelegate = function (event) { return _this.onClipboardPaste(event); };
235
233
  _this.cursorIntervalID = -1;
236
234
  _this._tabEnabled = true;
@@ -261,7 +259,6 @@ var TextField = /** @class */ (function (_super) {
261
259
  _this._scrollV = 0;
262
260
  _this._textFormats = [];
263
261
  _this._graphics = Graphics.getGraphics(); //unique graphics object for each TextField
264
- _this._graphics.addEventListener(AssetEvent.INVALIDATE, _this._onGraphicsInvalidateDelegate);
265
262
  _this.mouseEnabled = _this._selectable;
266
263
  return _this;
267
264
  }
@@ -353,7 +350,7 @@ var TextField = /** @class */ (function (_super) {
353
350
  // }
354
351
  this.setSelection(0, 0);
355
352
  this._glyphsDirty = true;
356
- this._updateEntity();
353
+ this.invalidate();
357
354
  };
358
355
  TextField.prototype.enableInput = function (enable) {
359
356
  if (enable === void 0) { enable = true; }
@@ -719,14 +716,6 @@ var TextField = /** @class */ (function (_super) {
719
716
  // this._internalScale=scale;
720
717
  // this._glyphsDirty=true;
721
718
  };
722
- /**
723
- * //TODO
724
- *
725
- * @private
726
- */
727
- TextField.prototype._onGraphicsInvalidate = function (event) {
728
- this.invalidate();
729
- };
730
719
  Object.defineProperty(TextField.prototype, "assetType", {
731
720
  /**
732
721
  *
@@ -864,11 +853,8 @@ var TextField = /** @class */ (function (_super) {
864
853
  this._iTextWoLineBreaks = processedText.replace(/(\r\n|\n|\\n|\r)/gm, '');
865
854
  this._textDirty = true;
866
855
  //console.log("set text", value, "on" , this);
867
- if (this._autoSize != TextFieldAutoSize.NONE)
868
- this.invalidate();
869
- else
870
- this._updateEntity();
871
856
  this.newTextFormat = this._textFormats[this._textFormats.length - 1];
857
+ this.invalidate();
872
858
  },
873
859
  enumerable: true,
874
860
  configurable: true
@@ -1098,10 +1084,7 @@ var TextField = /** @class */ (function (_super) {
1098
1084
  this._textFormatsIdx = [this._iText.length];
1099
1085
  this._textDirty = true;
1100
1086
  //console.log("set text", value, "on" , this);
1101
- if (this._autoSize != TextFieldAutoSize.NONE)
1102
- this.invalidate();
1103
- else
1104
- this._updateEntity();
1087
+ this.invalidate();
1105
1088
  },
1106
1089
  enumerable: true,
1107
1090
  configurable: true
@@ -1114,10 +1097,7 @@ var TextField = /** @class */ (function (_super) {
1114
1097
  this._textDirty = false;
1115
1098
  this._positionsDirty = false;
1116
1099
  this._glyphsDirty = true;
1117
- if (this._autoSize != TextFieldAutoSize.NONE)
1118
- this.invalidate();
1119
- else
1120
- this._updateEntity();
1100
+ this.invalidate();
1121
1101
  };
1122
1102
  Object.defineProperty(TextField.prototype, "newTextFormat", {
1123
1103
  get: function () {
@@ -1155,34 +1135,11 @@ var TextField = /** @class */ (function (_super) {
1155
1135
  // this._shapesDirty = true;
1156
1136
  this._textDirty = true;
1157
1137
  //this.reConstruct();
1158
- if (this._autoSize != TextFieldAutoSize.NONE)
1159
- this.invalidate();
1160
- else
1161
- this._updateEntity();
1138
+ this.invalidate();
1162
1139
  },
1163
1140
  enumerable: true,
1164
1141
  configurable: true
1165
1142
  });
1166
- /**
1167
- *
1168
- * @param renderer
1169
- *
1170
- * @internal
1171
- */
1172
- TextField.prototype._acceptTraverser = function (traverser) {
1173
- if (!this.maskMode) {
1174
- //if(!this.cursorBlinking && this._isInFocus && this.cursorShape && this._type==TextFieldType.INPUT){
1175
- // traverser[this.cursorShape.elements.traverseName](this.cursorShape);
1176
- //}
1177
- this._graphics._acceptTraverser(traverser);
1178
- //if(this.showSelection && this._isInFocus && this.bgShapeSelect){
1179
- // traverser[this.bgShapeSelect.elements.traverseName](this.bgShapeSelect);
1180
- //}
1181
- //if(this.bgShape){// && this.background){
1182
- // traverser[this.bgShape.elements.traverseName](this.bgShape);
1183
- //}
1184
- }
1185
- };
1186
1143
  Object.defineProperty(TextField.prototype, "scaleX", {
1187
1144
  /**
1188
1145
  * Indicates the horizontal scale(percentage) of the object as applied from
@@ -1260,7 +1217,7 @@ var TextField = /** @class */ (function (_super) {
1260
1217
  this._implicitPartition.invalidateEntity(this);
1261
1218
  //}*/
1262
1219
  this._glyphsDirty = true;
1263
- this._updateEntity();
1220
+ this.invalidate();
1264
1221
  },
1265
1222
  enumerable: true,
1266
1223
  configurable: true
@@ -1317,12 +1274,10 @@ var TextField = /** @class */ (function (_super) {
1317
1274
  return this._type;
1318
1275
  },
1319
1276
  set: function (value) {
1320
- if (this._type == value) {
1277
+ if (this._type == value)
1321
1278
  return;
1322
- }
1323
1279
  this._type = value;
1324
1280
  this._textDirty = true;
1325
- this._updateEntity();
1326
1281
  if (value == TextFieldType.INPUT) {
1327
1282
  //this._selectable=true;
1328
1283
  this.enableInput(true);
@@ -1332,6 +1287,7 @@ var TextField = /** @class */ (function (_super) {
1332
1287
  this.enableInput(false);
1333
1288
  this.removeEventListener(KeyboardEvent.KEYDOWN, this.onKeyDelegate);
1334
1289
  }
1290
+ this.invalidate();
1335
1291
  },
1336
1292
  enumerable: true,
1337
1293
  configurable: true
@@ -1398,7 +1354,7 @@ var TextField = /** @class */ (function (_super) {
1398
1354
  //override for textfield
1399
1355
  };
1400
1356
  TextField.prototype.getEntity = function () {
1401
- return this;
1357
+ return this._graphics;
1402
1358
  };
1403
1359
  TextField.prototype.clear = function () {
1404
1360
  _super.prototype.clear.call(this);
@@ -2013,7 +1969,6 @@ var TextField = /** @class */ (function (_super) {
2013
1969
  }
2014
1970
  }
2015
1971
  }
2016
- this.updateMaskMode();
2017
1972
  };
2018
1973
  TextField.prototype.buildGlyphsForLabelData = function () {
2019
1974
  this._clearTextShapes();
@@ -2289,10 +2244,7 @@ var TextField = /** @class */ (function (_super) {
2289
2244
  }
2290
2245
  this._iText += newText;
2291
2246
  this._textDirty = true;
2292
- if (this._autoSize != TextFieldAutoSize.NONE)
2293
- this.invalidate();
2294
- else
2295
- this._updateEntity();
2247
+ this.invalidate();
2296
2248
  };
2297
2249
  /**
2298
2250
  * *tells the Textfield that a paragraph is defined completly.
@@ -2301,10 +2253,7 @@ var TextField = /** @class */ (function (_super) {
2301
2253
  TextField.prototype.closeParagraph = function () {
2302
2254
  this._iText += '\n';
2303
2255
  this._textDirty = true;
2304
- if (this._autoSize != TextFieldAutoSize.NONE)
2305
- this.invalidate();
2306
- else
2307
- this._updateEntity();
2256
+ this.invalidate();
2308
2257
  };
2309
2258
  /**
2310
2259
  * Returns a rectangle that is the bounding box of the character.
@@ -3146,4 +3095,3 @@ var TextField = /** @class */ (function (_super) {
3146
3095
  return TextField;
3147
3096
  }(DisplayObjectContainer));
3148
3097
  export { TextField };
3149
- PartitionBase.registerAbstraction(EntityNode, TextField);
@@ -1,12 +1,11 @@
1
1
  import { Sprite } from './Sprite';
2
2
  import { TextField } from './TextField';
3
- import { IEntityTraverser } from '@awayjs/view';
4
3
  /**
5
4
  * TextSprite is used for masked text.
6
5
  * It is a child of the textfield that is used to render all visible (masked) graphics
7
6
  */
8
7
  export declare class TextSprite extends Sprite {
9
8
  parentTextField: TextField;
10
- _acceptTraverser(traverser: IEntityTraverser): void;
9
+ _iInternalUpdate(): void;
11
10
  }
12
11
  //# sourceMappingURL=TextSprite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextSprite.d.ts","sourceRoot":"","sources":["../../../lib/display/TextSprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAwB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEtE;;;GAGG;AACH,qBAAa,UAAW,SAAQ,MAAM;IAC9B,eAAe,EAAE,SAAS,CAAC;IAE3B,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI;CAW1D"}
1
+ {"version":3,"file":"TextSprite.d.ts","sourceRoot":"","sources":["../../../lib/display/TextSprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;;GAGG;AACH,qBAAa,UAAW,SAAQ,MAAM;IAC9B,eAAe,EAAE,SAAS,CAAC;IAE3B,gBAAgB,IAAI,IAAI;CAU/B"}
@@ -11,14 +11,14 @@ var TextSprite = /** @class */ (function (_super) {
11
11
  function TextSprite() {
12
12
  return _super !== null && _super.apply(this, arguments) || this;
13
13
  }
14
- TextSprite.prototype._acceptTraverser = function (traverser) {
14
+ TextSprite.prototype._iInternalUpdate = function () {
15
+ _super.prototype._iInternalUpdate.call(this);
15
16
  var tf = this.parentTextField;
16
17
  //tf.reConstruct(true);
17
18
  if (tf._textFormat && !tf._textFormat.font_table.isAsset(TesselatedFontTable) && !tf._textFormat.material) {
18
19
  this.transform.colorTransform.color = (tf.textColor != null) ? tf.textColor : tf._textFormat.color;
19
20
  this._invalidateHierarchicalProperty(HierarchicalProperty.COLOR_TRANSFORM);
20
21
  }
21
- this._graphics._acceptTraverser(traverser);
22
22
  };
23
23
  return TextSprite;
24
24
  }(Sprite));
@@ -1 +1 @@
1
- {"version":3,"file":"MouseEvent.d.ts","sourceRoot":"","sources":["../../../lib/events/MouseEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAc,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEzG,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C;;;GAGG;AACH,qBAAa,UAAW,SAAQ,SAAS;IAEjC,aAAa,EAAE,UAAU,CAAC;IAC1B,cAAc,EAAE,KAAK,CAAC;IAE7B;;OAEG;IACH,OAAc,UAAU,EAAE,MAAM,CAAiB;IAEjD;;OAEG;IACH,OAAc,SAAS,EAAE,MAAM,CAAgB;IAE/C;;OAEG;IACH,OAAc,SAAS,EAAE,MAAM,CAAgB;IAE/C;;OAEG;IACH,OAAc,QAAQ,EAAE,MAAM,CAAe;IAC7C;;OAEG;IACH,OAAc,QAAQ,EAAE,MAAM,CAAe;IAC7C;;OAEG;IACH,OAAc,gBAAgB,EAAE,MAAM,CAAsB;IAE5D;;OAEG;IACH,OAAc,UAAU,EAAE,MAAM,CAAiB;IAEjD;;OAEG;IACH,OAAc,UAAU,EAAE,MAAM,CAAiB;IAEjD;;OAEG;IACH,OAAc,SAAS,EAAE,MAAM,CAAgB;IAC/C;;OAEG;IACH,OAAc,QAAQ,EAAE,MAAM,CAAe;IAC7C;;OAEG;IACH,OAAc,SAAS,EAAE,MAAM,CAAgB;IAC/C;;OAEG;IACH,OAAc,UAAU,EAAE,MAAM,CAAiB;IACjD;;OAEG;IACH,OAAc,SAAS,EAAE,MAAM,CAAgB;IAC/C;;OAEG;IACH,OAAc,QAAQ,EAAE,MAAM,CAAe;IAC7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AAI,QAAQ,CAKjC;IAEM,cAAc,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB;CAM5E"}
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- console.debug('AwayJS - Scene - 0.13.247');
1
+ console.debug('AwayJS - Scene - 0.13.248');
2
2
 
3
3
  export { IDisplayObjectAdapter } from './lib/adapters/IDisplayObjectAdapter';
4
4
  export { IMovieClipAdapter } from './lib/adapters/IMovieClipAdapter';
@@ -16,12 +16,10 @@ import {
16
16
  BoundingBox,
17
17
  BoundingSphere,
18
18
  BoundingVolumeType,
19
- IEntityTraverser,
20
19
  IPartitionEntity,
21
20
  BoundsPicker,
22
21
  HeirarchicalEvent,
23
22
  HierarchicalProperty,
24
- ContainerEvent,
25
23
  AlignmentMode,
26
24
  OrientationMode,
27
25
  BasicPartition,
@@ -40,7 +38,6 @@ import {
40
38
  import { DisplayObjectContainer } from './DisplayObjectContainer';
41
39
  import { ControllerBase } from '../controllers/ControllerBase';
42
40
  import { IBitmapDrawable } from '../base/IBitmapDrawable';
43
- import { FocusEvent } from '../events/FocusEvent';
44
41
 
45
42
  import { PrimitiveCubePrefab } from '../prefabs/PrimitiveCubePrefab';
46
43
  import { PrimitiveSpherePrefab } from '../prefabs/PrimitiveSpherePrefab';
@@ -1766,10 +1763,6 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
1766
1763
  this.dispatchEvent(new HeirarchicalEvent(HeirarchicalEvent.INVALIDATE_PROPERTY, propDirty));
1767
1764
  }
1768
1765
 
1769
- public _updateEntity(): void {
1770
- this.dispatchEvent(new ContainerEvent(ContainerEvent.UPDATE_ENTITY, this));
1771
- }
1772
-
1773
1766
  /**
1774
1767
  *
1775
1768
  */
@@ -1785,8 +1778,6 @@ export class DisplayObject extends AssetBase implements IBitmapDrawable, IPartit
1785
1778
  return this._maskId;
1786
1779
  }
1787
1780
 
1788
- public _acceptTraverser(_traverser: IEntityTraverser): void {}
1789
-
1790
1781
  protected _setScaleX(val: number): void {
1791
1782
  if (this.scaleX == val)
1792
1783
  return;
@@ -44,25 +44,6 @@ export class MorphSprite extends Sprite {
44
44
  private _ratio: ui16;
45
45
  private _frameCaches: NumberMap<GraphicsPath[]> = {};
46
46
 
47
- protected _setGraphics(value: Graphics): void {
48
- if (this._graphics == value) {
49
- return;
50
- }
51
-
52
- if (this._graphics) {
53
- this._graphics.removeEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
54
- this._graphics.usages--;
55
-
56
- //if (!this._graphics.usages)
57
- // this.graphics.dispose();
58
- }
59
-
60
- if (!this._graphics)
61
- this._graphics = Graphics.getGraphics();
62
-
63
- this._graphics.copyFrom(value);
64
- }
65
-
66
47
  public get assetType(): string {
67
48
  return MorphSprite.assetType;
68
49
  }
@@ -366,6 +347,4 @@ export class MorphSprite extends Sprite {
366
347
 
367
348
  return newInstance;
368
349
  }
369
- }
370
-
371
- PartitionBase.registerAbstraction(EntityNode, MorphSprite);
350
+ }
@@ -43,7 +43,6 @@ export class MovieClip extends Sprite {
43
43
  if (MovieClip._movieClips.length) {
44
44
  const movieClip: MovieClip = MovieClip._movieClips.pop();
45
45
  movieClip.timeline = timeline;
46
- movieClip.graphics = Graphics.getGraphics();
47
46
  return movieClip;
48
47
  }
49
48
 
@@ -580,7 +579,8 @@ export class MovieClip extends Sprite {
580
579
  for (let i: number = this.numChildren - 1; i >= 0; i--)
581
580
  this.removeChildAt(i);
582
581
 
583
- this.graphics.clear();
582
+ if (this._graphics)
583
+ this._graphics.clear();
584
584
 
585
585
  if (fireScripts) {
586
586
  const numFrames: number = this._timeline.keyframe_indices.length;
@@ -21,7 +21,7 @@ export class Sprite extends DisplayObjectContainer {
21
21
  public static getNewSprite(graphics: Graphics = null, material: IMaterial = null): Sprite {
22
22
  if (Sprite._sprites.length) {
23
23
  const sprite: Sprite = Sprite._sprites.pop();
24
- sprite.graphics = graphics || Graphics.getGraphics();
24
+ sprite.graphics = graphics;
25
25
  sprite.material = material;
26
26
  return sprite;
27
27
  }
@@ -35,7 +35,6 @@ export class Sprite extends DisplayObjectContainer {
35
35
 
36
36
  private _center: Vector3D;
37
37
  public _graphics: Graphics;
38
- protected _onGraphicsInvalidateDelegate: (event: AssetEvent) => void;
39
38
 
40
39
  /**
41
40
  *
@@ -49,24 +48,20 @@ export class Sprite extends DisplayObjectContainer {
49
48
  * drawing commands can occur.
50
49
  */
51
50
  public get graphics(): Graphics {
52
- if (this._iSourcePrefab)
53
- this._iSourcePrefab._iValidate();
51
+ //create new graphics object if none exists
52
+ if (!this._graphics) {
53
+ this.graphics = Graphics.getGraphics();
54
+ this.invalidate();
55
+ }
56
+
54
57
  return this._graphics;
55
58
  }
56
59
 
57
60
  public set graphics(value: Graphics) {
58
- if (value == null)
59
- throw new Error('Cannot have graphics set to null');
60
-
61
- this._setGraphics(value);
62
- }
63
-
64
- protected _setGraphics(value: Graphics): void {
65
61
  if (this._graphics == value)
66
62
  return;
67
63
 
68
64
  if (this._graphics) {
69
- this._graphics.removeEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
70
65
  this._graphics.usages--;
71
66
 
72
67
  //if (!this._graphics.usages)
@@ -75,7 +70,8 @@ export class Sprite extends DisplayObjectContainer {
75
70
 
76
71
  this._graphics = value;
77
72
 
78
- this._graphics.usages++;
73
+ if (this._graphics)
74
+ this._graphics.usages++;
79
75
 
80
76
  this.invalidate();
81
77
  }
@@ -88,33 +84,15 @@ export class Sprite extends DisplayObjectContainer {
88
84
  constructor(graphics: Graphics = null, material: IMaterial = null) {
89
85
  super();
90
86
 
91
- this._onGraphicsInvalidateDelegate = (event: AssetEvent) => this._onGraphicsInvalidate(event);
92
-
93
- this.graphics = graphics || Graphics.getGraphics();
87
+ this.graphics = graphics;
94
88
  this.material = material;
95
89
 
96
90
  // this.dropBitmapCache = this.dropBitmapCache.bind(this);
97
91
  // this.generateBitmapCache = this.generateBitmapCache.bind(this);
98
92
  }
99
93
 
100
- public _setParent(parent: DisplayObjectContainer): void {
101
- super._setParent(parent);
102
-
103
- if (parent)
104
- this._graphics.addEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
105
- else
106
- this._graphics.removeEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
107
-
108
- // if (this._requestCacheAsBitmap) {
109
-
110
- // this.set_cacheAsBitmapInternal(true);
111
-
112
- // console.log('Restore cache');
113
- // }
114
- }
115
-
116
94
  public getEntity(): IPartitionEntity {
117
- return (this._graphics.count > 0) ? this : null;
95
+ return this._graphics;
118
96
  }
119
97
 
120
98
  /**
@@ -162,7 +140,8 @@ export class Sprite extends DisplayObjectContainer {
162
140
 
163
141
  sprite._iSourcePrefab = this._iSourcePrefab;
164
142
 
165
- this._graphics.copyTo(sprite._graphics, cloneShapes);
143
+ if (this._graphics)
144
+ this._graphics.copyTo(sprite.graphics, cloneShapes);
166
145
  }
167
146
 
168
147
  /**
@@ -171,28 +150,8 @@ export class Sprite extends DisplayObjectContainer {
171
150
  public _iInternalUpdate(): void {
172
151
  super._iInternalUpdate();
173
152
 
174
- // if(this.parent)
175
- // this._graphics.updateScale(view);
176
- }
177
-
178
- /**
179
- * //TODO
180
- *
181
- * @private
182
- */
183
- protected _onGraphicsInvalidate(_event: AssetEvent): void {
184
- this.invalidate();
185
- }
186
-
187
- /**
188
- *
189
- * @param renderer
190
- *
191
- * @internal
192
- */
193
- public _acceptTraverser(traverser: IEntityTraverser): void {
194
- super._acceptTraverser(traverser);
195
- this.graphics._acceptTraverser(traverser);
153
+ if (this._iSourcePrefab)
154
+ this._iSourcePrefab._iValidate();
196
155
  }
197
156
 
198
157
  /**
@@ -202,6 +161,4 @@ export class Sprite extends DisplayObjectContainer {
202
161
  this._graphics.applyTransformation(this.transform.matrix3D);
203
162
  this.transform.clearMatrix3D();
204
163
  }
205
- }
206
-
207
- PartitionBase.registerAbstraction(EntityNode, Sprite);
164
+ }
@@ -204,7 +204,6 @@ const MNEMOS = [
204
204
  * options
205
205
  */
206
206
  export class TextField extends DisplayObjectContainer {
207
- private _onGraphicsInvalidateDelegate: (event: AssetEvent) => void;
208
207
  private _onClipboardPasteDelegate: (event: ClipboardEvent) => void;
209
208
 
210
209
  private static _textFields: Array<TextField> = [];
@@ -422,7 +421,8 @@ export class TextField extends DisplayObjectContainer {
422
421
  this.setSelection(0, 0);
423
422
 
424
423
  this._glyphsDirty = true;
425
- this._updateEntity();
424
+
425
+ this.invalidate();
426
426
  }
427
427
 
428
428
  private enableInput(enable: boolean = true) {
@@ -911,16 +911,6 @@ export class TextField extends DisplayObjectContainer {
911
911
 
912
912
  }
913
913
 
914
- /**
915
- * //TODO
916
- *
917
- * @private
918
- */
919
- private _onGraphicsInvalidate(event: AssetEvent): void {
920
-
921
- this.invalidate();
922
- }
923
-
924
914
  /**
925
915
  *
926
916
  * @returns {string}
@@ -1191,13 +1181,10 @@ export class TextField extends DisplayObjectContainer {
1191
1181
  this._iTextWoLineBreaks = processedText.replace(/(\r\n|\n|\\n|\r)/gm,'');
1192
1182
  this._textDirty = true;
1193
1183
  //console.log("set text", value, "on" , this);
1194
- if (this._autoSize != TextFieldAutoSize.NONE)
1195
- this.invalidate();
1196
- else
1197
- this._updateEntity();
1198
1184
 
1199
1185
  this.newTextFormat = this._textFormats[this._textFormats.length - 1];
1200
1186
 
1187
+ this.invalidate();
1201
1188
  }
1202
1189
 
1203
1190
  /**
@@ -1585,11 +1572,7 @@ export class TextField extends DisplayObjectContainer {
1585
1572
  this._textDirty = true;
1586
1573
 
1587
1574
  //console.log("set text", value, "on" , this);
1588
- if (this._autoSize != TextFieldAutoSize.NONE)
1589
- this.invalidate();
1590
- else
1591
- this._updateEntity();
1592
-
1575
+ this.invalidate();
1593
1576
  }
1594
1577
 
1595
1578
  public setLabelData(labelData: any) {
@@ -1602,11 +1585,7 @@ export class TextField extends DisplayObjectContainer {
1602
1585
  this._positionsDirty = false;
1603
1586
  this._glyphsDirty = true;
1604
1587
 
1605
- if (this._autoSize != TextFieldAutoSize.NONE)
1606
- this.invalidate();
1607
- else
1608
- this._updateEntity();
1609
-
1588
+ this.invalidate();
1610
1589
  }
1611
1590
 
1612
1591
  public get newTextFormat(): TextFormat {
@@ -1645,31 +1624,7 @@ export class TextField extends DisplayObjectContainer {
1645
1624
  this._textDirty = true;
1646
1625
  //this.reConstruct();
1647
1626
 
1648
- if (this._autoSize != TextFieldAutoSize.NONE)
1649
- this.invalidate();
1650
- else
1651
- this._updateEntity();
1652
- }
1653
-
1654
- /**
1655
- *
1656
- * @param renderer
1657
- *
1658
- * @internal
1659
- */
1660
- public _acceptTraverser(traverser: IEntityTraverser): void {
1661
- if (!this.maskMode) {
1662
- //if(!this.cursorBlinking && this._isInFocus && this.cursorShape && this._type==TextFieldType.INPUT){
1663
- // traverser[this.cursorShape.elements.traverseName](this.cursorShape);
1664
- //}
1665
- this._graphics._acceptTraverser(traverser);
1666
- //if(this.showSelection && this._isInFocus && this.bgShapeSelect){
1667
- // traverser[this.bgShapeSelect.elements.traverseName](this.bgShapeSelect);
1668
- //}
1669
- //if(this.bgShape){// && this.background){
1670
- // traverser[this.bgShape.elements.traverseName](this.bgShape);
1671
- //}
1672
- }
1627
+ this.invalidate();
1673
1628
  }
1674
1629
 
1675
1630
  /**
@@ -1759,7 +1714,7 @@ export class TextField extends DisplayObjectContainer {
1759
1714
 
1760
1715
  this._glyphsDirty = true;
1761
1716
 
1762
- this._updateEntity();
1717
+ this.invalidate();
1763
1718
  }
1764
1719
 
1765
1720
  private getTextColorForTextFormat(format: TextFormat) {
@@ -1834,14 +1789,12 @@ export class TextField extends DisplayObjectContainer {
1834
1789
  }
1835
1790
 
1836
1791
  public set type(value: TextFieldType) {
1837
- if (this._type == value) {
1792
+ if (this._type == value)
1838
1793
  return;
1839
- }
1794
+
1840
1795
  this._type = value;
1841
1796
  this._textDirty = true;
1842
1797
 
1843
- this._updateEntity();
1844
-
1845
1798
  if (value == TextFieldType.INPUT) {
1846
1799
  //this._selectable=true;
1847
1800
  this.enableInput(true);
@@ -1850,6 +1803,8 @@ export class TextField extends DisplayObjectContainer {
1850
1803
  this.enableInput(false);
1851
1804
  this.removeEventListener(KeyboardEvent.KEYDOWN, this.onKeyDelegate);
1852
1805
  }
1806
+
1807
+ this.invalidate();
1853
1808
  }
1854
1809
 
1855
1810
  /**
@@ -1951,7 +1906,6 @@ export class TextField extends DisplayObjectContainer {
1951
1906
  this.stopSelectionByMouseDelegate = (event: any) => this.stopSelectionByMouse(event);
1952
1907
  this.updateSelectionByMouseDelegate = (event: any) => this.updateSelectionByMouse(event);
1953
1908
 
1954
- this._onGraphicsInvalidateDelegate = (event: AssetEvent) => this._onGraphicsInvalidate(event);
1955
1909
  this._onClipboardPasteDelegate = (event: ClipboardEvent) => this.onClipboardPaste(event);
1956
1910
 
1957
1911
  this.cursorIntervalID = -1;
@@ -1985,7 +1939,6 @@ export class TextField extends DisplayObjectContainer {
1985
1939
  this._textFormats = [];
1986
1940
 
1987
1941
  this._graphics = Graphics.getGraphics(); //unique graphics object for each TextField
1988
- this._graphics.addEventListener(AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
1989
1942
 
1990
1943
  this.mouseEnabled = this._selectable;
1991
1944
  }
@@ -1995,7 +1948,7 @@ export class TextField extends DisplayObjectContainer {
1995
1948
  }
1996
1949
 
1997
1950
  public getEntity(): IPartitionEntity {
1998
- return this;
1951
+ return this._graphics;
1999
1952
  }
2000
1953
 
2001
1954
  public clear(): void {
@@ -2745,8 +2698,6 @@ export class TextField extends DisplayObjectContainer {
2745
2698
  }
2746
2699
 
2747
2700
  }
2748
- this.updateMaskMode();
2749
-
2750
2701
  }
2751
2702
 
2752
2703
  public staticMatrix: any;
@@ -3078,10 +3029,8 @@ export class TextField extends DisplayObjectContainer {
3078
3029
 
3079
3030
  this._iText += newText;
3080
3031
  this._textDirty = true;
3081
- if (this._autoSize != TextFieldAutoSize.NONE)
3082
- this.invalidate();
3083
- else
3084
- this._updateEntity();
3032
+
3033
+ this.invalidate();
3085
3034
  }
3086
3035
 
3087
3036
  /**
@@ -3091,10 +3040,8 @@ export class TextField extends DisplayObjectContainer {
3091
3040
  public closeParagraph(): void {
3092
3041
  this._iText += '\n';
3093
3042
  this._textDirty = true;
3094
- if (this._autoSize != TextFieldAutoSize.NONE)
3095
- this.invalidate();
3096
- else
3097
- this._updateEntity();
3043
+
3044
+ this.invalidate();
3098
3045
  }
3099
3046
 
3100
3047
  /**
@@ -3994,6 +3941,4 @@ export class TextField extends DisplayObjectContainer {
3994
3941
  }
3995
3942
  }
3996
3943
 
3997
- }
3998
-
3999
- PartitionBase.registerAbstraction(EntityNode, TextField);
3944
+ }