@@ -312,22 +312,26 @@ export default class ElementGroup extends Element implements IElementGroup {
312
312
const yParrelSlopeLine = MathUtils . calcParrelLine ( ySlopLine , subsCenterCoord ) ;
313
313
// 计算过subsCenterCoord与xSlopeLine平行的直线
314
314
const xParrelSlopeLine = MathUtils . calcParrelLine ( xSlopeLine , subsCenterCoord ) ;
315
- // 计算最小平行四边形的左上角
316
- const topLeft = minParallelogramPoints . find (
317
- point => ! MathUtils . isPointClockwiseOfLine ( point , yParrelSlopeLine . start , yParrelSlopeLine . end ) && ! MathUtils . isPointClockwiseOfLine ( point , xParrelSlopeLine . start , xParrelSlopeLine . end ) ,
318
- ) ;
319
- // 计算最小平行四边形的右上角
320
- const topRight = minParallelogramPoints . find (
321
- point => MathUtils . isPointClockwiseOfLine ( point , yParrelSlopeLine . start , yParrelSlopeLine . end ) && ! MathUtils . isPointClockwiseOfLine ( point , xParrelSlopeLine . start , xParrelSlopeLine . end ) ,
322
- ) ;
323
- // 计算最小平行四边形的右下角
324
- const bottomRight = minParallelogramPoints . find (
325
- point => MathUtils . isPointClockwiseOfLine ( point , yParrelSlopeLine . start , yParrelSlopeLine . end ) && MathUtils . isPointClockwiseOfLine ( point , xParrelSlopeLine . start , xParrelSlopeLine . end ) ,
326
- ) ;
327
- // 计算最小平行四边形的左下角
328
- const bottomLeft = minParallelogramPoints . find (
329
- point => ! MathUtils . isPointClockwiseOfLine ( point , yParrelSlopeLine . start , yParrelSlopeLine . end ) && MathUtils . isPointClockwiseOfLine ( point , xParrelSlopeLine . start , xParrelSlopeLine . end ) ,
330
- ) ;
315
+ let topLeft : IPoint ;
316
+ let topRight : IPoint ;
317
+ let bottomRight : IPoint ;
318
+ let bottomLeft : IPoint ;
319
+ minParallelogramPoints . forEach ( point => {
320
+ const isPointClockwiseOfYSlopLine = MathUtils . isPointClockwiseOfLine ( point , yParrelSlopeLine . start , yParrelSlopeLine . end ) ;
321
+ const isPointClockwiseOfXSlopLine = MathUtils . isPointClockwiseOfLine ( point , xParrelSlopeLine . start , xParrelSlopeLine . end ) ;
322
+ if ( ! isPointClockwiseOfYSlopLine && ! isPointClockwiseOfXSlopLine ) {
323
+ topLeft = point ;
324
+ }
325
+ if ( isPointClockwiseOfYSlopLine && ! isPointClockwiseOfXSlopLine ) {
326
+ topRight = point ;
327
+ }
328
+ if ( isPointClockwiseOfYSlopLine && isPointClockwiseOfXSlopLine ) {
329
+ bottomRight = point ;
330
+ }
331
+ if ( ! isPointClockwiseOfYSlopLine && isPointClockwiseOfXSlopLine ) {
332
+ bottomLeft = point ;
333
+ }
334
+ } )
331
335
// 旋转倾斜后的盒模型坐标
332
336
const rotateBoxCoords = [ topLeft , topRight , bottomRight , bottomLeft ] ;
333
337
// 计算不旋转的盒模型坐标
0 commit comments