@@ -48,14 +48,10 @@ export const getNewStyle = (type, rect, deltaW, deltaH, ratio, minWidth, minHeig
4848 if ( ratio ) {
4949 deltaH = deltaW / ratio
5050 height = width / ratio
51- // 左上角固定
52- centerX += deltaW / 2 * cos ( rotateAngle ) - deltaH / 2 * sin ( rotateAngle )
53- centerY += deltaW / 2 * sin ( rotateAngle ) + deltaH / 2 * cos ( rotateAngle )
54- } else {
55- // 左边固定
56- centerX += deltaW / 2 * cos ( rotateAngle )
57- centerY += deltaW / 2 * sin ( rotateAngle )
5851 }
52+ // 左边固定
53+ centerX += deltaW / 2 * cos ( rotateAngle )
54+ centerY += deltaW / 2 * sin ( rotateAngle )
5955 break
6056 }
6157 case 'tr' : {
@@ -106,14 +102,10 @@ export const getNewStyle = (type, rect, deltaW, deltaH, ratio, minWidth, minHeig
106102 if ( ratio ) {
107103 deltaW = deltaH * ratio
108104 width = height * ratio
109- // 左上角固定
110- centerX += deltaW / 2 * cos ( rotateAngle ) - deltaH / 2 * sin ( rotateAngle )
111- centerY += deltaW / 2 * sin ( rotateAngle ) + deltaH / 2 * cos ( rotateAngle )
112- } else {
113- // 上边固定
114- centerX -= deltaH / 2 * sin ( rotateAngle )
115- centerY += deltaH / 2 * cos ( rotateAngle )
116105 }
106+ // 上边固定
107+ centerX -= deltaH / 2 * sin ( rotateAngle )
108+ centerY += deltaH / 2 * cos ( rotateAngle )
117109 break
118110 }
119111 case 'bl' : {
@@ -145,14 +137,10 @@ export const getNewStyle = (type, rect, deltaW, deltaH, ratio, minWidth, minHeig
145137 if ( ratio ) {
146138 height = width / ratio
147139 deltaH = deltaW / ratio
148- // 右上角固定
149- centerX -= deltaW / 2 * cos ( rotateAngle ) + deltaH / 2 * sin ( rotateAngle )
150- centerY -= deltaW / 2 * sin ( rotateAngle ) - deltaH / 2 * cos ( rotateAngle )
151- } else {
152- // 右边固定
153- centerX -= deltaW / 2 * cos ( rotateAngle )
154- centerY -= deltaW / 2 * sin ( rotateAngle )
155140 }
141+ // 右边固定
142+ centerX -= deltaW / 2 * cos ( rotateAngle )
143+ centerY -= deltaW / 2 * sin ( rotateAngle )
156144 break
157145 }
158146 case 'tl' : {
@@ -185,13 +173,9 @@ export const getNewStyle = (type, rect, deltaW, deltaH, ratio, minWidth, minHeig
185173 if ( ratio ) {
186174 width = height * ratio
187175 deltaW = deltaH * ratio
188- // 左下角固定
189- centerX += deltaW / 2 * cos ( rotateAngle ) + deltaH / 2 * sin ( rotateAngle )
190- centerY += deltaW / 2 * sin ( rotateAngle ) - deltaH / 2 * cos ( rotateAngle )
191- } else {
192- centerX += deltaH / 2 * sin ( rotateAngle )
193- centerY -= deltaH / 2 * cos ( rotateAngle )
194176 }
177+ centerX += deltaH / 2 * sin ( rotateAngle )
178+ centerY -= deltaH / 2 * cos ( rotateAngle )
195179 break
196180 }
197181 }
0 commit comments