From b02a30cafca82abf987c8d30c6ae6390195a8663 Mon Sep 17 00:00:00 2001 From: Glenn Vorhes <gavorhes@wisc.edu> Date: Thu, 2 Jun 2016 12:44:37 -0500 Subject: [PATCH] add additonal slider content param to LayerSwipe --- lib/olHelpers/layerSwipe.js | 9 +++++---- src/olHelpers/layerSwipe.js | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/olHelpers/layerSwipe.js b/lib/olHelpers/layerSwipe.js index 304e136..87ab688 100644 --- a/lib/olHelpers/layerSwipe.js +++ b/lib/olHelpers/layerSwipe.js @@ -27,13 +27,15 @@ var LayerSwipe = function () { /** * * @param {ol.Map} map - the map + * @param {string} [sliderContent=''] - additional html to be added inside the slider div */ - function LayerSwipe(map) { + function LayerSwipe(map, sliderContent) { var _this = this; _classCallCheck(this, LayerSwipe); + sliderContent = sliderContent || ''; /** * * @type {Array<LayerBase>} @@ -48,11 +50,10 @@ var LayerSwipe = function () { this._percentRight = 50; this.offset = null; - this.theTimeout = null; this._map = map; this.$mapElement = (0, _jquery2.default)(map.getTargetElement()); - this.$mapElement.append('<div class="layer-swiper"></div>'); + this.$mapElement.append('<div class="layer-swiper">' + sliderContent + '</div>'); this.$swiper = this.$mapElement.find('.layer-swiper'); this.percentRight = this.percentRight; @@ -140,7 +141,7 @@ var LayerSwipe = function () { ctx.restore(); }); - this.leftLayers.push(lyr); + this.rightLayers.push(lyr); } }, { key: 'percentRight', diff --git a/src/olHelpers/layerSwipe.js b/src/olHelpers/layerSwipe.js index a280ba6..2dcdd0a 100644 --- a/src/olHelpers/layerSwipe.js +++ b/src/olHelpers/layerSwipe.js @@ -14,9 +14,11 @@ class LayerSwipe { /** * * @param {ol.Map} map - the map + * @param {string} [sliderContent=''] - additional html to be added inside the slider div */ - constructor(map) { + constructor(map, sliderContent) { + sliderContent = sliderContent || ''; /** * * @type {Array<LayerBase>} @@ -31,11 +33,10 @@ class LayerSwipe { this._percentRight = 50; this.offset = null; - this.theTimeout = null; this._map = map; this.$mapElement = $(map.getTargetElement()); - this.$mapElement.append(`<div class="layer-swiper"></div>`); + this.$mapElement.append(`<div class="layer-swiper">${sliderContent}</div>`); this.$swiper = this.$mapElement.find('.layer-swiper'); @@ -116,7 +117,7 @@ class LayerSwipe { ctx.restore(); }); - this.leftLayers.push(lyr); + this.rightLayers.push(lyr); } get percentRight() { -- GitLab