Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #18134 from justindarc/bug993043
Browse files Browse the repository at this point in the history
Bug 993043 - [Camera][Buri] viewfinder stays zoomed in and doesn't resto...
  • Loading branch information
justindarc authored and rvandermeulen committed Apr 11, 2014
1 parent aa67c97 commit 18fec67
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
9 changes: 9 additions & 0 deletions apps/camera/js/controllers/camera.js
Expand Up @@ -64,6 +64,7 @@ CameraController.prototype.bindEvents = function() {
app.on('blur', this.onBlur);
app.on('settings:configured', this.onSettingsConfigured);
app.on('change:batteryStatus', this.onBatteryStatusChange);
app.on('previewgallery:opened', this.onPreviewGalleryOpened);

// Settings
settings.recorderProfiles.on('change:selected', this.onRecorderProfileChange);
Expand Down Expand Up @@ -335,4 +336,12 @@ CameraController.prototype.onStorageStateChange = function(value) {
}
};

/**
* Resets the camera zoom when the preview gallery
* is opened.
*/
CameraController.prototype.onPreviewGalleryOpened = function() {
this.camera.configureZoom(this.camera.previewSize());
};

});
5 changes: 5 additions & 0 deletions apps/camera/js/controllers/zoom-bar.js
Expand Up @@ -32,6 +32,7 @@ function ZoomBarController(app) {

ZoomBarController.prototype.bindEvents = function() {
this.zoomBar.on('change', this.onChange);
this.camera.on('zoomconfigured', this.onZoomConfigured);
this.camera.on('zoomchanged', this.onZoomChanged);
this.viewfinder.on('pinchStart', this.onPinchStart);
this.viewfinder.on('pinchEnd', this.onPinchEnd);
Expand All @@ -45,6 +46,10 @@ ZoomBarController.prototype.onChange = function(value) {
this.camera.setZoom(zoom);
};

ZoomBarController.prototype.onZoomConfigured = function() {
this.zoomBar.hide();
};

ZoomBarController.prototype.onZoomChanged = function(zoom) {
var minimumZoom = this.camera.getMinimumZoom();
var maximumZoom = this.camera.getMaximumZoom();
Expand Down
3 changes: 3 additions & 0 deletions apps/camera/js/lib/camera.js
Expand Up @@ -870,6 +870,9 @@ Camera.prototype.configureZoom = function(previewSize) {
}
}
};

this.setZoom(this.getMinimumZoom());
this.emit('zoomconfigured');
};

Camera.prototype.getMinimumZoom = function() {
Expand Down
12 changes: 10 additions & 2 deletions apps/camera/js/views/zoom-bar.js
Expand Up @@ -192,12 +192,20 @@ module.exports = View.extend({
resetInactivityTimeout: function() {
window.clearTimeout(this._inactivityTimeout);

this.el.classList.add('zooming');
this.show();

var self = this;
this._inactivityTimeout = window.setTimeout(function() {
self.el.classList.remove('zooming');
self.hide();
}, constants.ZOOM_BAR_INACTIVITY_TIMEOUT);
},

show: function() {
this.el.classList.add('zooming');
},

hide: function() {
this.el.classList.remove('zooming');
}
});

Expand Down

0 comments on commit 18fec67

Please sign in to comment.