else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
}
-
+
if(!o.axis || o.axis != 'y') {
if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
}
} else {
-
+
if(!o.axis || o.axis != 'x') {
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
}
-
+
if(!o.axis || o.axis != 'y') {
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
}
-
+
}
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
$.ui.plugin.add("draggable", "stack", {
start: function(event, ui) {
-
+
var o = $(this).data("draggable").options;
-
+
var group = $.makeArray($(o.stack.group)).sort(function(a,b) {
return (parseInt($(a).css("zIndex"),10) || o.stack.min) - (parseInt($(b).css("zIndex"),10) || o.stack.min);
});
});
this[0].style.zIndex = o.stack.min + group.length;
-
+
}
});
_init: function() {
- var self = this, o = this.options;
+ var self = this, o = this.options;
this.element.addClass("ui-resizable");
-
+
$.extend(this, {
_aspectRatio: !!(o.aspectRatio),
aspectRatio: o.aspectRatio,
// fix handlers offset
this._proportionallyResize();
-
+
}
this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
var n = this.handles.split(","); this.handles = {};
for(var i = 0; i < n.length; i++) {
-
+
var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
-
+
// increase zIndex of sw, se, ne, nw axis
//TODO : this modifies original option
if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
}
this._renderAxis = function(target) {
-
+
target = target || this.element;
for(var i in this.handles) {
-
+
if(this.handles[i].constructor == String)
this.handles[i] = $(this.handles[i], this.element).show();
target.css(padPos, padWrapper);
this._proportionallyResize();
-
+
}
-
+
//TODO: What's that good for? There's not anything to be executed left
if(!$(this.handles[i]).length)
continue;
-
+
}
};
//TODO: make renderAxis a prototype function
this._renderAxis(this.element);
-
+
this._handles = $('.ui-resizable-handle', this.element);
if (o.disableSelection)
//Initialize the mouse interaction
this._mouseInit();
-
+
},
destroy: function() {
-
+
this._mouseDestroy();
var _destroy = function(exp) {
})
).end().remove();
}
-
+
_destroy(this.originalElement);
-
+
},
_mouseCapture: function(event) {
var o = this.options, iniPos = this.element.position(), el = this.element,
num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7;
-
+
this.resizing = true;
this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
if (this._helper) this.helper.remove();
return false;
-
+
},
_updateCache: function(data) {
},
_proportionallyResize: function() {
-
+
var o = this.options;
if (!this.proportionallyResize.length) return;
var element = this.helper || this.element;
-
+
for (var i=0; i < this.proportionallyResize.length; i++) {
-
+
var prel = this.proportionallyResize[i];
-
+
if (!this.borderDif) {
var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
-
+
this.borderDif = $.map(b, function(v, i) {
var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
return border + padding;
});
}
-
+
if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
continue;
-
+
prel.css({
height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
});
-
+
};
},
_renderProxy: function() {
-
+
var el = this.element, o = this.options;
this.elementOffset = el.offset();
if(this._helper) {
-
+
this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
// fix ie6 offset TODO: This seems broken
} else {
this.helper = this.element;
}
-
+
},
_change: {
$.ui.plugin.add("resizable", "alsoResize", {
start: function(event, ui) {
-
+
var o = ui.options, self = $(this).data("resizable"),
_store = function(exp) {
$.ui.plugin.add("resizable", "ghost", {
start: function(event, ui) {
-
+
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize, cs = self.size;
self.ghost = self.originalElement.clone();