@@ -15,22 +15,28 @@ export default class TopRail extends SVGComponent<TopRailProps> {
1515 const trackWidth = this . props . table . trackWidth ;
1616 const holeSize = this . props . table . holeSize ;
1717 const material = this . props . table . material ;
18+ const xSparGap = this . props . table . xSparGap ;
1819 const buffer = length > maxLength ? material / 2 : 0 ;
1920 let [ yFrontSetback , yFrontFirstX , yFrontSecondX ] = this . props . table . frontHoleCoordinates ;
2021 let [ yBackFirstSetback , yBackSecondSetback , yBackFirstX , yBackSecondX ] = this . props . table . backHoleCoordinates ;
2122
2223 let pathstr = `M 0 0`
2324
2425 if ( length > maxLength ) {
25- pathstr += `L ${ maxLength } 0`
26- pathstr += `L ${ maxLength } ${ trackWidth } `
26+ let firstLength = maxLength ;
27+ const safeCutPoint = xSparGap + ( 4 * material ) + sparInset ;
28+ if ( length - firstLength < safeCutPoint ) {
29+ firstLength = length - safeCutPoint ;
30+ }
31+ pathstr += `L ${ firstLength } 0`
32+ pathstr += `L ${ firstLength } ${ trackWidth } `
2733 pathstr += `L 0 ${ trackWidth } `
2834 pathstr += 'z'
2935
30- pathstr += `M ${ maxLength + buffer } 0`
36+ pathstr += `M ${ firstLength + buffer } 0`
3137 pathstr += `L ${ length + buffer } 0`
3238 pathstr += `L ${ length + buffer } ${ trackWidth } `
33- pathstr += `L ${ maxLength + buffer } ${ trackWidth } `
39+ pathstr += `L ${ firstLength + buffer } ${ trackWidth } `
3440 pathstr += 'z'
3541
3642 pathstr += `M ${ sparInset } ${ trackWidth * 0.25 } ` ;
0 commit comments