Handle named colors as string in equal operator
This commit is contained in:
@@ -606,6 +606,12 @@ function getEqualOperator(operator) {
|
||||
);
|
||||
}
|
||||
|
||||
if (type === (ValueTypes.COLOR | ValueTypes.STRING)) {
|
||||
// It's not possible to compare attributes with color values
|
||||
// So force it to be treated as a string
|
||||
type = ValueTypes.STRING;
|
||||
}
|
||||
|
||||
return `(${expressionToGlsl(
|
||||
context,
|
||||
args[0],
|
||||
|
||||
@@ -250,6 +250,9 @@ describe('ol.style.expressions', function () {
|
||||
expect(expressionToGlsl(context, ['==', 10, ['get', 'attr4']])).to.eql(
|
||||
'(10.0 == a_attr4)'
|
||||
);
|
||||
expect(expressionToGlsl(context, ['==', 'red', ['get', 'attr4']])).to.eql(
|
||||
'(0.0 == a_attr4)'
|
||||
);
|
||||
expect(expressionToGlsl(context, ['!=', 10, ['get', 'attr4']])).to.eql(
|
||||
'(10.0 != a_attr4)'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user