diff --git a/spec/eventsSpec.js b/spec/eventsSpec.js index 79af24b..e4d236c 100644 --- a/spec/eventsSpec.js +++ b/spec/eventsSpec.js @@ -37,6 +37,32 @@ describe("Click events inside handle", function() { expect(clickHandler.calls.length).toEqual(1); expect(clickHandler.calls[0].args[0].isDefaultPrevented()).toBe(false); }); + + it("should be passed through if mouse moving without changing position", function() { + var clickHandler = jasmine.createSpy(); + var someX = 42; + var someY = 42; + helpers.initDragdealer('content-slider'); + + var wrapperPosition = $('#content-slider').offset(); + + $('#content-slider').click(clickHandler); + $('#content-slider .inner-button') + .simulate('mousemove',{ // to have a consistent startDrag position + clientX: someX, + clientY: someY + }) + .simulate('mousedown') + .simulate('mousemove',{ + clientX: someX, + clientY: someY + }) + .simulate('mouseup') + .simulate('click'); + + expect(clickHandler.calls.length).toEqual(1); + expect(clickHandler.calls[0].args[0].isDefaultPrevented()).toBe(false); + }); }); describe("Previous DOM events", function() { diff --git a/src/dragdealer.js b/src/dragdealer.js index 38d1c85..afc5c79 100644 --- a/src/dragdealer.js +++ b/src/dragdealer.js @@ -415,6 +415,12 @@ Dragdealer.prototype = { this.startDrag(); }, onDocumentMouseMove: function(e) { + if ((e.clientX - this.dragStartPosition.x) === 0 && + (e.clientY - this.dragStartPosition.y) === 0) { + // This is required on some Windows8 machines that get mouse move events without actual mouse movement + return; + } + Cursor.refresh(e); if (this.dragging) { this.activity = true;