Replaced screenshot Zoom UI with input range along with buttons.

This commit is contained in:
Gunther Brunner
2014-05-27 15:48:34 +09:00
parent 9ec7d8c366
commit 6432a5651c
4 changed files with 56 additions and 41 deletions

View File

@@ -1,36 +1,37 @@
module.exports = function ScreenshotsCtrl($scope, SettingsService) {
$scope.screenshots = []
$scope.shotSize = 'small'
$scope.shotSizeRange = 200
$scope.clear = function () {
$scope.screenshots = []
}
SettingsService.bind($scope, {
key: 'shotSize'
, storeName: 'ScreenShots.shotSize'
})
// SettingsService.bind($scope, {
// key: 'shotSize', storeName: 'ScreenShots.shotSize'
// })
$scope.shotSizeUrlParameter = function () {
var sizes = {
'small': '?crop=100x',
'medium': '?crop=320x',
'large': '?crop=450x',
'original': ''
}
return sizes[$scope.shotSize]
$scope.shotSizeUrlParameter = function (maxSize) {
return ($scope.shotSizeRange === maxSize) ? '' :
'?crop=' + $scope.shotSizeRange + 'x'
}
$scope.takeScreenShot = function () {
$scope.control.screenshot().then(function(result) {
$scope.$apply(function() {
$scope.control.screenshot().then(function (result) {
$scope.$apply(function () {
$scope.screenshots.unshift(result)
})
})
}
$scope.imageLoaded = function (shot) {
shot.ready = true
console.log('[called')
$scope.zoom = function (param) {
var newValue = parseInt($scope.shotSizeRange, 10) + param.step
if (param.min && newValue < param.min) {
newValue = param.min
} else
if (param.max && newValue > param.max) {
newValue = param.max
}
$scope.shotSizeRange = newValue
}
}