Move to 90° along the circle, not 0°

This commit is contained in:
Andreas Hocevar
2016-08-29 09:16:55 +02:00
parent 5d00edfc1d
commit 2037e725b3
3 changed files with 21 additions and 1 deletions

View File

@@ -313,7 +313,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
var dx = x2 - x1;
var dy = y2 - y1;
var r = Math.sqrt(dx * dx + dy * dy);
context.moveTo(x2, y2);
context.moveTo(x1 + r, y1);
context.arc(x1, y1, r, 0, 2 * Math.PI, true);
++i;
break;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -96,6 +96,26 @@ describe('ol.rendering.layer.Vector', function() {
});
});
it('renders rotation correctly with the canvas renderer', function(done) {
map = createMap('canvas');
map.getView().setRotation(Math.PI + Math.PI / 4);
addPolygon(300);
addCircle(500);
map.addLayer(new ol.layer.Vector({
source: source,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
width: 2,
color: 'black'
})
})
}));
map.once('postrender', function() {
expectResemble(map, 'spec/ol/layer/expected/vector-canvas-rotated.png',
1.7, done);
});
});
it('renders fill/stroke batches correctly with the canvas renderer', function(done) {
map = createMap('canvas');
source = new ol.source.Vector({