Why does adding few more lines to the Group
object results in such blurrying effect?
Note that having a single line in a group doesn't result in such behavior. It seems that it reproduces only with several lines.
Here's the code to reproduce the bug (you can try it online here -- https://jsfiddle.net/90tw8mfs/, zoom a little and you'll see what I'm talking about):
var canvas = new fabric.Canvas('c');
function addFirstGroup() {
var firstLine = new fabric.Line([0, 0, 0, 100], {
strokeLineCap: 'round',
strokeWidth: 2,
stroke: '#070B7D'
});
var group = new fabric.Group([firstLine], {
left: 100,
top: 100
});
canvas.add(group);
}
function addSecondGroup() {
var firstLine = new fabric.Line([0, 0, 0, 100], {
strokeLineCap: 'round',
strokeWidth: 2,
stroke: '#070B7D'
});
var secondLine = new fabric.Line([0, 100, 100, 100], {
strokeLineCap: 'round',
strokeWidth: 2,
stroke: '#070B7D'
});
var thirdLine = new fabric.Line([100, 100, 100, 0], {
strokeLineCap: 'round',
strokeWidth: 2,
stroke: '#070B7D'
});
var group = new fabric.Group([firstLine, secondLine, thirdLine], {
left: 100,
top: 300
});
canvas.add(group);
}
addFirstGroup();
addSecondGroup();
$('#canvas-wrapper').mousewheel(function(e) {
if (e.originalEvent.deltaY < 0) {
var newZoom = canvas.getZoom() + 0.1;
} else {
var newZoom = canvas.getZoom() - 0.1;
}
canvas.setZoom(newZoom);
});
Why? How can I fix it?