Skip to content
Snippets Groups Projects
Commit b02a30ca authored by Glenn Vorhes's avatar Glenn Vorhes
Browse files

add additonal slider content param to LayerSwipe

parent fdb50a47
No related branches found
No related tags found
No related merge requests found
...@@ -27,13 +27,15 @@ var LayerSwipe = function () { ...@@ -27,13 +27,15 @@ var LayerSwipe = function () {
/** /**
* *
* @param {ol.Map} map - the map * @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; var _this = this;
_classCallCheck(this, LayerSwipe); _classCallCheck(this, LayerSwipe);
sliderContent = sliderContent || '';
/** /**
* *
* @type {Array<LayerBase>} * @type {Array<LayerBase>}
...@@ -48,11 +50,10 @@ var LayerSwipe = function () { ...@@ -48,11 +50,10 @@ var LayerSwipe = function () {
this._percentRight = 50; this._percentRight = 50;
this.offset = null; this.offset = null;
this.theTimeout = null;
this._map = map; this._map = map;
this.$mapElement = (0, _jquery2.default)(map.getTargetElement()); 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.$swiper = this.$mapElement.find('.layer-swiper');
this.percentRight = this.percentRight; this.percentRight = this.percentRight;
...@@ -140,7 +141,7 @@ var LayerSwipe = function () { ...@@ -140,7 +141,7 @@ var LayerSwipe = function () {
ctx.restore(); ctx.restore();
}); });
this.leftLayers.push(lyr); this.rightLayers.push(lyr);
} }
}, { }, {
key: 'percentRight', key: 'percentRight',
......
...@@ -14,9 +14,11 @@ class LayerSwipe { ...@@ -14,9 +14,11 @@ class LayerSwipe {
/** /**
* *
* @param {ol.Map} map - the map * @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>} * @type {Array<LayerBase>}
...@@ -31,11 +33,10 @@ class LayerSwipe { ...@@ -31,11 +33,10 @@ class LayerSwipe {
this._percentRight = 50; this._percentRight = 50;
this.offset = null; this.offset = null;
this.theTimeout = null;
this._map = map; this._map = map;
this.$mapElement = $(map.getTargetElement()); 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'); this.$swiper = this.$mapElement.find('.layer-swiper');
...@@ -116,7 +117,7 @@ class LayerSwipe { ...@@ -116,7 +117,7 @@ class LayerSwipe {
ctx.restore(); ctx.restore();
}); });
this.leftLayers.push(lyr); this.rightLayers.push(lyr);
} }
get percentRight() { get percentRight() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment