Skip to content

Commit

Permalink
fix: scripts autogenerate and globals to accommodate new style-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrauber committed Sep 24, 2024
1 parent 4fb05ea commit a0f0586
Show file tree
Hide file tree
Showing 11 changed files with 273 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@ public void onAllImagesLoaded() {
case "fillExtrusionBaseTransition":
RCTMLNStyleFactory.setFillExtrusionBaseTransition(layer, styleValue);
break;
case "fillExtrusionVerticalGradient":
RCTMLNStyleFactory.setFillExtrusionVerticalGradient(layer, styleValue);
break;
}
}
}
Expand Down Expand Up @@ -1207,7 +1210,7 @@ public static void setIconPadding(SymbolLayer layer, RCTMLNStyleValue styleValue
if (styleValue.isExpression()) {
layer.setProperties(PropertyFactory.iconPadding(styleValue.getExpression()));
} else {
layer.setProperties(PropertyFactory.iconPadding(styleValue.getFloat(VALUE_KEY)));
layer.setProperties(PropertyFactory.iconPadding(styleValue.getFloatArray(VALUE_KEY)));
}
}

Expand Down Expand Up @@ -1975,6 +1978,14 @@ public static void setFillExtrusionBaseTransition(FillExtrusionLayer layer, RCTM
}
}

public static void setFillExtrusionVerticalGradient(FillExtrusionLayer layer, RCTMLNStyleValue styleValue) {
if (styleValue.isExpression()) {
layer.setProperties(PropertyFactory.fillExtrusionVerticalGradient(styleValue.getExpression()));
} else {
layer.setProperties(PropertyFactory.fillExtrusionVerticalGradient(styleValue.getBoolean(VALUE_KEY)));
}
}

public static void setVisibility(RasterLayer layer, RCTMLNStyleValue styleValue) {
layer.setProperties(PropertyFactory.visibility(styleValue.getString(VALUE_KEY)));
}
Expand Down
19 changes: 19 additions & 0 deletions docs/FillExtrusionLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* <a href="#name-5">fillExtrusionPattern</a><br/>
* <a href="#name-6">fillExtrusionHeight</a><br/>
* <a href="#name-7">fillExtrusionBase</a><br/>
* <a href="#name-8">fillExtrusionVerticalGradient</a><br/>

___

Expand Down Expand Up @@ -317,3 +318,21 @@ The transition affecting any changes to this layer’s fillExtrusionBase propery
`{duration: 300, delay: 0}`


___

#### Name
`fillExtrusionVerticalGradient`

#### Description
Whether to apply a vertical gradient to the sides of a fillExtrusion layer. If true, sides will be shaded slightly darker farther down.

#### Type
`boolean`
#### Default Value
`true`


#### Expression

Parameters: `zoom`

2 changes: 1 addition & 1 deletion docs/RasterLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ ___
`rasterFadeDuration`

#### Description
Fade duration when a new tile is added.
Fade duration when a new tile is added, or when a video is started or its coordinates are updated.

#### Type
`number`
Expand Down
12 changes: 7 additions & 5 deletions docs/SymbolLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,12 @@ ___
`iconPadding`

#### Description
Size of additional area round the icon bounding box used for detecting symbol collisions. Values are declared using CSS margin shorthand syntax: a single value applies to all four sides; two values apply to [top/bottom, left/right]; three values apply to [top, left/right, bottom]; four values apply to [top, right, bottom, left]. For backwards compatibility, a single bare number is accepted, and treated the same as a oneElement array padding applied to all sides.
Size of additional area round the icon bounding box used for detecting symbol collisions.

#### Type
`number`
`array<number>`
#### Default Value
`2`
`[2]`

#### Units
`pixels`
Expand Down Expand Up @@ -1122,7 +1122,7 @@ ___
`iconColor`

#### Description
The color of the icon. This can only be used with sdf icons.
The color of the icon. This can only be used with SDF icons.

#### Type
`color`
Expand Down Expand Up @@ -1204,7 +1204,9 @@ ___
`iconHaloWidth`

#### Description
Distance of halo to the icon outline.
Distance of halo to the icon outline.

