diff --git a/examples/filter-points-webgl.js b/examples/filter-points-webgl.js index fa09676c8b..b2d39f0bd6 100644 --- a/examples/filter-points-webgl.js +++ b/examples/filter-points-webgl.js @@ -18,7 +18,7 @@ const period = 12; // animation period in seconds const animRatio = ['^', ['/', - ['mod', + ['%', ['+', ['time'], [ diff --git a/src/ol/style/expressions.js b/src/ol/style/expressions.js index db4cdfe087..25921154b8 100644 --- a/src/ol/style/expressions.js +++ b/src/ol/style/expressions.js @@ -23,7 +23,7 @@ import {asArray, isStringColor} from '../color.js'; * * `['+', value1, value1]` adds `value1` and `value2` * * `['-', value1, value1]` subtracts `value2` from `value1` * * `['clamp', value, low, high]` clamps `value` between `low` and `high` - * * `['mod', value1, value1]` returns the result of `value1 % value2` (modulo) + * * `['%', value1, value1]` returns the result of `value1 % value2` (modulo) * * `['^', value1, value1]` returns the value of `value1` raised to the `value2` power * * * Transform operators: @@ -412,7 +412,7 @@ Operators['clamp'] = { return `clamp(${expressionToGlsl(context, args[0])}, ${min}, ${max})`; } }; -Operators['mod'] = { +Operators['%'] = { getReturnType: function(args) { return ValueTypes.NUMBER; }, diff --git a/test/spec/ol/style/expressions.test.js b/test/spec/ol/style/expressions.test.js index bff0248ddd..d3d15fdf48 100644 --- a/test/spec/ol/style/expressions.test.js +++ b/test/spec/ol/style/expressions.test.js @@ -130,7 +130,7 @@ describe('ol.style.expressions', function() { expect(getValueType(['*', ['get', 'size'], 12])).to.eql(ValueTypes.NUMBER); expect(getValueType(['clamp', ['get', 'attr2'], ['get', 'attr3'], 20])).to.eql(ValueTypes.NUMBER); expect(getValueType(['^', 10, 2])).to.eql(ValueTypes.NUMBER); - expect(getValueType(['mod', ['time'], 10])).to.eql(ValueTypes.NUMBER); + expect(getValueType(['%', ['time'], 10])).to.eql(ValueTypes.NUMBER); expect(getValueType(['>', 10, ['get', 'attr4']])).to.eql(ValueTypes.BOOLEAN); expect(getValueType(['>=', 10, ['get', 'attr4']])).to.eql(ValueTypes.BOOLEAN); expect(getValueType(['<', 10, ['get', 'attr4']])).to.eql(ValueTypes.BOOLEAN); @@ -165,7 +165,7 @@ describe('ol.style.expressions', function() { expect(expressionToGlsl(context, ['+', ['*', ['get', 'size'], 0.001], 12])).to.eql('((a_size * 0.001) + 12.0)'); expect(expressionToGlsl(context, ['/', ['-', ['get', 'size'], 20], 100])).to.eql('((a_size - 20.0) / 100.0)'); expect(expressionToGlsl(context, ['clamp', ['get', 'attr2'], ['get', 'attr3'], 20])).to.eql('clamp(a_attr2, a_attr3, 20.0)'); - expect(expressionToGlsl(context, ['^', ['mod', ['time'], 10], 2])).to.eql('pow(mod(u_time, 10.0), 2.0)'); + expect(expressionToGlsl(context, ['^', ['%', ['time'], 10], 2])).to.eql('pow(mod(u_time, 10.0), 2.0)'); expect(expressionToGlsl(context, ['>', 10, ['get', 'attr4']])).to.eql('(10.0 > a_attr4)'); expect(expressionToGlsl(context, ['>=', 10, ['get', 'attr4']])).to.eql('(10.0 >= a_attr4)'); expect(expressionToGlsl(context, ['<', 10, ['get', 'attr4']])).to.eql('(10.0 < a_attr4)'); @@ -297,7 +297,7 @@ describe('ol.style.expressions', function() { describe('case operator', function() { let context; - beforeEach(function () { + beforeEach(function() { context = { variables: [], attributes: [], @@ -619,7 +619,7 @@ describe('ol.style.expressions', function() { ['linear'], ['^', ['/', - ['mod', + ['%', ['+', ['time'], [