Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Keep resize cursor better while dragging #89

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions test/layout-scenar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Expand Down