puts max radius as a constant
This commit is contained in:
parent
645da00ce1
commit
fa5791483e
@ -2,6 +2,7 @@
|
||||
// min value to render a line.
|
||||
// it does not make sense to render a line of a width is not even visible
|
||||
var LINEWIDTH_MIN_VALUE = 0.05;
|
||||
var MAX_SPRITE_RADIUS = 255;
|
||||
|
||||
function renderPoint(ctx, st) {
|
||||
ctx.fillStyle = st['marker-fill'];
|
||||
@ -78,8 +79,7 @@
|
||||
if (st['marker-fill-opacity'] !== undefined || st['marker-opacity'] !== undefined) {
|
||||
ctx.globalAlpha = st['marker-fill-opacity'] || st['marker-opacity'];
|
||||
}
|
||||
var maxSpriteRadius = 255;
|
||||
ctx.drawImage(img, 0, 0, Math.min(img.width, maxSpriteRadius), Math.min(img.height, maxSpriteRadius));
|
||||
ctx.drawImage(img, 0, 0, Math.min(img.width, MAX_SPRITE_RADIUS), Math.min(img.height, MAX_SPRITE_RADIUS));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,11 +137,11 @@ var Filters = require('./torque_filters');
|
||||
if (qualifiedUrl && this._iconsToLoad <= 0 && this._icons[qualifiedUrl]) {
|
||||
var img = this._icons[qualifiedUrl];
|
||||
|
||||
var dWidth = st['marker-width'] * 2 || img.width;
|
||||
var dHeight = (st['marker-height'] || dWidth) * (img.width / img.height);
|
||||
var dWidth = Math.min(st['marker-width'] * 2 || img.width, this.options.maxSpriteSize || 512);
|
||||
var dHeight = Math.min((st['marker-height'] || dWidth) * (img.width / img.height), this.options.maxSpriteSize || 512);
|
||||
|
||||
canvas.width = ctx.width = Math.min(dWidth, this.options.maxSpriteSize || 512);
|
||||
canvas.height = ctx.height = Math.min(dHeight, this.options.maxSpriteSize || 512);
|
||||
canvas.width = ctx.width = dWidth;
|
||||
canvas.height = ctx.height = dHeight;
|
||||
|
||||
ctx.scale(dWidth/img.width, dHeight/img.height);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user