diff --git a/static/clicks.js b/static/clicks.js index 21308ae..52a2415 100644 --- a/static/clicks.js +++ b/static/clicks.js @@ -281,6 +281,40 @@ Clicks.prototype.buildUI_ = function() { 'key': '+', }, ], + [ + { + 'img': 'zoom-1x', + 'key': '!', + }, + { + 'img': 'zoom-15x', + 'key': '@', + }, + { + 'img': 'zoom-2x', + 'key': '#', + }, + { + 'img': 'zoom-25x', + 'key': '$', + }, + { + 'img': 'zoom-3x', + 'key': '%', + }, + { + 'img': 'zoom-35x', + 'key': '^', + }, + { + 'img': 'zoom-4x', + 'key': '&', + }, + { + 'img': 'zoom-45x', + 'key': '*', + }, + ], ], }, { @@ -540,6 +574,16 @@ Clicks.prototype.updateControls_ = function(e) { this.setButtonActive_('rate-125x', activeRate == 1.25); this.setButtonActive_('rate-15x', activeRate == 1.5); this.setButtonActive_('rate-2x', activeRate == 2.0); + + var zoomLevel = this.activePlayer_.getZoomLevel(); + this.setButtonActive_('zoom-1x', zoomLevel == 1.0); + this.setButtonActive_('zoom-15x', zoomLevel == 1.5); + this.setButtonActive_('zoom-2x', zoomLevel == 2.0); + this.setButtonActive_('zoom-25x', zoomLevel == 2.5); + this.setButtonActive_('zoom-3x', zoomLevel == 3.0); + this.setButtonActive_('zoom-35x', zoomLevel == 3.5); + this.setButtonActive_('zoom-4x', zoomLevel == 4.0); + this.setButtonActive_('zoom-45x', zoomLevel == 4.5); }; @@ -841,15 +885,14 @@ ClicksVideo.prototype.getZoomLevel = function() { }; -ClicksVideo.prototype.zoom = function(zoomLevel) { +ClicksVideo.prototype.fixZoom_ = function() { var zoomLevels = this.zoomLevels_(); - this.zoomLevel_ = zoomLevels[zoomLevels.length - 1]; - for (var i = 0; i < zoomLevels.length; i++) { - if (zoomLevels[i] >= zoomLevel) { - this.zoomLevel_ = zoomLevels[i]; - break; - } - } + this.zoomLevel_ = Math.min(this.zoomLevel_, zoomLevels[zoomLevels.length - 1]); +} + + +ClicksVideo.prototype.zoom = function(zoomLevel) { + this.zoomLevel_ = zoomLevel; this.resize(); }; @@ -883,6 +926,7 @@ ClicksVideo.prototype.actualZoomLevel_ = function(zoomLevel) { ClicksVideo.prototype.resize = function() { + this.fixZoom_(); zoom = Math.min(this.actualZoomLevel_(this.zoomLevel_), 1.0); this.playerScale_.style.transform = [ 'scale(' + zoom + ',' + zoom + ')', diff --git a/static/images/zoom-15x.svg b/static/images/zoom-15x.svg new file mode 100644 index 0000000..f7ddb56 --- /dev/null +++ b/static/images/zoom-15x.svg @@ -0,0 +1,16 @@ + + + + + +1.5x + + diff --git a/static/images/zoom-1x.svg b/static/images/zoom-1x.svg new file mode 100644 index 0000000..b4026b6 --- /dev/null +++ b/static/images/zoom-1x.svg @@ -0,0 +1,16 @@ + + + + + +1.0x + + diff --git a/static/images/zoom-25x.svg b/static/images/zoom-25x.svg new file mode 100644 index 0000000..ce0e0b1 --- /dev/null +++ b/static/images/zoom-25x.svg @@ -0,0 +1,16 @@ + + + + + +2.5x + + diff --git a/static/images/zoom-2x.svg b/static/images/zoom-2x.svg new file mode 100644 index 0000000..39f850a --- /dev/null +++ b/static/images/zoom-2x.svg @@ -0,0 +1,16 @@ + + + + + +2.0x + + diff --git a/static/images/zoom-35x.svg b/static/images/zoom-35x.svg new file mode 100644 index 0000000..4ebc43e --- /dev/null +++ b/static/images/zoom-35x.svg @@ -0,0 +1,16 @@ + + + + + +3.5x + + diff --git a/static/images/zoom-3x.svg b/static/images/zoom-3x.svg new file mode 100644 index 0000000..7fd1445 --- /dev/null +++ b/static/images/zoom-3x.svg @@ -0,0 +1,16 @@ + + + + + +3.0x + + diff --git a/static/images/zoom-45x.svg b/static/images/zoom-45x.svg new file mode 100644 index 0000000..88ef12a --- /dev/null +++ b/static/images/zoom-45x.svg @@ -0,0 +1,16 @@ + + + + + +4.5x + + diff --git a/static/images/zoom-4x.svg b/static/images/zoom-4x.svg new file mode 100644 index 0000000..a523141 --- /dev/null +++ b/static/images/zoom-4x.svg @@ -0,0 +1,16 @@ + + + + + +4.0x + +