From 1a28edcbf9b0c46fbab9bcc9fff0b065349f8f24 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Tue, 15 Jul 2014 11:24:15 +0200 Subject: [PATCH 1/1] =?utf8?q?taquet=20de=20glissement=20=C3=A0=20gauche.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- skins/photo_film_viewer.js | 57 +++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/skins/photo_film_viewer.js b/skins/photo_film_viewer.js index ff8d61e..566984a 100644 --- a/skins/photo_film_viewer.js +++ b/skins/photo_film_viewer.js @@ -83,33 +83,33 @@ FilmSlider = function(filmBar, slider, ctxInfos, image, toolbar, breadcrumbs) { }; if (!browser.isMobile) { -FilmSlider.prototype.resizeSlider = function(evt) { - var filmBarWidth = this.filmBarWidth; - if (!filmBarWidth) { return; } - var filmWidth = this.slideSize * this.filmLength; - var sliderRatio = this.sliderRatio = filmBarWidth / filmWidth; - var sliderWidth = filmBarWidth * sliderRatio; - this.rail.style.width = filmBarWidth + 'px'; - this.rail.style.display = 'block'; - this.rail.style.visibility = 'visible'; - if (sliderRatio < 1) { - this.slider.style.width = Math.round(sliderWidth) + 'px'; - this.slider.style.visibility = 'visible'; - } - else { - this.slider.style.visibility = 'hidden'; - } + FilmSlider.prototype.resizeSlider = function(evt) { + var filmBarWidth = this.filmBarWidth; + if (!filmBarWidth) { return; } + var filmWidth = this.slideSize * this.filmLength; + var sliderRatio = this.sliderRatio = filmBarWidth / filmWidth; + var sliderWidth = filmBarWidth * sliderRatio; + this.rail.style.width = filmBarWidth + 'px'; + this.rail.style.display = 'block'; + this.rail.style.visibility = 'visible'; + if (sliderRatio < 1) { + this.slider.style.width = Math.round(sliderWidth) + 'px'; + this.slider.style.visibility = 'visible'; + } + else { + this.slider.style.visibility = 'hidden'; + } - this.winSize = {'width' : getWindowWidth(), - 'height' : getWindowHeight()}; - this.maxRightPosition = filmBarWidth - sliderWidth; - this.sliderSpeedRatio = - (filmBarWidth - sliderWidth) / (filmWidth - filmBarWidth); - if (!this.initialized) { - this.centerSlide(this.center); - this.selectedSlide = this.filmBar.getElementsByTagName('img')[this.center].parentNode; - this.initialized = true; - } -}; + this.winSize = {'width' : getWindowWidth(), + 'height' : getWindowHeight()}; + this.maxRightPosition = filmBarWidth - sliderWidth; + this.sliderSpeedRatio = - (filmBarWidth - sliderWidth) / (filmWidth - filmBarWidth); + if (!this.initialized) { + this.centerSlide(this.center); + this.selectedSlide = this.filmBar.getElementsByTagName('img')[this.center].parentNode; + this.initialized = true; + } + }; } else { @@ -160,7 +160,7 @@ FilmSlider.prototype.fitToScreen = function(evt) { FilmSlider.prototype._fitToScreen = function(evt) { var wh = getWindowHeight(); if (!browser.isMobile) { - var rb = getObjectTop(this.rail) + getObjectHeight(this.rail); // rail bottom + var rb = getObjectTop(this.rail) + getObjectHeight(this.rail); // rail bottom } else { var rb = getObjectTop(this.filmBar) + getObjectHeight(this.filmBar); // film bottom @@ -592,7 +592,8 @@ FilmSlider.prototype.touchStartHandler = function(evt) { FilmSlider.prototype.touchMoveHandler = function(evt) { var delta = this.touchStartX - evt.pageX; - this.film.style.left = String(this.filmStartX - delta) + 'px'; + var posX = Math.min(0, this.filmStartX - delta); + this.film.style.left = String(posX) + 'px'; }; FilmSlider.prototype.touchEndHandler = function(evt) { -- 2.20.1