我正在使用 KineticJS 并试图获得适当的缩放功能。我有一个图层,我在我想要的原始尺寸上附加了一个背景图像。
但是,当我放大(通过 layer.setScale())时,我的图像在与其他所有内容一起放大时会缩小(留下暴露的白色区域)。
那么即使发生这种情况,我怎样才能让我的图像重复呢?这是我用来添加图像的代码:
var imageObj = new Image();
imageObj.onload = function() {
var image = new Kinetic.Image({
image: imageObj,
width: width,
height: height
});
// add the shape to the layer
main_layer.add(image);
// add the layer to the stage
stage.add(main_layer);
};
imageObj.src = 'images/blueprint_background.png';