@@ -505,8 +505,7 @@ void main(void) {
505505 } else {
506506 offsetPx += halfSizePx * vec2(-1., 1.);
507507 }
508- float angle = ${ this . symbolRotationExpression_ } ;
509- ${ this . symbolRotateWithView_ ? 'angle += u_rotation;' : '' }
508+ float angle = ${ this . symbolRotationExpression_ } ${ this . symbolRotateWithView_ ? ' + u_rotation' : '' } ;
510509 float c = cos(-angle);
511510 float s = sin(-angle);
512511 offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);
@@ -520,7 +519,7 @@ void main(void) {
520519 v_angle = angle;
521520 c = cos(-v_angle);
522521 s = sin(-v_angle);
523- centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);
522+ centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);
524523 v_centerPx = screenToPx(center.xy) + centerOffsetPx;
525524${ this . attributes_
526525 . map (
@@ -662,7 +661,7 @@ void main(void) {
662661 vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);
663662 segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),
664663 segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);
665-
664+
666665 // compute current vertex position
667666 float normalDir = vertexNumber < 0.5 || (vertexNumber > 1.5 && vertexNumber < 2.5) ? 1.0 : -1.0;
668667 float tangentDir = vertexNumber < 1.5 ? 1.0 : -1.0;
@@ -820,7 +819,7 @@ ${this.attributes_
820819 ` ${ attribute . varyingType } ${ attribute . name } = ${ attribute . varyingName } ; // assign to original attribute name` ,
821820 )
822821 . join ( '\n' ) }
823-
822+
824823 vec2 currentPoint = gl_FragCoord.xy / u_pixelRatio;
825824 #ifdef GL_FRAGMENT_PRECISION_HIGH
826825 vec2 worldPos = pxToWorld(currentPoint);
@@ -844,7 +843,11 @@ ${this.attributes_
844843 float currentLengthPx = lengthToPoint + v_distanceOffsetPx;
845844 float currentRadiusPx = distanceFromSegment(currentPoint, v_segmentStart, v_segmentEnd);
846845 float currentRadiusRatio = dot(segmentNormal, startToPoint) * 2. / v_width;
847- currentLineMetric = mix(v_measureStart, v_measureEnd, lengthToPoint / segmentLength);
846+ currentLineMetric = mix(
847+ v_measureStart,
848+ v_measureEnd,
849+ lengthToPoint / max(segmentLength, 1.17549429e-38)
850+ );
848851
849852 if (${ this . discardExpression_ } ) { discard; }
850853
0 commit comments