Skip to content

Commit

Permalink
copy default point size so values are safe to modify
Browse files Browse the repository at this point in the history
  • Loading branch information
bcamper committed Nov 10, 2017
1 parent 2b540a2 commit b8177d8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/styles/points/points.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const TANGRAM_POINT_TYPE_LABEL = 2; // labels (generated by rendering labels t
const TANGRAM_POINT_TYPE_SHADER = 3; // point (drawn in shader)

// default point size in pixels
const DEFAULT_POINT_SIZE = [16, 16];
const DEFAULT_POINT_SIZE = 16;

// Mixin text label methods
Object.assign(Points, TextLabels);
Expand Down Expand Up @@ -161,7 +161,7 @@ Object.assign(Points, {
// point size defined explicitly, or defaults to sprite size, or generic fallback
style.size = draw.size;
if (!style.size) {
style.size = (sprite_info && sprite_info.css_size) || DEFAULT_POINT_SIZE;
style.size = (sprite_info && sprite_info.css_size) || [DEFAULT_POINT_SIZE, DEFAULT_POINT_SIZE];
}
else {
style.size = StyleParser.evalCachedPointSizeProperty(draw.size, sprite_info, context);
Expand Down Expand Up @@ -191,10 +191,8 @@ Object.assign(Points, {
}

// size will be scaled to 16-bit signed int, so max allowed width + height of 256 pixels
style.size = [
Math.min(style.size[0], 256),
Math.min(style.size[1], 256)
];
style.size[0] = Math.min(style.size[0], 256);
style.size[1] = Math.min(style.size[1], 256);

// Placement strategy
style.placement = draw.placement;
Expand Down

0 comments on commit b8177d8

Please sign in to comment.