From 6e27dc809a856d415f23c24dfbd92c143e8bef81 Mon Sep 17 00:00:00 2001 From: Antonio Laguna Date: Sat, 29 Apr 2017 22:52:38 +0200 Subject: [PATCH] Housekeeping --- src/js/plugins/zoom.js | 20 +++++++++----------- src/js/utils/dom.js | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/js/plugins/zoom.js b/src/js/plugins/zoom.js index 398a220..1fa7517 100644 --- a/src/js/plugins/zoom.js +++ b/src/js/plugins/zoom.js @@ -2,7 +2,6 @@ import DOM from '../utils/dom'; import Keys from '../utils/keys'; import Slide from '../modules/slide'; - const CLASSES = { ZOOM: 'grid', DIV: 'column', @@ -45,7 +44,7 @@ export default class Zoom { /** * On key down handler. Will decide if Zoom in or out - * @param {Event} event Key down event + * @param {Event} event Key down event. */ onKeyDown(event) { if (!this.isZoomed_ && Keys.MINUS.includes(event.which)) { @@ -58,7 +57,7 @@ export default class Zoom { /** * Prepare zoom structure, scales the slides and uses a grid layout - * to show them + * to show them. */ preBuildZoom_() { // Clone #webslides element @@ -83,8 +82,8 @@ export default class Zoom { } /** - * Creates a block structure around the slide - * @param {Element} elem slide element + * Creates a block structure around the slide. + * @param {Element} elem slide element. */ createSlideBlock_(elem) { // Wraps the slide around a container @@ -145,7 +144,7 @@ export default class Zoom { } /** - * Toggles zoom + * Toggles zoom. */ toggleZoom() { if (this.isZoomed_) { @@ -156,7 +155,7 @@ export default class Zoom { } /** - * Zoom In the slider, scales the slides and uses a grid layout to show them + * Zoom In the slider, scales the slides and uses a grid layout to show them. */ zoomIn() { this.ws_.el.classList.add('zooming', 'in'); @@ -172,7 +171,7 @@ export default class Zoom { } /** - * Zoom Out the slider, remove scale from the slides + * Zoom Out the slider, remove scale from the slides. */ zoomOut() { this.ws_.el.classList.add('zooming', 'out'); @@ -188,10 +187,9 @@ export default class Zoom { } /** - * When windows resize it is necessary to recalculate layers sizes - * @param {Event} ev + * When windows resize it is necessary to recalculate layers sizes. */ - onWindowResize(ev) { + onWindowResize() { if (this.isZoomed_) this.zoomOut(); this.zws_.slides.forEach(elem => { diff --git a/src/js/utils/dom.js b/src/js/utils/dom.js index d53015a..2aa0345 100644 --- a/src/js/utils/dom.js +++ b/src/js/utils/dom.js @@ -182,19 +182,19 @@ export default class DOM { } /** - * Gets the integer value of a style property - * @param {string} prop CSS property value - * @return {integer} The property without the units + * Gets the integer value of a style property. + * @param {string} prop CSS property value. + * @return {Number} The property without the units. */ static parseSize(prop) { return Number(prop.replace(/[^\d\.]/g, '')); } /** - * Wraps a HTML structure arrond a element - * @param {Element} elem the element to be wrapped - * @param {string} tag the new element tag - * @return {Element} the new element + * Wraps a HTML structure around an element. + * @param {Element} elem the element to be wrapped. + * @param {string} tag the new element tag. + * @return {Element} the new element. */ static wrap(elem, tag) { const wrap = document.createElement(tag); @@ -205,9 +205,9 @@ export default class DOM { } /** - * Inserts and element after another element - * @param {Element} elem the element to be inserted - * @param {Element} target the element to be inserted after + * Inserts and element after another element. + * @param {Element} elem the element to be inserted. + * @param {Element} target the element to be inserted after. */ static after(elem, target) { const parent = target.parentNode;