Skip to content

Instantly share code, notes, and snippets.

@dmikey
Last active August 29, 2015 13:58
Show Gist options
  • Save dmikey/9968735 to your computer and use it in GitHub Desktop.
Save dmikey/9968735 to your computer and use it in GitHub Desktop.
Extend enyo layout LeftRightArranger, offers better support for wrapped panels (works on non wrapped panels as well), esp handy in rotators/heros.
enyo.kind({
name: "WrappedLeftRightArranger",
kind: "LeftRightArranger",
start: enyo.inherit(function(sup) {
return function() {
sup.apply(this, arguments);
var s = this.container.fromIndex;
var f = this.container.toIndex;
var c$ = this.getOrderedControls(f);
var o = Math.floor(c$.length/2);
var wf = (s === 0 && f == (c$.length-1));
var wb = (s == (c$.length-1) && f === 0);
var w = !wb ? wf ? wf : s > f : !wb;
for (var i=0, c; (c=c$[i]); i++) {
if (w){
if (i == (c$.length - o)){
c.applyStyle("z-index", 0);
} else {
c.applyStyle("z-index", 1);
}
} else {
if (i == (c$.length - 1 - o)){
c.applyStyle("z-index", 0);
} else {
c.applyStyle("z-index", 1);
}
}
}
};
}),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment