Skip to content

Instantly share code, notes, and snippets.

@ryanjduffy
Last active March 22, 2017 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanjduffy/0215cba0b3975db98303412c5159f698 to your computer and use it in GitHub Desktop.
Save ryanjduffy/0215cba0b3975db98303412c5159f698 to your computer and use it in GitHub Desktop.
MoreToolbar.patch
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment