Kineticjs:使用命中区域时,图像斯托克不可用



我使用Kineticjs命中区域,如建议:http://www.html5canvastutorials.com/kineticjs/html5-canvas-pixel-detection-with-kineticjs/

My Image has a stroke:

var lion = new Kinetic.Image({
          image: images.lion,
          x: 280,
          y: 30,
          stroke: "red" 
        });

当没有使用命中区域时,图像有一个笔画,但是当我使用以下内容时,我没有看到任何笔画。

    // in order to ignore transparent pixels in an image when detecting
    // events, we first need to cache the image
    lion.cache();
    // next, we need to redraw the hit graph using the cached image
    lion.drawHitFromCache();
    // finally, we need to redraw the layer hit graph
    layer.drawHit();

当我使用命中区域时,我如何获得图像可见的笔画?

如果你想要边框,你可以设置drawBorder属性为true:

lion.cache({
    drawBorder: true
});

干杯!

最新更新