File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -625,7 +625,7 @@ function _getPolygonCentroid (
625625 const offset = graphicIndex [ annotationIndex ] - 1
626626 let length
627627 if ( annotationIndex < ( numberOfAnnotations - 1 ) ) {
628- length = offset - graphicIndex [ annotationIndex + 1 ]
628+ length = graphicIndex [ annotationIndex + 1 ] - offset
629629 } else {
630630 length = graphicData . length
631631 }
@@ -635,10 +635,11 @@ function _getPolygonCentroid (
635635 for ( let j = offset ; j < offset + length ; j ++ ) {
636636 const p0 = _getCoordinates ( graphicData , j , commonZCoordinate )
637637 let p1
638- if ( j === ( offset + length - numberOfAnnotations ) ) {
638+ if ( j === ( offset + length - 1 ) ) {
639639 p1 = _getCoordinates ( graphicData , offset , commonZCoordinate )
640640 } else {
641- p1 = _getCoordinates ( graphicData , j + numberOfAnnotations , commonZCoordinate )
641+ const nextOffset = j + coordinateDimensionality
642+ p1 = _getCoordinates ( graphicData , nextOffset , commonZCoordinate )
642643 }
643644 const a = p0 [ 0 ] * p1 [ 1 ] - p1 [ 0 ] * p0 [ 1 ]
644645 area += a
You can’t perform that action at this time.
0 commit comments