Skip to content

Commit

Permalink
Change signature of onDrag* events.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilton Janfield committed Sep 12, 2015
1 parent 0be0b15 commit 4ec1566
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changes made so far over v1.1.0.
- Implemented drag-delay if the user clicks on the collapse handle then starts dragging. Drag will not begin until mouse has moved past 5 pixels in either direction. (UX improvement)
- Prevent click event if the user started and ended their drag on the collapse handle. (UX improvement)
- Change splitter bar class from .splitter to .splitter_bar for consistency.
- Fixed issue where collapse handle would ignore one click if manually dragged to the collapsed position. (UX improvement/bug)
- Modified onDrag, onDragStart, onDragEnd events to pass splitter container for easy manipulation.

## Release v1.1.0

Expand Down
6 changes: 6 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -473,23 +473,29 @@ <h1>Options</h1>

<dt>onDragStart</dt>
<dd>
<code>function (event, splitter_container) { ... }</code>
<code class="default">Default: $.noop</code>

<p>Event handler called when a user starts dragging a splitter.</p>
<p>Parameters passed are the standard event handler data, and the .splitter_container object.</p>
</dd>

<dt>onDragEnd</dt>
<dd>
<code>function (event, splitter_container) { ... }</code>
<code class="default">Default: $.noop</code>

<p>Event handler called when a user stops dragging a splitter.</p>
<p>Parameters passed are the standard event handler data, and the .splitter_container object.</p>
</dd>

<dt>onDrag</dt>
<dd>
<code>function (event, splitter_container) { ... }</code>
<code class="default">Default: $.noop</code>

<p>Event handler called after a user moves a splitter.</p>
<p>Parameters passed are the standard event handler data, and the .splitter_container object.</p>
</dd>
</dl>
</div>
Expand Down
8 changes: 4 additions & 4 deletions js/jquery.enhsplitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
currentSplitter.find('.splitter_panel').trigger('resize.splitter');
e.preventDefault();
$('.splitter_mask').remove();
currentSplitter.settings.onDrag(e);
currentSplitter.settings.onDrag(e, currentSplitter);
}
currentSplitter.removeClass('splitter-active');
currentSplitter = null;
Expand All @@ -277,7 +277,7 @@
} else {
currentSplitter.addClass('splitter-active');
$('<div class="splitter_mask"></div>').css('cursor', currentSplitter.children().eq(1).css('cursor')).insertAfter(currentSplitter);
currentSplitter.settings.onDragStart(e);
currentSplitter.settings.onDragStart(e, currentSplitter);
}
})

Expand Down Expand Up @@ -309,7 +309,7 @@
}
}
$('.splitter_mask').remove();
currentSplitter.settings.onDragEnd(e);
currentSplitter.settings.onDragEnd(e, currentSplitter);
currentSplitter.removeClass('splitter-active');
currentSplitter = null;
}
Expand Down Expand Up @@ -341,7 +341,7 @@
currentSplitter.setPosition(position - currentSplitter.offset().top - currentSplitter.splitterSizeHalf);
}
e.preventDefault();
currentSplitter.settings.onDrag(e);
currentSplitter.settings.onDrag(e, currentSplitter);
}
}
);
Expand Down

0 comments on commit 4ec1566

Please sign in to comment.