@@ -147,6 +147,7 @@ var webgl_lineFeature = function (arg) {
147147 miterLimit = m_this . style . get ( 'miterLimit' ) ( data ) ,
148148 antialiasing = m_this . style . get ( 'antialiasing' ) ( data ) || 0 ,
149149 uniformFunc = m_this . style . get ( 'uniformLine' ) , uniformVal , uniform ,
150+ drop , skipped ,
150151 order = m_this . featureVertices ( ) , orderk0 ,
151152 orderLen = order . length ,
152153 // webgl buffers; see _init for details
@@ -216,10 +217,11 @@ var webgl_lineFeature = function (arg) {
216217 position = transform . transformCoordinates ( target_gcs , map_gcs , position , 3 ) ;
217218 m_origin = new Float32Array ( m_this . style . get ( 'origin' ) ( position ) ) ;
218219 if ( m_origin [ 0 ] || m_origin [ 1 ] || m_origin [ 2 ] ) {
220+ let o0 = m_origin [ 0 ] , o1 = m_origin [ 1 ] , o2 = m_origin [ 2 ] ;
219221 for ( i = 0 ; i < position . length ; i += 3 ) {
220- position [ i ] -= m_origin [ 0 ] ;
221- position [ i + 1 ] -= m_origin [ 1 ] ;
222- position [ i + 2 ] -= m_origin [ 2 ] ;
222+ position [ i ] -= o0 ;
223+ position [ i + 1 ] -= o1 ;
224+ position [ i + 2 ] -= o2 ;
223225 }
224226 }
225227 m_modelViewUniform . setOrigin ( m_origin ) ;
@@ -265,11 +267,12 @@ var webgl_lineFeature = function (arg) {
265267 continue ;
266268 }
267269 uniform = uniformVal === undefined ? uniformFunc ( lineItem , i ) : uniformVal ;
270+ drop = uniform === 'drop' ;
268271 d = data [ i ] ;
269272 closedVal = closed [ i ] ;
270273 firstPosIdx3 = posIdx3 ;
271274 maxj = lineItem . length + ( closedVal === 2 ? 1 : 0 ) ;
272- let skipped = 0 ;
275+ skipped = 0 ;
273276 for ( j = 0 ; j < maxj ; j += 1 , posIdx3 += 3 ) {
274277 lidx = j ;
275278 if ( j === lineItem . length ) {
@@ -330,14 +333,14 @@ var webgl_lineFeature = function (arg) {
330333 }
331334
332335 if ( j ) {
333- if ( uniform === ' drop' && j > 1 && position [ vert [ 0 ] . pos ] === position [ vert [ 1 ] . pos ] && position [ vert [ 0 ] . pos + 1 ] === position [ vert [ 1 ] . pos + 1 ] ) {
336+ if ( drop && j > 1 && position [ vert [ 0 ] . pos ] === position [ vert [ 1 ] . pos ] && position [ vert [ 0 ] . pos + 1 ] === position [ vert [ 1 ] . pos + 1 ] ) {
334337 skipped += 1 ;
335338 continue ;
336339 }
337340 /* zero out the z position. This can be changed if we handle it in
338341 * the shader. */
339342 for ( k = 0 ; k < orderLen ; k += 1 , dest += 1 , dest3 += 3 ) {
340- if ( uniform === ' drop' && vert [ 0 ] . strokeOpacity <= 0 && vert [ 1 ] . strokeOpacity <= 0 ) {
343+ if ( drop && vert [ 0 ] . strokeOpacity <= 0 && vert [ 1 ] . strokeOpacity <= 0 ) {
341344 strokeOpacityBuf [ dest ] = - 1 ;
342345 continue ;
343346 }
0 commit comments