Javascript 小图像的Kineticjs

Javascript 小图像的Kineticjs,javascript,kineticjs,Javascript,Kineticjs,我有这个简单的代码,我想设置图像的最小宽度和最小高度,我设置了最小高度和最小宽度,当达到这些限制时,标记会按我的意愿关闭,但是当我单击图像时,标记会出现在不同的位置,我无法放大我的照片 if (width && height) { if (MIN_WIDTH < width || MIN_HEIGHT < height) { image.setSize(width, height); } else { group.chi

我有这个简单的代码,我想设置图像的最小宽度和最小高度,我设置了最小高度和最小宽度,当达到这些限制时,标记会按我的意愿关闭,但是当我单击图像时,标记会出现在不同的位置,我无法放大我的照片

if (width && height) {
    if (MIN_WIDTH < width || MIN_HEIGHT < height) {
        image.setSize(width, height);
    } else {
        group.children[1].hide();
        group.children[2].hide();
        group.children[3].hide();
        group.children[4].hide();
        $(".toSmall").dialog({
            modal: true,
            width: 350,
            height: 180,
            buttons: {
                "OK": function() {
                    $(this).dialog("close");
                    image.setSize(image.width, image.height);
                    console.log(activeAnchor.attrs.draggable = false);
                    activeAnchor.attrs.x *= 2;
                    activeAnchor.attrs.y *= 2;
                    image.off('click');
                    // activeAnchor.setDragOnTop(false);
                    // activeStage.draw();
                }
            }
        });
    }
}
if(宽度和高度){
if(最小宽度<宽度<最小高度<高度){
图像。设置大小(宽度、高度);
}否则{
group.children[1].hide();
group.children[2].hide();
group.children[3].hide();
group.children[4].hide();
$(“.toSmall”)。对话框({
莫代尔:是的,
宽度:350,
身高:180,
按钮:{
“OK”:函数(){
$(此).dialog(“关闭”);
image.setSize(image.width、image.height);
log(activeAnchor.attrs.draggable=false);
activeAnchor.attrs.x*=2;
activeAnchor.attrs.y*=2;
image.off('click');
//activeAnchor.setDragOnTop(假);
//activeStage.draw();
}
}
});
}
}

我找到了自己的解决方案

if (width && height) {
    if (MIN_WIDTH < width || MIN_HEIGHT < height) {
        image.setSize(width, height);
    } else {
        $(".toSmall").dialog({
            modal: true,
            width: 350,
            height: 180,
            buttons: {
                "OK": function() {
                    activeAnchor.hide();
                    activeAnchor.attrs.y *= 2;
                    image.off('click');
                    $(this).dialog("close");
                    update(activeAnchor);
                    activeStage.draw();
                }
            }
        });
    }
}
if(宽度和高度){
if(最小宽度<宽度<最小高度<高度){
图像。设置大小(宽度、高度);
}否则{
$(“.toSmall”)。对话框({
莫代尔:是的,
宽度:350,
身高:180,
按钮:{
“OK”:函数(){
activeAnchor.hide();
activeAnchor.attrs.y*=2;
image.off('click');
$(此).dialog(“关闭”);
更新(activeAnchor);
activeStage.draw();
}
}
});
}
}