File tree Expand file tree Collapse file tree 2 files changed +33
-12
lines changed
app/code/Magento/Ui/view/base/web/js/grid Expand file tree Collapse file tree 2 files changed +33
-12
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ define([
28
28
listens : {
29
29
'${ $.provider }:params.filters' : 'hide' ,
30
30
'${ $.provider }:params.search' : 'hide'
31
+ } ,
32
+ exports : {
33
+ height : '${ $.parentName }.thumbnail_url:previewHeight'
31
34
}
32
35
} ,
33
36
@@ -43,9 +46,6 @@ define([
43
46
'displayedRecord' ,
44
47
'lastOpenedImage'
45
48
] ) ;
46
- this . height . subscribe ( function ( ) {
47
- this . thumbnailComponent ( ) . previewHeight ( this . height ( ) ) ;
48
- } , this ) ;
49
49
50
50
return this ;
51
51
} ,
Original file line number Diff line number Diff line change @@ -48,7 +48,26 @@ define([
48
48
* Maximum image height value
49
49
* @param int
50
50
*/
51
- maxImageHeight : 240
51
+ maxImageHeight : 240 ,
52
+
53
+ /**
54
+ * The value is minimum image width to height ratio when container width is less than the key
55
+ *
56
+ * @param int
57
+ */
58
+ containerWidthToMinRatio : {
59
+ 640 : 3 ,
60
+ 1280 : 5 ,
61
+ 1920 : 8
62
+ } ,
63
+
64
+ /**
65
+ * Default minimal image width to height ratio.
66
+ * Applied when container width is greater than max width in the containerWidthToMinRatio matrix.
67
+ *
68
+ * @param int
69
+ */
70
+ defaultMinRatio : 10
52
71
} ,
53
72
54
73
/**
@@ -229,15 +248,17 @@ define([
229
248
* Set min ratio for images in layout
230
249
*/
231
250
setMinRatio : function ( ) {
232
- if ( this . containerWidth <= 640 ) {
233
- this . minRatio = 3 ;
234
- } else if ( this . containerWidth <= 1280 ) {
235
- this . minRatio = 5 ;
236
- } else if ( this . containerWidth <= 1920 ) {
237
- this . minRatio = 8 ;
238
- } else {
239
- this . minRatio = 10 ;
251
+ var minRatio = null ;
252
+
253
+ for ( var width in this . containerWidthToMinRatio ) {
254
+ if ( this . containerWidthToMinRatio . hasOwnProperty ( width ) &&
255
+ this . containerWidth <= width
256
+ ) {
257
+ minRatio = this . containerWidthToMinRatio [ width ]
258
+ }
240
259
}
260
+
261
+ this . minRatio = minRatio ? minRatio : this . defaultMinRatio ;
241
262
} ,
242
263
243
264
/**
You can’t perform that action at this time.
0 commit comments