@@ -162,7 +162,7 @@ function defineStyleProperty(style, category, parameter, userValue, defaultValue
162
162
const dataValue = style . context . featureStyle ?. [ category ] ?. [ parameter ] ;
163
163
if ( dataValue != undefined ) { return readExpression ( dataValue , style . context ) ; }
164
164
if ( defaultValue instanceof Function ) {
165
- return defaultValue ( style . context . properties , style . context ) ;
165
+ return defaultValue ( style . context . properties , style . context ) ?? defaultValue ;
166
166
}
167
167
return defaultValue ;
168
168
} ,
@@ -808,7 +808,8 @@ class Style {
808
808
style . stroke . color = color ;
809
809
style . stroke . opacity = opacity ;
810
810
style . stroke . width = 1.0 ;
811
- style . stroke . dasharray = [ ] ;
811
+ } else {
812
+ style . stroke . width = 0.0 ;
812
813
}
813
814
} else if ( layer . type === 'line' ) {
814
815
const prepare = readVectorProperty ( layer . paint [ 'line-color' ] , { type : 'color' } ) ;
@@ -942,7 +943,7 @@ class Style {
942
943
*/
943
944
applyToCanvasPolygon ( txtrCtx , polygon , invCtxScale , canBeFilled ) {
944
945
// draw line or edge of polygon
945
- if ( this . stroke ) {
946
+ if ( this . stroke . width > 0 ) {
946
947
// TO DO add possibility of using a pattern (https://github.com/iTowns/itowns/issues/2210)
947
948
this . _applyStrokeToPolygon ( txtrCtx , invCtxScale , polygon ) ;
948
949
}
@@ -958,11 +959,11 @@ class Style {
958
959
if ( txtrCtx . strokeStyle !== this . stroke . color ) {
959
960
txtrCtx . strokeStyle = this . stroke . color ;
960
961
}
961
- const width = ( this . stroke . width || 2.0 ) * invCtxScale ;
962
+ const width = this . stroke . width * invCtxScale ;
962
963
if ( txtrCtx . lineWidth !== width ) {
963
964
txtrCtx . lineWidth = width ;
964
965
}
965
- const alpha = this . stroke . opacity == undefined ? 1.0 : this . stroke . opacity ;
966
+ const alpha = this . stroke . opacity ;
966
967
if ( alpha !== txtrCtx . globalAlpha && typeof alpha == 'number' ) {
967
968
txtrCtx . globalAlpha = alpha ;
968
969
}
0 commit comments