607Putting It All Together
% If this is a drag movement (i.e., mouse button is clicked)
if inDragMode
% Act according to the dragged object
dvLimits = get(hDivider, {'dividerMinLocation','dividerMinLocation'});
cp = get(hFig,'CurrentPoint'); % TODO: convert from pixels => norm
if strcmpi(orientation,'horizontal')
dvLocation = cp(1,1); % x location
else % vertical
dvLocation = cp(1,2); % y location
end
dvLocation = min(max(dvLocation,dvLimits{1}),dvLimits{2});
set(hDivider,'DividerLocation',dvLocation);
% Mode managers (zoom/pan etc.) modify cursor shape so we need
to force ours
newPtr = getappdata(hFig, 'uisplitpane_mouseDownPointer');
if ~isempty(newPtr)
setptr(hFig, newPtr);
end
else % Normal mouse movement (no drag)
% Modify the cursor ...