Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -156,7 +156,10 @@ |
157 | 157 | 'default_provider': null, |
158 | 158 | |
159 | 159 | // The timeout for search providers ( in seconds ) |
160 | | - 'search_provider_timeout': 10 |
| 160 | + 'search_provider_timeout': 10, |
| 161 | + |
| 162 | + // Default edit image width |
| 163 | + 'defaultEditImageWidth' : 400 |
161 | 164 | }; |
162 | 165 | |
163 | 166 | /** |
— | — | @@ -421,10 +424,10 @@ |
422 | 425 | thumb_width: 80, |
423 | 426 | |
424 | 427 | // The width of an image when editing |
425 | | - image_edit_width: 400, |
| 428 | + defaultImageEditWidth: 400, |
426 | 429 | |
427 | 430 | // The width of the video embed while editing the resource |
428 | | - video_edit_width: 400, |
| 431 | + defaultVideoEditWidth: 400, |
429 | 432 | |
430 | 433 | // The insert position of the asset (overwritten by cursor position) |
431 | 434 | insert_text_pos: 0, |
— | — | @@ -1959,12 +1962,12 @@ |
1960 | 1963 | * |
1961 | 1964 | * @param {Object} resource get width of resource |
1962 | 1965 | */ |
1963 | | - getMaxEditWidth: function( resource ) { |
| 1966 | + getDefaultEditWidth: function( resource ) { |
1964 | 1967 | var mediaType = this.getMediaType( resource ); |
1965 | 1968 | if ( mediaType == 'image' ) { |
1966 | | - return this.image_edit_width; |
| 1969 | + return this.defaultImageEditWidth; |
1967 | 1970 | } else { |
1968 | | - return this.video_edit_width; |
| 1971 | + return this.defaultVideoEditWidth; |
1969 | 1972 | } |
1970 | 1973 | }, |
1971 | 1974 | |
— | — | @@ -2011,23 +2014,17 @@ |
2012 | 2015 | mw.log("done adding resource editor"); |
2013 | 2016 | |
2014 | 2017 | var mediaType = _this.getMediaType( resource ); |
2015 | | - var width = _this.getMaxEditWidth( resource ); |
| 2018 | + var width = _this.getDefaultEditWidth( resource ); |
2016 | 2019 | |
2017 | | - // if maxWidth makes height > available height resize request: |
2018 | | - |
2019 | | - var width = resource.width; |
2020 | | - var height = parseInt( width * ( resource.width / resource.height ) ); |
2021 | | - |
2022 | | - // Update the resource size constrained by clip_edit_disp |
2023 | | - if( width > $j('#clip_edit_disp').width() ){ |
2024 | | - width = $j('#clip_edit_disp').width(); |
2025 | | - height = parseInt( width * ( height / width ) ); |
2026 | | - } |
| 2020 | + var height = parseInt( width * ( resource.height / resource.width ) ); |
| 2021 | + |
2027 | 2022 | if( height > $j('#clip_edit_disp').height() ){ |
2028 | 2023 | height = $j('#clip_edit_disp').height(); |
2029 | | - width = height * ( width / height ); |
| 2024 | + width = height * ( resource.width / resource.height); |
2030 | 2025 | } |
2031 | 2026 | |
| 2027 | + //mw.log("org h/w" + resource.width + ' / ' + resource.height +' new w' + width + ' new h:' + height ); |
| 2028 | + |
2032 | 2029 | // Update add media wizard title: |
2033 | 2030 | var dialogTitle = gM( 'mwe-add_media_wizard' ) + ': ' + |
2034 | 2031 | gM( 'rsd_resource_edit', resource.title ); |