You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#695 added two parameters, stretchX and stretchY, to StyleManager.addImage(_:id:). An iOS developer would find it more intuitive if the method could get the cap insets directly from the UIImage that is already passed in. The expected workflow would be to edit image slicing visually in the asset catalog, load the image by name, and add it to the style without ever specifying the cap insets in code. UIKit frameworks and most third-party frameworks honor these implicitly resizable UIImages the same way. Support for resizable images was originally added to the iOS map SDK in mapbox/mapbox-gl-native-ios#182 (comment), so this is technically a regression.
The stretchX and stretchY parameters should be made optional. When specified, they can override the cap insets in UIImage. The explicit parameters have the benefit of supporting multiple resizable regions, which UIImage doesn’t natively support. However, as it stands, there’s a potential for mismatch if the developer updates the asset catalog but forgets to update the hard-coded stretchX and stretchY arguments. As a workaround, the developer could programmatically convert the cap insets into stretchable regions, but the math is fairly error-prone, so it would be better for the SDK to take care of automatically.
We do plan to support cap insets in a future release. We removed the default params recently to avoid ambiguity when we introduce a new method that works based on cap insets.
#695 added two parameters,
stretchX
andstretchY
, toStyleManager.addImage(_:id:)
. An iOS developer would find it more intuitive if the method could get the cap insets directly from the UIImage that is already passed in. The expected workflow would be to edit image slicing visually in the asset catalog, load the image by name, and add it to the style without ever specifying the cap insets in code. UIKit frameworks and most third-party frameworks honor these implicitly resizable UIImages the same way. Support for resizable images was originally added to the iOS map SDK in mapbox/mapbox-gl-native-ios#182 (comment), so this is technically a regression.The
stretchX
andstretchY
parameters should be made optional. When specified, they can override the cap insets in UIImage. The explicit parameters have the benefit of supporting multiple resizable regions, which UIImage doesn’t natively support. However, as it stands, there’s a potential for mismatch if the developer updates the asset catalog but forgets to update the hard-codedstretchX
andstretchY
arguments. As a workaround, the developer could programmatically convert the cap insets into stretchable regions, but the math is fairly error-prone, so it would be better for the SDK to take care of automatically./cc @neelmistry94
The text was updated successfully, but these errors were encountered: