Skip to content

Commit b2abdbb

Browse files
committed
Merge branch 'develop' into fix-multi-updates
2 parents a12479e + 3f93a89 commit b2abdbb

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

core/Node.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ function Node () {
9595
this._transformID = null;
9696
this._sizeID = null;
9797

98-
if (this.constructor.INIT_DEFAULT_COMPONENTS) this._init();
98+
if (!this.constructor.NO_DEFAULT_COMPONENTS) this._init();
9999
}
100100

101101
Node.RELATIVE_SIZE = 0;
102102
Node.ABSOLUTE_SIZE = 1;
103103
Node.RENDER_SIZE = 2;
104104
Node.DEFAULT_SIZE = 0;
105-
Node.INIT_DEFAULT_COMPONENTS = true;
105+
Node.NO_DEFAULT_COMPONENTS = false;
106106

107107
/**
108108
* Protected method. Initializes a node with a default Transform and Size component
@@ -443,7 +443,7 @@ Node.prototype.getOpacity = function getOpacity () {
443443
* @return {Float32Array} An array representing the mount point.
444444
*/
445445
Node.prototype.getMountPoint = function getMountPoint () {
446-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
446+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
447447
return this.getComponent(this._transformID).getMountPoint();
448448
else if (this.isMounted())
449449
return TransformSystem.get(this.getLocation()).getMountPoint();
@@ -458,7 +458,7 @@ Node.prototype.getMountPoint = function getMountPoint () {
458458
* @return {Float32Array} An array representing the align.
459459
*/
460460
Node.prototype.getAlign = function getAlign () {
461-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
461+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
462462
return this.getComponent(this._transformID).getAlign();
463463
else if (this.isMounted())
464464
return TransformSystem.get(this.getLocation()).getAlign();
@@ -473,7 +473,7 @@ Node.prototype.getAlign = function getAlign () {
473473
* @return {Float32Array} An array representing the origin.
474474
*/
475475
Node.prototype.getOrigin = function getOrigin () {
476-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
476+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
477477
return this.getComponent(this._transformID).getOrigin();
478478
else if (this.isMounted())
479479
return TransformSystem.get(this.getLocation()).getOrigin();
@@ -488,7 +488,7 @@ Node.prototype.getOrigin = function getOrigin () {
488488
* @return {Float32Array} An array representing the position.
489489
*/
490490
Node.prototype.getPosition = function getPosition () {
491-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
491+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
492492
return this.getComponent(this._transformID).getPosition();
493493
else if (this.isMounted())
494494
return TransformSystem.get(this.getLocation()).getPosition();
@@ -503,7 +503,7 @@ Node.prototype.getPosition = function getPosition () {
503503
* @return {Float32Array} an array of four values, showing the rotation as a quaternion
504504
*/
505505
Node.prototype.getRotation = function getRotation () {
506-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
506+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
507507
return this.getComponent(this._transformID).getRotation();
508508
else if (this.isMounted())
509509
return TransformSystem.get(this.getLocation()).getRotation();
@@ -518,7 +518,7 @@ Node.prototype.getRotation = function getRotation () {
518518
* @return {Float32Array} an array showing the current scale vector
519519
*/
520520
Node.prototype.getScale = function getScale () {
521-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
521+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
522522
return this.getComponent(this._transformID).getScale();
523523
else if (this.isMounted())
524524
return TransformSystem.get(this.getLocation()).getScale();
@@ -533,7 +533,7 @@ Node.prototype.getScale = function getScale () {
533533
* @return {Float32Array} an array of numbers showing the current size mode
534534
*/
535535
Node.prototype.getSizeMode = function getSizeMode () {
536-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
536+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
537537
return this.getComponent(this._sizeID).getSizeMode();
538538
else if (this.isMounted())
539539
return SizeSystem.get(this.getLocation()).getSizeMode();
@@ -548,7 +548,7 @@ Node.prototype.getSizeMode = function getSizeMode () {
548548
* @return {Float32Array} a vector 3 showing the current proportional size
549549
*/
550550
Node.prototype.getProportionalSize = function getProportionalSize () {
551-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
551+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
552552
return this.getComponent(this._sizeID).getProportional();
553553
else if (this.isMounted())
554554
return SizeSystem.get(this.getLocation()).getProportional();
@@ -563,7 +563,7 @@ Node.prototype.getProportionalSize = function getProportionalSize () {
563563
* @return {Float32Array} a vector 3 showing the current differential size
564564
*/
565565
Node.prototype.getDifferentialSize = function getDifferentialSize () {
566-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
566+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
567567
return this.getComponent(this._sizeID).getDifferential();
568568
else if (this.isMounted())
569569
return SizeSystem.get(this.getLocation()).getDifferential();
@@ -578,7 +578,7 @@ Node.prototype.getDifferentialSize = function getDifferentialSize () {
578578
* @return {Float32Array} a vector 3 showing the current absolute size of the node
579579
*/
580580
Node.prototype.getAbsoluteSize = function getAbsoluteSize () {
581-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
581+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
582582
return this.getComponent(this._sizeID).getAbsolute();
583583
else if (this.isMounted())
584584
return SizeSystem.get(this.getLocation()).getAbsolute();
@@ -595,7 +595,7 @@ Node.prototype.getAbsoluteSize = function getAbsoluteSize () {
595595
* @return {Float32Array} a vector 3 showing the current render size
596596
*/
597597
Node.prototype.getRenderSize = function getRenderSize () {
598-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
598+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
599599
return this.getComponent(this._sizeID).getRender();
600600
else if (this.isMounted())
601601
return SizeSystem.get(this.getLocation()).getRender();
@@ -610,7 +610,7 @@ Node.prototype.getRenderSize = function getRenderSize () {
610610
* @return {Float32Array} a vector 3 of the final calculated side of the node
611611
*/
612612
Node.prototype.getSize = function getSize () {
613-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
613+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
614614
return this.getComponent(this._sizeID).get();
615615
else if (this.isMounted())
616616
return SizeSystem.get(this.getLocation()).get();
@@ -888,7 +888,7 @@ Node.prototype.hide = function hide () {
888888
* @return {Node} this
889889
*/
890890
Node.prototype.setAlign = function setAlign (x, y, z) {
891-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
891+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
892892
this.getComponent(this._transformID).setAlign(x, y, z);
893893
else if (this.isMounted())
894894
TransformSystem.get(this.getLocation()).setAlign(x, y, z);
@@ -909,7 +909,7 @@ Node.prototype.setAlign = function setAlign (x, y, z) {
909909
* @return {Node} this
910910
*/
911911
Node.prototype.setMountPoint = function setMountPoint (x, y, z) {
912-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
912+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
913913
this.getComponent(this._transformID).setMountPoint(x, y, z);
914914
else if (this.isMounted())
915915
TransformSystem.get(this.getLocation()).setMountPoint(x, y, z);
@@ -930,7 +930,7 @@ Node.prototype.setMountPoint = function setMountPoint (x, y, z) {
930930
* @return {Node} this
931931
*/
932932
Node.prototype.setOrigin = function setOrigin (x, y, z) {
933-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
933+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
934934
this.getComponent(this._transformID).setOrigin(x, y, z);
935935
else if (this.isMounted())
936936
TransformSystem.get(this.getLocation()).setOrigin(x, y, z);
@@ -951,7 +951,7 @@ Node.prototype.setOrigin = function setOrigin (x, y, z) {
951951
* @return {Node} this
952952
*/
953953
Node.prototype.setPosition = function setPosition (x, y, z) {
954-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
954+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
955955
this.getComponent(this._transformID).setPosition(x, y, z);
956956
else if (this.isMounted())
957957
TransformSystem.get(this.getLocation()).setPosition(x, y, z);
@@ -975,7 +975,7 @@ Node.prototype.setPosition = function setPosition (x, y, z) {
975975
* @return {Node} this
976976
*/
977977
Node.prototype.setRotation = function setRotation (x, y, z, w) {
978-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
978+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
979979
this.getComponent(this._transformID).setRotation(x, y, z, w);
980980
else if (this.isMounted())
981981
TransformSystem.get(this.getLocation()).setRotation(x, y, z, w);
@@ -996,7 +996,7 @@ Node.prototype.setRotation = function setRotation (x, y, z, w) {
996996
* @return {Node} this
997997
*/
998998
Node.prototype.setScale = function setScale (x, y, z) {
999-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
999+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
10001000
this.getComponent(this._transformID).setScale(x, y, z);
10011001
else if (this.isMounted())
10021002
TransformSystem.get(this.getLocation()).setScale(x, y, z);
@@ -1057,7 +1057,7 @@ Node.prototype.setOpacity = function setOpacity (val) {
10571057
* @return {Node} this
10581058
*/
10591059
Node.prototype.setSizeMode = function setSizeMode (x, y, z) {
1060-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
1060+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
10611061
this.getComponent(this._sizeID).setSizeMode(x, y, z);
10621062
else if (this.isMounted())
10631063
SizeSystem.get(this.getLocation()).setSizeMode(x, y, z);
@@ -1079,7 +1079,7 @@ Node.prototype.setSizeMode = function setSizeMode (x, y, z) {
10791079
* @return {Node} this
10801080
*/
10811081
Node.prototype.setProportionalSize = function setProportionalSize (x, y, z) {
1082-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
1082+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
10831083
this.getComponent(this._sizeID).setProportional(x, y, z);
10841084
else if (this.isMounted())
10851085
SizeSystem.get(this.getLocation()).setProportional(x, y, z);
@@ -1106,7 +1106,7 @@ Node.prototype.setProportionalSize = function setProportionalSize (x, y, z) {
11061106
* @return {Node} this
11071107
*/
11081108
Node.prototype.setDifferentialSize = function setDifferentialSize (x, y, z) {
1109-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
1109+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
11101110
this.getComponent(this._sizeID).setDifferential(x, y, z);
11111111
else if (this.isMounted())
11121112
SizeSystem.get(this.getLocation()).setDifferential(x, y, z);
@@ -1126,7 +1126,7 @@ Node.prototype.setDifferentialSize = function setDifferentialSize (x, y, z) {
11261126
* @return {Node} this
11271127
*/
11281128
Node.prototype.setAbsoluteSize = function setAbsoluteSize (x, y, z) {
1129-
if (this.constructor.INIT_DEFAULT_COMPONENTS)
1129+
if (!this.constructor.NO_DEFAULT_COMPONENTS)
11301130
this.getComponent(this._sizeID).setAbsolute(x, y, z);
11311131
else if (this.isMounted())
11321132
SizeSystem.get(this.getLocation()).setAbsolute(x, y, z);
@@ -1209,7 +1209,7 @@ Node.prototype.mount = function mount (path) {
12091209
if (this.isMounted())
12101210
throw new Error('Node is already mounted at: ' + this.getLocation());
12111211

1212-
if (this.constructor.INIT_DEFAULT_COMPONENTS){
1212+
if (!this.constructor.NO_DEFAULT_COMPONENTS){
12131213
TransformSystem.registerTransformAtPath(path, this.getComponent(this._transformID));
12141214
SizeSystem.registerSizeAtPath(path, this.getComponent(this._sizeID));
12151215
}

dom-renderables/DOMElement.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ function DOMElement(node, options) {
7575
this._id = node ? node.addComponent(this) : null;
7676
this._node = node;
7777

78-
this.onSizeModeChange.apply(this, node.getSizeMode());
79-
8078
this._callbacks = new CallbackStore();
8179

8280
this.setProperty('display', node.isShown() ? 'block' : 'none');
@@ -172,6 +170,7 @@ DOMElement.prototype.onMount = function onMount(node, id) {
172170
this._id = id;
173171
this._UIEvents = node.getUIEvents().slice(0);
174172
TransformSystem.makeBreakPointAt(node.getLocation());
173+
this.onSizeModeChange.apply(this, node.getSizeMode());
175174
this.draw();
176175
this.setAttribute('data-fa-path', node.getLocation());
177176
};

0 commit comments

Comments
 (0)