From 4cdb9dba361e7f1d475f6a7933ea451a37b8caf9 Mon Sep 17 00:00:00 2001 From: Leo Baschy Date: Sat, 14 Mar 2015 10:06:19 -0700 Subject: [PATCH 1/3] Keep resize cursor better while dragging Hitherto when carefully dragging column splitbar to the left or row splitbar to the top then cursor exiting splitbar proper changed from resize to other. This fix makes the cursor remain resize much better. --- src/ui-layout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { From 54d617312d95ca7674623a9d62f5459c37bd172e Mon Sep 17 00:00:00 2001 From: Leo Baschy Date: Sat, 14 Mar 2015 10:22:45 -0700 Subject: [PATCH 2/3] Match expected coordinates in test --- test/layout-scenar.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/layout-scenar.spec.js b/test/layout-scenar.spec.js index 7277460..aa4bf13 100644 --- a/test/layout-scenar.spec.js +++ b/test/layout-scenar.spec.js @@ -102,7 +102,7 @@ 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); + var expextedPos = Math.floor(element_bb.height / 4 - defaultDividerSize / 2); expect(Math.ceil(parseFloat($splitbar[0].style.top))).toEqual(expextedPos); browserTrigger(document.body, endEvent); From fb83e816ea9e53b1556afbec6f49a5527ffc5b1e Mon Sep 17 00:00:00 2001 From: Leo Baschy Date: Sat, 14 Mar 2015 10:31:41 -0700 Subject: [PATCH 3/3] Match expected coordinates in test one more --- test/layout-scenar.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/layout-scenar.spec.js b/test/layout-scenar.spec.js index aa4bf13..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 - defaultDividerSize / 2); - 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); });