1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-09-01 01:01:47 +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';
let SCROLLABLE_CONTAINER = null;
/**
* Smoothly scrolls to a given Y position using Easing.Swing. It'll run a
* callback upon finishing.
@@ -12,11 +10,9 @@ let SCROLLABLE_CONTAINER = null;
*/
export default function scrollTo(y, duration = 500, cb = () => {},
container = null) {
if (container) {
SCROLLABLE_CONTAINER = container;
} else if (!SCROLLABLE_CONTAINER) {
SCROLLABLE_CONTAINER = document.getElementById('webslides');
}
const SCROLLABLE_CONTAINER = container
? container
: document.getElementById('webslides');
const delta = y - SCROLLABLE_CONTAINER.scrollTop;
const startLocation = SCROLLABLE_CONTAINER.scrollTop;