update components
This commit is contained in:
parent
e6183509f8
commit
c01a55384e
26 changed files with 296 additions and 115 deletions
|
@ -1,5 +1,31 @@
|
|||
define(['browser', 'layoutManager', 'scrollStyles'], function (browser, layoutManager) {
|
||||
|
||||
var supportsCaptureOption = false;
|
||||
try {
|
||||
var opts = Object.defineProperty({}, 'capture', {
|
||||
get: function () {
|
||||
supportsCaptureOption = true;
|
||||
}
|
||||
});
|
||||
window.addEventListener("test", null, opts);
|
||||
} catch (e) { }
|
||||
|
||||
function addEventListenerWithOptions(target, type, handler, options) {
|
||||
var optionsOrCapture = options;
|
||||
if (!supportsCaptureOption) {
|
||||
optionsOrCapture = options.capture;
|
||||
}
|
||||
target.addEventListener(type, handler, optionsOrCapture);
|
||||
}
|
||||
|
||||
function removeEventListenerWithOptions(target, type, handler, options) {
|
||||
var optionsOrCapture = options;
|
||||
if (!supportsCaptureOption) {
|
||||
optionsOrCapture = options.capture;
|
||||
}
|
||||
target.removeEventListener(type, handler, optionsOrCapture);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return type of the value.
|
||||
*
|
||||
|
@ -900,6 +926,12 @@ define(['browser', 'layoutManager', 'scrollStyles'], function (browser, layoutMa
|
|||
self.destroy = function () {
|
||||
|
||||
window.removeEventListener('resize', onResize, true);
|
||||
|
||||
// Reset native FRAME element scroll
|
||||
removeEventListenerWithOptions(frameElement, 'scroll', resetScroll, {
|
||||
passive: true
|
||||
});
|
||||
|
||||
scrollSource.removeEventListener(wheelEvent, scrollHandler);
|
||||
|
||||
// Reset initialized status and return the instance
|
||||
|
@ -911,6 +943,14 @@ define(['browser', 'layoutManager', 'scrollStyles'], function (browser, layoutMa
|
|||
load(false);
|
||||
}
|
||||
|
||||
function resetScroll() {
|
||||
if (o.horizontal) {
|
||||
this.scrollLeft = 0;
|
||||
} else {
|
||||
this.scrollTop = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize.
|
||||
*
|
||||
|
@ -954,11 +994,17 @@ define(['browser', 'layoutManager', 'scrollStyles'], function (browser, layoutMa
|
|||
scrollSource.addEventListener(wheelEvent, scrollHandler);
|
||||
|
||||
if (transform) {
|
||||
dragInitEventNames.forEach(function(eventName) {
|
||||
dragInitEventNames.forEach(function (eventName) {
|
||||
dragSourceElement.addEventListener(eventName, dragInitSlidee);
|
||||
});
|
||||
|
||||
window.addEventListener('resize', onResize, true);
|
||||
|
||||
if (!o.horizontal) {
|
||||
addEventListenerWithOptions(frameElement, 'scroll', resetScroll, {
|
||||
passive: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Mark instance as initialized
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue