Skip to content

Commit 31670c1

Browse files
authored
Merge pull request #12466 from kiselev-dv/fix/expression-issue-12455
Adjust regexp state on string replace, add test case
2 parents 1c892c8 + d863ed1 commit 31670c1

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,7 @@ try {
12451245
- Fixed an incorrect model matrix computation for `i3dm` tilesets that are loaded using `ModelExperimental`. [#10302](https://github.com/CesiumGS/cesium/pull/10302)
12461246
- Fixed race condition during billboard clamping when the height reference changes. [#10191](https://github.com/CesiumGS/cesium/issues/10191)
12471247
- Fixed ability to run `test` and other support tasks from within the release zip file. [#10311](https://github.com/CesiumGS/cesium/pull/10311)
1248+
- Fixed `Expression` multi-variable substitution. [#12455](https://github.com/CesiumGS/cesium/issues/12455)
12481249

12491250
## 1.92 - 2022-04-01
12501251

CONTRIBUTORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
9494
- [Camptocamp SA](https://www.camptocamp.com/)
9595
- [Frédéric Junod](https://github.com/fredj)
9696
- [Guillaume Beraudo](https://github.com/gberaudo)
97-
- [EndPoint](https://www.endpoint.com/)
97+
- [EndPointDev](https://www.endpointdev.com/)
9898
- [Dmitry Kiselev](https://github.com/kiselev-dv)
9999
- [Safe Software](https://www.safe.com)
100100
- [Joel Depooter](https://github.com/JDepooter)

packages/engine/Source/Scene/Expression.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,7 @@ Node.prototype._evaluateVariableString = function (feature) {
12251225
property = "";
12261226
}
12271227
result = result.replace(placeholder, property);
1228+
variableRegex.lastIndex += property.length - placeholder.length;
12281229
match = variableRegex.exec(result);
12291230
}
12301231
return result;

packages/engine/Specs/Scene/ExpressionSpec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ describe("Scene/Expression", function () {
8484
expression = new Expression("'replace ${string} multiple ${height}'");
8585
expect(expression.evaluate(feature)).toEqual("replace hello multiple 10");
8686

87+
expression = new Expression("'replace ${height} ${string}'");
88+
expect(expression.evaluate(feature)).toEqual("replace 10 hello");
89+
8790
expression = new Expression('"replace ${string}"');
8891
expect(expression.evaluate(feature)).toEqual("replace hello");
8992

0 commit comments

Comments
 (0)