KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

caching scaled image on kinetic 5.1.0

Open pfautrero opened this issue 10 years ago • 4 comments

Hi, I just tried to cache an image like this :

myImage = new Kinetic.Image({
            image: rasterObj,
            x: parseFloat(detail.x) * iaScene.coeff,
            y: parseFloat(detail.y) * iaScene.coeff,
            width: detail.width,
            height: detail.height,
            scale: {x: iaScene.coeff, y: iaScene.coeff}
        }); 
myImage.cache();

Unfortunately, scale ratio is not properly managed by cache system. In the source code of cache function, pixelRatio is hardcoded to 1. If I set it to the iaScene.coeff, the image looks good (width and height are wrong and must be devided by iaScene.coeff...).

Is there any workaround ? You confirm it is a bug ?

Regards,

Pascal

pfautrero avatar Apr 10 '14 09:04 pfautrero

Can you provide demo? This example works fine: http://jsbin.com/garas/1/edit

lavrton avatar Apr 10 '14 09:04 lavrton

Here it is : http://jsfiddle.net/3YV4t/

pfautrero avatar Apr 10 '14 10:04 pfautrero

You are right. My demo using v5.0.1. Same bug with v5.1.0

lavrton avatar Apr 10 '14 10:04 lavrton

+1 I have the same problem

confile avatar Nov 10 '14 09:11 confile