1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-16 01:54:53 +02:00

Fixing scrolling after zooming

This commit is contained in:
Luis Sacristán
2017-08-11 23:20:08 +02:00
parent e6de10e449
commit 37d9b84bff
4 changed files with 8 additions and 18 deletions

View File

@@ -1,7 +1,5 @@
import Easings from './easing'; import Easings from './easing';
let SCROLLABLE_CONTAINER = null;
/** /**
* Smoothly scrolls to a given Y position using Easing.Swing. It'll run a * Smoothly scrolls to a given Y position using Easing.Swing. It'll run a
* callback upon finishing. * callback upon finishing.
@@ -12,11 +10,9 @@ let SCROLLABLE_CONTAINER = null;
*/ */
export default function scrollTo(y, duration = 500, cb = () => {}, export default function scrollTo(y, duration = 500, cb = () => {},
container = null) { container = null) {
if (container) { const SCROLLABLE_CONTAINER = container
SCROLLABLE_CONTAINER = container; ? container
} else if (!SCROLLABLE_CONTAINER) { : document.getElementById('webslides');
SCROLLABLE_CONTAINER = document.getElementById('webslides');
}
const delta = y - SCROLLABLE_CONTAINER.scrollTop; const delta = y - SCROLLABLE_CONTAINER.scrollTop;
const startLocation = SCROLLABLE_CONTAINER.scrollTop; const startLocation = SCROLLABLE_CONTAINER.scrollTop;

View File

@@ -1,7 +1,7 @@
/*! /*!
* Name: WebSlides * Name: WebSlides
* Version: 1.3.1 * Version: 1.3.1
* Date: 2017-08-10 * Date: 2017-08-11
* Description: Making HTML presentations easy * Description: Making HTML presentations easy
* URL: https://github.com/webslides/webslides#readme * URL: https://github.com/webslides/webslides#readme
* Credits: @jlantunez, @LuisSacristan, @Belelros * Credits: @jlantunez, @LuisSacristan, @Belelros

View File

@@ -1,7 +1,7 @@
/*! /*!
* Name: WebSlides * Name: WebSlides
* Version: 1.3.1 * Version: 1.3.1
* Date: 2017-08-10 * Date: 2017-08-11
* Description: Making HTML presentations easy * Description: Making HTML presentations easy
* URL: https://github.com/webslides/webslides#readme * URL: https://github.com/webslides/webslides#readme
* Credits: @jlantunez, @LuisSacristan, @Belelros * Credits: @jlantunez, @LuisSacristan, @Belelros
@@ -688,8 +688,6 @@ var MobileDetector = function () {
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__easing__ = __webpack_require__(20); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__easing__ = __webpack_require__(20);
var SCROLLABLE_CONTAINER = null;
/** /**
* Smoothly scrolls to a given Y position using Easing.Swing. It'll run a * Smoothly scrolls to a given Y position using Easing.Swing. It'll run a
* callback upon finishing. * callback upon finishing.
@@ -703,11 +701,7 @@ function scrollTo(y) {
var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {}; var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
var container = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; var container = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
if (container) { var SCROLLABLE_CONTAINER = container ? container : document.getElementById('webslides');
SCROLLABLE_CONTAINER = container;
} else if (!SCROLLABLE_CONTAINER) {
SCROLLABLE_CONTAINER = document.getElementById('webslides');
}
var delta = y - SCROLLABLE_CONTAINER.scrollTop; var delta = y - SCROLLABLE_CONTAINER.scrollTop;
var startLocation = SCROLLABLE_CONTAINER.scrollTop; var startLocation = SCROLLABLE_CONTAINER.scrollTop;

File diff suppressed because one or more lines are too long