Skip to content

Commit

Permalink
Fixed unsuccessful overwrite of event properties
Browse files Browse the repository at this point in the history
Double calls to offset removed
  • Loading branch information
leongersen committed Nov 15, 2013
1 parent b2dd1a9 commit 8e539ab
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions jquery.nouislider.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
y = e.clientY + window.pageYOffset;
}

return $.extend( event, { x:x, y:y, cursor: mouse } );
return $.extend( event, { pointX: x, pointY: y, cursor: mouse } );
}

// Handler for attaching events trough a proxy
Expand Down Expand Up @@ -737,10 +737,10 @@
// Subtract the initial movement from the current event,
// while taking vertical sliders into account.
if ( this.handle.data('style') === 'left' ) {
proposal = event.x - this.startEvent.x;
proposal = event.pointX - this.startEvent.pointX;
baseSize = base.width();
} else {
proposal = event.y - this.startEvent.y;
proposal = event.pointY - this.startEvent.pointY;
baseSize = base.height();
}

Expand Down Expand Up @@ -827,22 +827,16 @@
var i, handle, hCenter, base = this.base
,handles = base.data('handles')
,style = handles[0].data('style')
,eventXY = event[style === 'left' ? 'x' : 'y']
,eventXY = event[style === 'left' ? 'pointX' : 'pointY']
,baseSize = style === 'left' ? base.width() : base.height()
,offset = {
handles: []
,base: {
left: base.offset().left
,top: base.offset().top
}
,base: base.offset()
};

// Loop handles and add data to the offset list.
for (i = 0; i < handles.length; i++ ) {
offset.handles.push({
left: handles[i].offset().left
,top: handles[i].offset().top
});
offset.handles.push( handles[i].offset() );
}

// Calculate the central point between the handles;
Expand Down

0 comments on commit 8e539ab

Please sign in to comment.