Skip to content

Instantly share code, notes, and snippets.

@fonzerelly
Last active August 29, 2015 13:56
Show Gist options
  • Save fonzerelly/8793952 to your computer and use it in GitHub Desktop.
Save fonzerelly/8793952 to your computer and use it in GitHub Desktop.
A lightweight constructor for jLayout-Compunents and containers.
var _createJLayoutWrapper = function (handlePosition, predicate, getSize) {
var wrapper = {
bounds : function (value) {
if (value) {
handlePosition(value);
}
return getSize();
},
isVisible : predicate,
insets : function () {
return {
top: 0,
bottom: 0,
left: 0,
right: 0
};
},
doLayout : function() {}
};
["preferred", "minimum", "maximum"].forEach(function (prefix) {
wrapper[prefix + "Size"] = getSize;
});
return wrapper;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment