[英]kineticjs group cache and layer draw is hiding kinetic arc shapes
我正在创建一个由一组运动弧组成的圆。 当我缓存组并随后在图层上调用绘制函数时,圆的四分之三被隐藏了。 我认为layer.draw可能需要偏移量,但实际上我只是在猜测。 当我从圆弧中删除填充,笔触或不透明度或从缓存调用中删除对象文字时,将显示整个圆圈。 http://jsfiddle.net/leydar/gm2FT/5/感激收到任何见解。
function createArc(n){
var arc = new Kinetic.Arc({
innerRadius: 30,
outerRadius: 50,
/* if I remove the fill, stroke or opacity
the full wheel is correctly displayed */
fill: 'blue',
stroke: 'black',
opacity: 0.3,
strokeWidth: 1,
angle: 36,
rotation: 36*n
});
return arc;
}
function init() {
var arc;
var stage = new Kinetic.Stage({
container: 'container',
width: 104,
height: 104
});
var layer = new Kinetic.Layer();
var circle = new Kinetic.Group();
for(var i=0;i<10;i++) {
arc = createArc(i);
circle.add(arc);
};
layer.add(circle);
stage.add(layer);
/* if I do not cache or do not call layer.draw()
then again the wheel is correctly displayed */
circle.cache({
x: -52,
y: -52,
width: 104,
height: 104,
drawBorder: true
});
layer.draw();
}
init();
史提芬
这是KineticJS的错误。 您可以使用以下解决方法:
Kinetic.Arc.prototype._useBufferCanvas = function() {
return false;
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.