mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
Replaced screenshot Zoom UI with input range along with buttons.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user