我正在将图像导入一个组,但是当我稍后尝试调整它们的大小时,我没有得到任何响应(调整组的大小对图像没有影响)。图片是这样写的:
var myBGgroup1 = new Kinetic.Group({
x: Math.round((stage.getWidth()/12)*2),
y: 0,
id: 'BGimg1'
});
//add image:
var imageObjBG1 = new Image();
imageObjBG1.onload = function() {
var graphicBG1 = new Kinetic.Image({
x: 0,
y: 0,
Image: imageObjBG1,
width: bgW,
height: bgH
});
myBGgroup1.add(graphicBG1);
};
//add image again, above it, for retiling:
var imageObjBG1b = new Image();
imageObjBG1b.onload = function() {
var graphicBG1b = new Kinetic.Image({
x: 0,
y: -bgH,
Image: imageObjBG1b,
width: bgW,
height: bgH
});
myBGgroup1.add(graphicBG1b);
};
imageObjBG1.src = imageObjBG1b.src = 'Content/images/buttons/canvas2_bgDots1.svg'
我试过 setWidth 和 setHeight,也试过 setScale,指的是 'graphicBG1' 或 'imageObjBG1' - 无济于事。我应该使用路径,例如'myBGgroup1.graphicBG1'还是什么?