Skip to content

Commit

Permalink
Rename distance-from-camera to distance-from-center
Browse files Browse the repository at this point in the history
  • Loading branch information
Arindam Bose committed Jul 23, 2021
1 parent e471ae9 commit 0f9e5b3
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions debug/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@
map.setLayoutProperty('building-number-label', 'symbol-clip',
["case",
["<", ["pitch"], 60], false,
["all", [">=", ["pitch"], 60], ["<", ["distance-from-camera"], 2]], false,
["all", [">=", ["pitch"], 60], ["<", ["distance-from-center"], 2]], false,
true
]
);

map.setLayoutProperty('poi-label', 'symbol-clip',
["case",
["<", ["pitch"], 60], false,
["all", [">=", ["pitch"], 60], ["<", ["distance-from-camera"], 4]], false,
["all", [">=", ["pitch"], 60], ["<", ["distance-from-center"], 4]], false,
true
]
);

map.setLayoutProperty('transit-label', 'symbol-clip',
["case",
["<", ["pitch"], 60], false,
["all", [">=", ["pitch"], 60], ["<", ["distance-from-camera"], 3]], false,
["all", [">=", ["pitch"], 60], ["<", ["distance-from-center"], 3]], false,
true
]
);
Expand Down
2 changes: 1 addition & 1 deletion src/style-spec/expression/definitions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ CompoundExpression.register(expressions, {
[],
(ctx) => ctx.globals.pitch
],
'distance-from-camera': [
'distance-from-center': [
NumberType,
[],
(ctx) => ctx.distanceFromCamera()
Expand Down
2 changes: 1 addition & 1 deletion src/style-spec/expression/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export function createPropertyExpression(expression: mixed, propertySpec: StyleP
return error([new ParsingError('', 'data expressions not supported')]);
}

const isZoomConstant = isConstant.isGlobalPropertyConstant(parsed, ['zoom', 'pitch', 'distance-from-camera']);
const isZoomConstant = isConstant.isGlobalPropertyConstant(parsed, ['zoom', 'pitch', 'distance-from-center']);
if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {
return error([new ParsingError('', 'zoom expressions not supported')]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/style-spec/expression/parsing_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,5 @@ function isConstant(expression: Expression) {
}

return isFeatureConstant(expression) &&
isGlobalPropertyConstant(expression, ['zoom', 'heatmap-density', 'line-progress', 'sky-radial-progress', 'accumulated', 'is-supported-script', 'pitch', 'distance-from-camera']);
isGlobalPropertyConstant(expression, ['zoom', 'heatmap-density', 'line-progress', 'sky-radial-progress', 'accumulated', 'is-supported-script', 'pitch', 'distance-from-center']);
}
4 changes: 2 additions & 2 deletions src/style-spec/reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@
"zoom",
"feature",
"pitch",
"distance-from-camera"
"distance-from-center"
]
},
"property-type": "data-driven"
Expand Down Expand Up @@ -3226,7 +3226,7 @@
}
}
},
"distance-from-camera": {
"distance-from-center": {
"doc": "The distance of the feature from the camera",
"group": "Camera",
"sdk-support": {
Expand Down
2 changes: 1 addition & 1 deletion src/style-spec/style-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

type ExpressionType = 'data-driven' | 'cross-faded' | 'cross-faded-data-driven' | 'color-ramp' | 'data-constant' | 'constant';
type ExpressionParameters = Array<'zoom' | 'feature' | 'feature-state' | 'heatmap-density' | 'line-progress' | 'sky-radial-progress' | 'pitch' | 'distance-from-camera'>;
type ExpressionParameters = Array<'zoom' | 'feature' | 'feature-state' | 'heatmap-density' | 'line-progress' | 'sky-radial-progress' | 'pitch' | 'distance-from-center'>;

type ExpressionSpecification = {
interpolated: boolean,
Expand Down
2 changes: 1 addition & 1 deletion src/style-spec/util/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export function supportsInterpolation(spec: StylePropertySpecification): boolean
export function supportsCameraStateExpression(spec: StylePropertySpecification): boolean {
return !!spec.expression && spec.expression.parameters.indexOf('zoom') > -1 &&
spec.expression.parameters.indexOf('pitch') > -1 &&
spec.expression.parameters.indexOf('distance-from-camera') > -1;
spec.expression.parameters.indexOf('distance-from-center') > -1;
}

0 comments on commit 0f9e5b3

Please sign in to comment.