Add array support for icon-padding (#2845)

This commit is contained in:
Alexey Kon
2024-09-20 17:17:33 -07:00
committed by GitHub
parent 58dd529790
commit 9d553c2843
56 changed files with 902 additions and 104 deletions

View File

@@ -3688,6 +3688,20 @@ public class Expression {
return new Expression("to-color", input);
}
/**
* Converts input value to a padding.
*
* If the input is a number or an array of numbers padding is created following
* the same pattern as CSS padding. See <a href="https://maplibre.org/maplibre-style-spec/types/#padding">Style specification</a>.
* Otherwise, the expression is an error.
*
* @param input expression input
* @return expression
*/
public static Expression toPadding(@NonNull Expression input) {
return new Expression("to-padding", input);
}
/**
* Binds input to named variables,
* which can then be referenced in the result expression using {@link #var(String)} or {@link #var(Expression)}.

View File

@@ -2050,18 +2050,18 @@ The unit is in density-independent pixels only for SDF sprites that were created
/**
* Size of additional area round the icon bounding box used for detecting symbol collisions.
*
* @param value a Float value
* @return property wrapper around Float
* @param value a Float[] value
* @return property wrapper around Float[]
*/
public static PropertyValue<Float> iconPadding(Float value) {
public static PropertyValue<Float[]> iconPadding(Float[] value) {
return new LayoutPropertyValue<>("icon-padding", value);
}
/**
* Size of additional area round the icon bounding box used for detecting symbol collisions.
*
* @param value a Float value
* @return property wrapper around Float
* @param value a Float[] value
* @return property wrapper around Float[]
*/
public static PropertyValue<Expression> iconPadding(Expression value) {
return new LayoutPropertyValue<>("icon-padding", value);

View File

@@ -316,13 +316,13 @@ public class SymbolLayer extends Layer {
/**
* Get the IconPadding property
*
* @return property wrapper value around Float
* @return property wrapper value around Float[]
*/
@NonNull
@SuppressWarnings("unchecked")
public PropertyValue<Float> getIconPadding() {
public PropertyValue<Float[]> getIconPadding() {
checkThread();
return (PropertyValue<Float>) new PropertyValue("icon-padding", nativeGetIconPadding());
return (PropertyValue<Float[]>) new PropertyValue("icon-padding", nativeGetIconPadding());
}
/**