Skip to content

Commit fab238b

Browse files
committed
projectionType
1 parent 45a5666 commit fab238b

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

build/generate-style-spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,9 @@ fs.writeFileSync('src/types.g.ts',
124124
125125
export type ColorSpecification = string;
126126
127-
export type ProjectionSpecification = {"mode":ProjectionType}
128127
export type PrimitiveProjection = 'mercator' | 'globe';
129128
export type ProjectionTransition = [PrimitiveProjection, PrimitiveProjection, number];
130-
export type ProjectionType = PrimitiveProjection | ProjectionTransition | PropertyValueSpecification<ProjectionTransition>
129+
export type ProjectionTypeSpecification = PrimitiveProjection | ProjectionTransition | PropertyValueSpecification<ProjectionTransition>
131130
132131
133132
export type PaddingSpecification = number | number[];
@@ -327,6 +326,8 @@ ${objectDeclaration('LightSpecification', spec.light)}
327326
328327
${objectDeclaration('SkySpecification', spec.sky)}
329328
329+
${objectDeclaration('ProjectionSpecification', spec.projection)}
330+
330331
${objectDeclaration('TerrainSpecification', spec.terrain)}
331332
332333
${spec.source.map(key => {

docs/types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ The following example applies 2em padding on top and bottom and 3em padding left
134134
}
135135
```
136136

137-
## Projection Mode
137+
## Projection Type
138138

139-
There are currently two projection modes implemented.
139+
There are currently two projection types implemented.
140140

141141
- `mercator` - A web mercator projection
142142
- `globe` - A spherical projection

src/reference/v8.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"type": "projection",
130130
"doc": "The projection type. Can be specified as a string, or as an expression for supported projection types.",
131131
"example": {
132-
"mode": [
132+
"type": [
133133
"interpolate-projection",
134134
["linear"],
135135
["zoom"],
@@ -4576,8 +4576,8 @@
45764576
}
45774577
},
45784578
"projection": {
4579-
"mode": {
4580-
"type": "projection-mode",
4579+
"type": {
4580+
"type": "projectionType",
45814581
"doc": "The projection type. Can be specified as a string, or as an expression for supported projection types.",
45824582
"default": "mercator",
45834583
"expression": {

src/util/projection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {PrimitiveProjection, ProjectionTransition, ProjectionType, PropertyValueSpecification} from '../types.g';
1+
import {PrimitiveProjection, ProjectionTransition, ProjectionTypeSpecification, PropertyValueSpecification} from '../types.g';
22

33
export class Projection {
44
readonly from: PrimitiveProjection;
@@ -25,7 +25,7 @@ export class Projection {
2525
}
2626
}
2727

28-
export function isProjectionType(value: unknown): value is ProjectionType {
28+
export function isProjectionType(value: unknown): value is ProjectionTypeSpecification {
2929
return isPrimitiveProjection(value) || isProjectionTransition(value) || isPropertyValueSpecification(value);
3030
}
3131

src/validate/validate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import validateVariableAnchorOffsetCollection from './validate_variable_anchor_o
2727
import validateSprite from './validate_sprite';
2828
import ValidationError from '../error/validation_error';
2929
import validateProjection from './validate_projection';
30-
import validateProjectionMode from './validate_projection-mode';
30+
import validateProjectionType from './validate_projection-type';
3131

3232
const VALIDATORS = {
3333
'*'() {
@@ -48,7 +48,7 @@ const VALIDATORS = {
4848
'sky': validateSky,
4949
'terrain': validateTerrain,
5050
'projection': validateProjection,
51-
'projection-mode': validateProjectionMode,
51+
'projectionType': validateProjectionType,
5252
'string': validateString,
5353
'formatted': validateFormatted,
5454
'resolvedImage': validateImage,

src/validate/validate_projection-mode.ts renamed to src/validate/validate_projection-type.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import ValidationError from '../error/validation_error';
22
import getType from '../util/get_type';
33
import v8 from '../reference/v8.json' with {type: 'json'};
4-
import {ProjectionType, StyleSpecification} from '../types.g';
4+
import {ProjectionTypeSpecification, StyleSpecification} from '../types.g';
55
import {isPrimitiveProjection, isProjectionTransition, isProjectionType} from '../util/projection';
66

77
interface ValidateProjectionOptions {
88
sourceName?: string;
9-
value: ProjectionType;
9+
value: ProjectionTypeSpecification;
1010
styleSpec: typeof v8;
1111
style: StyleSpecification;
1212
validateSpec: Function;
1313
}
1414

1515
export default function validateProjectionMode(options: ValidateProjectionOptions) {
16-
const projectionType: ProjectionType = options.value;
16+
const projectionType: ProjectionTypeSpecification = options.value;
1717

1818
if (!projectionType){
1919

0 commit comments

Comments
 (0)