@@ -41,7 +41,8 @@ angular
41
41
}
42
42
template += '<li class="dropdown-header" ng-mouseover="toggleBrand(' + i + ')">' + brands [ i ] . name + '</li>' ;
43
43
for ( var j in brands [ i ] . devices ) {
44
- template += '<li ng-show="openStatus[' + i + ']"><a href="javascript: void(0);" ng-click="$parent.resizeTo(' + brands [ i ] . devices [ j ] . w + ', ' + brands [ i ] . devices [ j ] . h + ')">' + brands [ i ] . devices [ j ] . name ;
44
+ var pixelDestiny = brands [ i ] . devices [ j ] . pxd ? brands [ i ] . devices [ j ] . pxd : 1 ;
45
+ template += '<li ng-show="openStatus[' + i + ']"><a href="javascript: void(0);" ng-click="$parent.resizeTo(' + brands [ i ] . devices [ j ] . w + ', ' + brands [ i ] . devices [ j ] . h + ', ' + pixelDestiny + ')">' + brands [ i ] . devices [ j ] . name ;
45
46
46
47
if ( brands [ i ] . devices [ j ] . inch ) {
47
48
template += ' <small></small><span>' + brands [ i ] . devices [ j ] . inch + '"</span>' ;
@@ -64,8 +65,8 @@ angular
64
65
var parent = $scope . $parent ;
65
66
$element . resizable ( {
66
67
resize : function ( event , ui ) {
67
- $scope . w = ui . size . width ;
68
- $scope . h = ui . size . height ;
68
+ $scope . w = ui . size . width * $scope . pxd ;
69
+ $scope . h = ui . size . height * $scope . pxd ;
69
70
parent . $apply ( ) ;
70
71
}
71
72
} ) ;
@@ -105,6 +106,10 @@ angular
105
106
$scope . loading = true ;
106
107
$scope . w = 1024 ;
107
108
$scope . h = 768 ;
109
+
110
+ // Pixel destiny
111
+ // See http://screensiz.es
112
+ $scope . pxd = 1 ;
108
113
$scope . url = null ;
109
114
$scope . frameSrc = null ;
110
115
@@ -125,6 +130,7 @@ angular
125
130
$scope . url = array [ 0 ] ;
126
131
$scope . w = array [ 1 ] ;
127
132
$scope . h = array [ 2 ] ;
133
+ $scope . pxd = array . length > 3 ? array [ 3 ] : 1 ;
128
134
}
129
135
} else {
130
136
// Get the random URL
@@ -157,10 +163,12 @@ angular
157
163
* Switch to given size
158
164
* @param {int } width
159
165
* @param {int } height
166
+ * @param {int } pixelDestiny
160
167
*/
161
- $scope . resizeTo = function ( width , height ) {
162
- $scope . w = width ;
163
- $scope . h = height ;
168
+ $scope . resizeTo = function ( width , height , pixelDestiny ) {
169
+ $scope . w = width ;
170
+ $scope . h = height ;
171
+ $scope . pxd = pixelDestiny ;
164
172
} ;
165
173
166
174
/**
@@ -194,7 +202,7 @@ angular
194
202
$scope . updateHash = function ( ) {
195
203
if ( $scope . w && $scope . h && $scope . url ) {
196
204
// Update the location hash
197
- window . location . hash = '#u=' + [ $scope . url , $scope . w , $scope . h ] . join ( '|' ) ;
205
+ window . location . hash = '#u=' + [ $scope . url , $scope . w , $scope . h , $scope . pxd ] . join ( '|' ) ;
198
206
}
199
207
} ;
200
208
} ) ;
0 commit comments