Magnifier: Partial cleanup.

This commit is contained in:
Scott González 2008-07-16 00:08:43 +00:00
parent c2ce22addf
commit 6cfb6208ee

View File

@ -99,8 +99,12 @@ $.widget("ui.magnifier", {
var p = [e.pageX,e.pageY], o = this.options, c, distance = 1;
this.current = this.items[0];
//Compute the parents distance, because we don't need to fire anything if we are not near the parent
var overlap = ((p[0] > this.pp.left-o.distance && p[0] < this.pp.left + this.element[0].offsetWidth + o.distance) && (p[1] > this.pp.top-o.distance && p[1] < this.pp.top + this.element[0].offsetHeight + o.distance));
// Compute the parent's distance
// we don't need to fire anything if we are not near the parent
var overlap = ((p[0] > this.pp.left-o.distance) &&
(p[0] < this.pp.left + this.element[0].offsetWidth + o.distance) &&
(p[1] > this.pp.top-o.distance) &&
(p[1] < this.pp.top + this.element[0].offsetHeight + o.distance));
if (!overlap) { return false; }
for (var i=0; i<this.items.length; i++) {
@ -121,7 +125,7 @@ $.widget("ui.magnifier", {
}
if (distance < o.distance) {
this.current = distance < olddistance ? this.items[i] : this.current;
this.current = distance < olddistance ? c : this.current;
if (!o.axis || o.axis != "y") {
$(c[0]).css({
@ -154,8 +158,7 @@ $.widget("ui.magnifier", {
(o.zIndex && $(c[0]).css("z-index", ""));
}
(this.options.zIndex &&
$(this.current[0]).css("z-index", this.options.zIndex));
(o.zIndex && $(this.current[0]).css("z-index", o.zIndex));
}
});