alpaca
Version:
Alpaca provides the easiest and fastest way to generate interactive forms for the web and mobile devices. It runs simply as HTML5 or more elaborately using Bootstrap, jQuery Mobile or jQuery UI. Alpaca uses Handlebars to process JSON schema and provide
41 lines (31 loc) • 1.12 kB
JavaScript
define(function () {
var EDITABLE_PADDING = 24;
var Statusbar = function (context) {
var $document = $(document);
var $statusbar = context.layoutInfo.statusbar;
var $editable = context.layoutInfo.editable;
var options = context.options;
this.initialize = function () {
if (options.airMode || options.disableResizeEditor) {
return;
}
$statusbar.on('mousedown', function (event) {
event.preventDefault();
event.stopPropagation();
var editableTop = $editable.offset().top - $document.scrollTop();
$document.on('mousemove', function (event) {
var height = event.clientY - (editableTop + EDITABLE_PADDING);
height = (options.minheight > 0) ? Math.max(height, options.minheight) : height;
height = (options.maxHeight > 0) ? Math.min(height, options.maxHeight) : height;
$editable.height(height);
}).one('mouseup', function () {
$document.off('mousemove');
});
});
};
this.destroy = function () {
$statusbar.off();
};
};
return Statusbar;
});