fix shaped icon box sizes
This commit is contained in:
@@ -13,10 +13,15 @@ SymbolQuads getIconQuads(Anchor &anchor, const PositionedIcon &shapedIcon,
|
||||
const std::vector<Coordinate> &line, const StyleLayoutSymbol &layout,
|
||||
const bool alongLine) {
|
||||
|
||||
vec2<float> tl{shapedIcon.left, shapedIcon.top};
|
||||
vec2<float> tr{shapedIcon.right, shapedIcon.top};
|
||||
vec2<float> br{shapedIcon.right, shapedIcon.bottom};
|
||||
vec2<float> bl{shapedIcon.left, shapedIcon.bottom};
|
||||
const float border = 1.0;
|
||||
auto left = shapedIcon.left - border;
|
||||
auto right = left + shapedIcon.image.w;
|
||||
auto top = shapedIcon.top - border;
|
||||
auto bottom = top + shapedIcon.image.h;
|
||||
vec2<float> tl{left, top};
|
||||
vec2<float> tr{right, top};
|
||||
vec2<float> br{right, bottom};
|
||||
vec2<float> bl{left, bottom};
|
||||
|
||||
|
||||
float angle = layout.icon.rotate * M_PI / 180.0f;
|
||||
|
||||
@@ -6,11 +6,10 @@ namespace mbgl {
|
||||
PositionedIcon shapeIcon(const Rect<uint16_t> &image, const StyleLayoutSymbol &layout) {
|
||||
float dx = layout.icon.offset[0];
|
||||
float dy = layout.icon.offset[1];
|
||||
// TODO, this is image.image.width in -js
|
||||
float x1 = dx - image.originalW / 2.0f;
|
||||
float x2 = x1 + image.w;
|
||||
float x2 = x1 + image.originalW;
|
||||
float y1 = dy - image.originalH / 2.0f;
|
||||
float y2 = y1 + image.h;
|
||||
float y2 = y1 + image.originalH;
|
||||
|
||||
return PositionedIcon(image, y1, y2, x1, x2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user