Patch from @peetervois to fix crashes of MoreToolbar from onyx v2.3
http://forums.enyojs.com/discussion/2595/onyx-moretoolbar-crash-in-enyo-2-3
Patch from @peetervois to fix crashes of MoreToolbar from onyx v2.3
http://forums.enyojs.com/discussion/2595/onyx-moretoolbar-crash-in-enyo-2-3
diff --git a/source/MoreToolbar.js b/source/MoreToolbar.js | |
index ab432e6..2c44e4c 100644 | |
--- a/source/MoreToolbar.js | |
+++ b/source/MoreToolbar.js | |
@@ -51,22 +51,37 @@ enyo.kind({ | |
this.inherited(arguments); | |
this.$.client.setLayoutKind(this.clientLayoutKind); | |
}, | |
+ rendered: function(){ | |
+ this.reflow(); | |
+ this.inherited( arguments ); | |
+ }, | |
clientLayoutKindChanged: function(){ | |
this.$.client.setLayoutKind(this.clientLayoutKind); | |
}, | |
reflow: function() { | |
this.inherited(arguments); | |
- if (this.isContentOverflowing()) { | |
- this.$.nard.show(); | |
- if (this.popItem()) { | |
- this.reflow(); | |
+ if( this.isContentOverflowing() ) | |
+ { | |
+ this.$.nard.show(); // show the nard to make less room | |
+ // pop items until overflow disappears | |
+ while( this.isContentOverflowing() ){ | |
+ this.popItem(); | |
} | |
- } else if (this.tryPushItem()) { | |
- this.reflow(); | |
- } else if (!this.$.menu.children.length) { | |
+ } | |
+ else{ | |
+ // try pushing while no overflow happens | |
+ while( this.tryPushItem() ){} | |
+ } | |
+ | |
+ if (!this.$.menu.children.length) { | |
this.$.nard.hide(); | |
this.$.menu.hide(); | |
} | |
+ else{ | |
+ this.$.nard.show(); | |
+ } | |
+ // An Android 7 mobile browser wanted following line too, to have screen rotation to work. | |
+ this.inherited(arguments); | |
}, | |
activated: function(inSender, inEvent) { | |
this.addRemoveClass("active",inEvent.originator.active); | |
@@ -86,6 +101,7 @@ enyo.kind({ | |
} | |
return true; | |
} | |
+ return false; | |
}, | |
pushItem: function() { | |
var c$ = this.$.menu.children; | |
@@ -118,6 +134,7 @@ enyo.kind({ | |
} | |
return true; | |
} | |
+ return false; | |
}, | |
tryPushItem: function() { | |
if (this.pushItem()) { | |
@@ -127,6 +144,7 @@ enyo.kind({ | |
this.popItem(); | |
} | |
} | |
+ return false; | |
}, | |
isContentOverflowing: function() { | |
if (this.$.client.hasNode()) { | |
@@ -139,6 +157,7 @@ enyo.kind({ | |
return ((n.offsetLeft + n.offsetWidth) > this.$.client.node.clientWidth); | |
} | |
} | |
+ return false; | |
}, | |
findCollapsibleItem: function() { | |
var c$ = this.$.client.children; |