Rip out the complex zoom limiting, allow all levels at all window sizes.
This commit is contained in:
@@ -866,18 +866,17 @@ var ClicksVideo = function(youTubeAPIKey, id, container, onReady) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ClicksVideo.prototype.zoomLevels_ = function() {
|
// Hardcoded to match UI.
|
||||||
var ret = [];
|
ClicksVideo.zoomLevels_ = [
|
||||||
var zoom = 1.0;
|
1.0,
|
||||||
while (true) {
|
1.5,
|
||||||
ret.push(zoom);
|
2.0,
|
||||||
if (this.actualZoomLevel_(zoom) >= 1.0) {
|
2.5,
|
||||||
break;
|
3.0,
|
||||||
}
|
3.5,
|
||||||
zoom += 0.5;
|
4.0,
|
||||||
}
|
4.5,
|
||||||
return ret;
|
];
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ClicksVideo.prototype.getZoomLevel = function() {
|
ClicksVideo.prototype.getZoomLevel = function() {
|
||||||
@@ -885,12 +884,6 @@ ClicksVideo.prototype.getZoomLevel = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ClicksVideo.prototype.fixZoom_ = function() {
|
|
||||||
var zoomLevels = this.zoomLevels_();
|
|
||||||
this.zoomLevel_ = Math.min(this.zoomLevel_, zoomLevels[zoomLevels.length - 1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ClicksVideo.prototype.zoom = function(zoomLevel) {
|
ClicksVideo.prototype.zoom = function(zoomLevel) {
|
||||||
this.zoomLevel_ = zoomLevel;
|
this.zoomLevel_ = zoomLevel;
|
||||||
this.resize();
|
this.resize();
|
||||||
@@ -898,16 +891,14 @@ ClicksVideo.prototype.zoom = function(zoomLevel) {
|
|||||||
|
|
||||||
|
|
||||||
ClicksVideo.prototype.zoomOut = function() {
|
ClicksVideo.prototype.zoomOut = function() {
|
||||||
var zoomLevels = this.zoomLevels_();
|
var i = ClicksVideo.zoomLevels_.indexOf(this.zoomLevel_);
|
||||||
var i = zoomLevels.indexOf(this.zoomLevel_);
|
this.zoom(ClicksVideo.zoomLevels_[i - 1] || this.zoomLevel_);
|
||||||
this.zoom(zoomLevels[i - 1] || this.zoomLevel_);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ClicksVideo.prototype.zoomIn = function() {
|
ClicksVideo.prototype.zoomIn = function() {
|
||||||
var zoomLevels = this.zoomLevels_();
|
var i = ClicksVideo.zoomLevels_.indexOf(this.zoomLevel_);
|
||||||
var i = zoomLevels.indexOf(this.zoomLevel_);
|
this.zoom(ClicksVideo.zoomLevels_[i + 1] || this.zoomLevel_);
|
||||||
this.zoom(zoomLevels[i + 1] || this.zoomLevel_);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -917,17 +908,11 @@ ClicksVideo.prototype.unhide = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ClicksVideo.prototype.actualZoomLevel_ = function(zoomLevel) {
|
ClicksVideo.prototype.resize = function() {
|
||||||
var zoom = Math.min(
|
var zoom = Math.min(
|
||||||
this.container_.clientWidth / this.videoRes[0],
|
this.container_.clientWidth / this.videoRes[0],
|
||||||
this.container_.clientHeight / this.videoRes[1]);
|
this.container_.clientHeight / this.videoRes[1]);
|
||||||
return zoom * zoomLevel;
|
zoom *= this.zoomLevel_;
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ClicksVideo.prototype.resize = function() {
|
|
||||||
this.fixZoom_();
|
|
||||||
zoom = Math.min(this.actualZoomLevel_(this.zoomLevel_), 1.0);
|
|
||||||
this.playerScale_.style.transform = [
|
this.playerScale_.style.transform = [
|
||||||
'scale(' + zoom + ',' + zoom + ')',
|
'scale(' + zoom + ',' + zoom + ')',
|
||||||
].join(' ');
|
].join(' ');
|
||||||
|
|||||||
Reference in New Issue
Block a user