The unit is in pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for `@2x` sprites, etc.

#### Type
`number`
Expand Down
31 changes: 25 additions & 6 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,23 @@
]
},
"transition": true
},
{
"name": "fillExtrusionVerticalGradient",
"type": "boolean",
"values": [],
"default": true,
"description": "Whether to apply a vertical gradient to the sides of a fillExtrusion layer. If true, sides will be shaded slightly darker farther down.",
"requires": [],
"disabledBy": [],
"allowedFunctionTypes": [],
"expression": {
"interpolated": false,
"parameters": [
"zoom"
]
},
"transition": false
}
]
},
Expand Down Expand Up @@ -2966,7 +2983,7 @@
"minimum": 0,
"units": "milliseconds",
"default": 300,
"description": "Fade duration when a new tile is added.",
"description": "Fade duration when a new tile is added, or when a video is started or its coordinates are updated.",
"requires": [],
"disabledBy": [],
"allowedFunctionTypes": [],
Expand Down Expand Up @@ -3733,11 +3750,13 @@
},
{
"name": "iconPadding",
"type": "number",
"type": "array<number>",
"values": [],
"units": "pixels",
"default": 2,
"description": "Size of additional area round the icon bounding box used for detecting symbol collisions. Values are declared using CSS margin shorthand syntax: a single value applies to all four sides; two values apply to [top/bottom, left/right]; three values apply to [top, left/right, bottom]; four values apply to [top, right, bottom, left]. For backwards compatibility, a single bare number is accepted, and treated the same as a oneElement array padding applied to all sides.",
"default": [
2
],
"description": "Size of additional area round the icon bounding box used for detecting symbol collisions.",
"requires": [
"iconImage"
],
Expand Down Expand Up @@ -4460,7 +4479,7 @@
"type": "color",
"values": [],
"default": "#000000",
"description": "The color of the icon. This can only be used with sdf icons.",
"description": "The color of the icon. This can only be used with SDF icons.",
"requires": [
"iconImage"
],
Expand Down Expand Up @@ -4504,7 +4523,7 @@
"minimum": 0,
"units": "pixels",
"default": 0,
"description": "Distance of halo to the icon outline.",
"description": "Distance of halo to the icon outline. \n\nThe unit is in pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for `@2x` sprites, etc.",
"requires": [
"iconImage"
],
Expand Down
1 change: 1 addition & 0 deletions ios/RCTMLN/RCTMLNStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
- (void)setFillExtrusionHeightTransition:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue;
- (void)setFillExtrusionBase:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue;
- (void)setFillExtrusionBaseTransition:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue;
- (void)setFillExtrusionVerticalGradient:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue;
- (void)setRasterStyleLayerVisibility:(MLNRasterStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue;
- (void)setRasterOpacity:(MLNRasterStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue;
- (void)setRasterOpacityTransition:(MLNRasterStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue;
Expand Down
7 changes: 7 additions & 0 deletions ios/RCTMLN/RCTMLNStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ - (void)fillExtrusionLayer:(MLNFillExtrusionStyleLayer *)layer withReactStyle:(N
[self setFillExtrusionBase:layer withReactStyleValue:styleValue];
} else if ([prop isEqualToString:@"fillExtrusionBaseTransition"]) {
[self setFillExtrusionBaseTransition:layer withReactStyleValue:styleValue];
} else if ([prop isEqualToString:@"fillExtrusionVerticalGradient"]) {
[self setFillExtrusionVerticalGradient:layer withReactStyleValue:styleValue];
} else {
// TODO throw exception
}
Expand Down Expand Up @@ -1457,6 +1459,11 @@ - (void)setFillExtrusionBaseTransition:(MLNFillExtrusionStyleLayer *)layer withR
layer.fillExtrusionBaseTransition = [styleValue getTransition];
}

- (void)setFillExtrusionVerticalGradient:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue
{
layer.fillExtrusionHasVerticalGradient = styleValue.mlnStyleValue;
}



- (void)setRasterStyleLayerVisibility:(MLNRasterStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue
Expand Down
Loading

0 comments on commit a0f0586

Please sign in to comment.