fixed rectangle renderer #14

This commit is contained in:
javi 2014-06-02 18:05:10 +02:00
parent 3452e279d1
commit 6662098f48
3 changed files with 9 additions and 6 deletions

2
NEWS
View File

@ -1,3 +1,5 @@
2.4.01
- fixed rectangle anchor and size #42
2.4.00 - May/22/2014
- Changed date parsing for windshaft provider
- Optimized tile loading

View File

@ -43,12 +43,13 @@
ctx.fillStyle = st.fillStyle;
ctx.strokStyle = st.strokStyle;
var pixel_size = st['point-radius'];
var w = pixel_size * 2;
// fill
if (st.fillStyle && st.fillOpacity) {
ctx.globalAlpha = st.fillOpacity;
}
ctx.fillRect(0, 0, pixel_size, pixel_size)
ctx.fillRect(-pixel_size, -pixel_size, w, w)
// stroke
ctx.globalAlpha = 1.0;
@ -63,7 +64,7 @@
// do not render for alpha = 0
if (ctx.globalAlpha > 0) {
ctx.strokeRect(0, 0, pixel_size, pixel_size);
ctx.strokeRect(-pixel_size, -pixel_size, w, w)
}
}
}

View File

@ -71,14 +71,14 @@
throw new Error("marker-width property should be set");
}
var canvas = document.createElement('canvas');
// take into account the exterior ring to calculate the size
var canvasSize = (st.lineWidth || 0) + pointSize*2;
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var w = ctx.width = canvas.width = Math.ceil(canvasSize);
ctx.height = canvas.height = Math.ceil(canvasSize);
var w = ctx.width = canvas.width = ctx.height = canvas.height = Math.ceil(canvasSize);
ctx.translate(w/2, w/2);
if(st['point-file'] || st['marker-file']) {
torque.cartocss.renderSprite(ctx, st);
} else {