Merge pull request #420 from axelboc/master
Dispatch custom events on `update` and fix scroll-end event not being triggered when dragging
This commit is contained in:
commit
6e32d3ddce
@ -56,13 +56,13 @@ module.exports = function (element, axis, value) {
|
|||||||
|
|
||||||
var i = instances.get(element);
|
var i = instances.get(element);
|
||||||
|
|
||||||
if (axis === 'top' && value > i.contentHeight - i.containerHeight) {
|
if (axis === 'top' && value >= i.contentHeight - i.containerHeight) {
|
||||||
element.scrollTop = i.contentHeight - i.containerHeight;
|
element.scrollTop = i.contentHeight - i.containerHeight;
|
||||||
element.dispatchEvent(yEndEvent);
|
element.dispatchEvent(yEndEvent);
|
||||||
return; // don't allow scroll past container
|
return; // don't allow scroll past container
|
||||||
}
|
}
|
||||||
|
|
||||||
if (axis === 'left' && value > i.contentWidth - i.containerWidth) {
|
if (axis === 'left' && value >= i.contentWidth - i.containerWidth) {
|
||||||
element.scrollLeft = i.contentWidth - i.containerWidth;
|
element.scrollLeft = i.contentWidth - i.containerWidth;
|
||||||
element.dispatchEvent(xEndEvent);
|
element.dispatchEvent(xEndEvent);
|
||||||
return; // don't allow scroll past container
|
return; // don't allow scroll past container
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
var d = require('../lib/dom')
|
var d = require('../lib/dom')
|
||||||
, h = require('../lib/helper')
|
, h = require('../lib/helper')
|
||||||
, instances = require('./instances')
|
, instances = require('./instances')
|
||||||
, updateGeometry = require('./update-geometry');
|
, updateGeometry = require('./update-geometry')
|
||||||
|
, updateScroll = require('./update-scroll');
|
||||||
|
|
||||||
module.exports = function (element) {
|
module.exports = function (element) {
|
||||||
var i = instances.get(element);
|
var i = instances.get(element);
|
||||||
@ -30,6 +31,10 @@ module.exports = function (element) {
|
|||||||
|
|
||||||
updateGeometry(element);
|
updateGeometry(element);
|
||||||
|
|
||||||
|
// Update top/left scroll to trigger events
|
||||||
|
updateScroll(element, 'top', element.scrollTop);
|
||||||
|
updateScroll(element, 'left', element.scrollLeft);
|
||||||
|
|
||||||
d.css(i.scrollbarXRail, 'display', '');
|
d.css(i.scrollbarXRail, 'display', '');
|
||||||
d.css(i.scrollbarYRail, 'display', '');
|
d.css(i.scrollbarYRail, 'display', '');
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user