diff --git a/src/ui-layout.js b/src/ui-layout.js index 4eb2245..1516b19 100644 --- a/src/ui-layout.js +++ b/src/ui-layout.js @@ -123,7 +123,7 @@ angular.module('ui.layout', []) (mouseEvent.originalEvent && mouseEvent.originalEvent[ctrl.sizeProperties.mouseProperty]) || (mouseEvent.targetTouches ? mouseEvent.targetTouches[0][ctrl.sizeProperties.mouseProperty] : 0); - lastPos = mousePos - offset($element)[ctrl.sizeProperties.offsetPos]; + lastPos = mousePos - opts.dividerSize / 2 - offset($element)[ctrl.sizeProperties.offsetPos]; //Cancel previous rAF call if(animationFrameRequested) { diff --git a/test/layout-scenar.spec.js b/test/layout-scenar.spec.js index 7277460..861fc34 100644 --- a/test/layout-scenar.spec.js +++ b/test/layout-scenar.spec.js @@ -102,8 +102,8 @@ function splitMoveTests(description, startEvent, moveEvent, endEvent) { browserTrigger($splitbar, moveEvent, { y: element_bb.height / 4}); expect(window.requestAnimationFrame).toHaveBeenCalled(); - var expextedPos = Math.floor(element_bb.height / 4); - expect(Math.ceil(parseFloat($splitbar[0].style.top))).toEqual(expextedPos); + var expectedPos = Math.floor(element_bb.height / 4 - defaultDividerSize / 2); + expect(Math.ceil(parseFloat($splitbar[0].style.top))).toEqual(expectedPos); browserTrigger(document.body, endEvent); }); @@ -130,7 +130,7 @@ function splitMoveTests(description, startEvent, moveEvent, endEvent) { browserTrigger($splitbar, moveEvent, { y: Math.random() * element_bb.width }); browserTrigger($splitbar, endEvent); - var expectedPos = Math.floor(element_bb.height / 4); + var expectedPos = Math.floor(element_bb.height / 4 - defaultDividerSize / 2); expect(window.requestAnimationFrame.calls.count()).toEqual(1); expect(Math.ceil(parseFloat($splitbar[0].style.top))).toEqual(expectedPos); });