|
@@ -162,18 +162,18 @@ public class CropView extends View {
|
|
|
*/
|
|
*/
|
|
|
public void switchOrientation() {
|
|
public void switchOrientation() {
|
|
|
if (isLandscape) {
|
|
if (isLandscape) {
|
|
|
- coverWidth = getWidth();
|
|
|
|
|
|
|
+ coverWidth = getWidth() - getPaddingLeft() - getPaddingRight();
|
|
|
coverHeight = (int) (coverWidth/1.73);
|
|
coverHeight = (int) (coverWidth/1.73);
|
|
|
isLandscape = false;
|
|
isLandscape = false;
|
|
|
- sX = 0;
|
|
|
|
|
|
|
+ sX = getPaddingLeft();
|
|
|
sY = (getHeight()*1.0f-coverHeight)/2;
|
|
sY = (getHeight()*1.0f-coverHeight)/2;
|
|
|
mFrameRectF = new RectF(sX, sY, sX + coverWidth, sY + coverHeight);
|
|
mFrameRectF = new RectF(sX, sY, sX + coverWidth, sY + coverHeight);
|
|
|
} else {
|
|
} else {
|
|
|
- coverHeight = getHeight();
|
|
|
|
|
|
|
+ coverHeight = getHeight() - getPaddingTop() - getPaddingBottom();
|
|
|
coverWidth = (int) (coverHeight/1.73);
|
|
coverWidth = (int) (coverHeight/1.73);
|
|
|
isLandscape = true;
|
|
isLandscape = true;
|
|
|
sX = (getWidth()*1.0f-coverWidth)/2;
|
|
sX = (getWidth()*1.0f-coverWidth)/2;
|
|
|
- sY = 0;
|
|
|
|
|
|
|
+ sY = getPaddingTop();
|
|
|
mFrameRectF = new RectF(sX, sY, sX + coverWidth, sY + coverHeight);
|
|
mFrameRectF = new RectF(sX, sY, sX + coverWidth, sY + coverHeight);
|
|
|
}
|
|
}
|
|
|
// 起始位置
|
|
// 起始位置
|