Changeset 37167
- Timestamp:
- 04/08/2016 01:22:06 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r37152 r37167 2098 2098 yInit = parseInt( control.params.height, 10 ), 2099 2099 ratio = xInit / yInit, 2100 xImg = realWidth,2101 yImg = realHeight,2100 xImg = xInit, 2101 yImg = yInit, 2102 2102 x1, y1, imgSelectOptions; 2103 2103 2104 2104 controller.set( 'canSkipCrop', ! control.mustBeCropped( flexWidth, flexHeight, xInit, yInit, realWidth, realHeight ) ); 2105 2105 2106 if ( xImg / yImg> ratio ) {2107 yInit = yImg;2106 if ( realWidth / realHeight > ratio ) { 2107 yInit = realHeight; 2108 2108 xInit = yInit * ratio; 2109 2109 } else { 2110 xInit = xImg;2110 xInit = realWidth; 2111 2111 yInit = xInit / ratio; 2112 2112 } 2113 2113 2114 x1 = ( xImg- xInit ) / 2;2115 y1 = ( yImg- yInit ) / 2;2114 x1 = ( realWidth - xInit ) / 2; 2115 y1 = ( realHeight - yInit ) / 2; 2116 2116 2117 2117 imgSelectOptions = { … … 2122 2122 imageWidth: realWidth, 2123 2123 imageHeight: realHeight, 2124 minWidth: xImg > xInit ? xInit : xImg, 2125 minHeight: yImg > yInit ? yInit : yImg, 2124 2126 x1: x1, 2125 2127 y1: y1, … … 2131 2133 imgSelectOptions.aspectRatio = xInit + ':' + yInit; 2132 2134 } 2133 if ( flexHeight === false ) { 2134 imgSelectOptions.maxHeight = yInit; 2135 } 2136 if ( flexWidth === false ) { 2137 imgSelectOptions.maxWidth = xInit; 2135 2136 if ( true === flexHeight ) { 2137 delete imgSelectOptions.minHeight; 2138 imgSelectOptions.maxWidth = realWidth; 2139 } 2140 2141 if ( true === flexWidth ) { 2142 delete imgSelectOptions.minWidth; 2143 imgSelectOptions.maxHeight = realHeight; 2138 2144 } 2139 2145
Note: See TracChangeset
for help on using the changeset viewer.