Kineticjs以小图像

时间:2013-08-10 19:55:59

标签: javascript kineticjs

我有这个简单的代码,我想设置图像的最小宽度和最小高度,我设置为min。高度和分钟。宽度,当涉及到这些限制时,我想要关闭标签,但是当我点击图像时,标签出现在不同的地方,我无法放大我的照片..

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();
                }
            }
        });
    }
}

1 个答案:

答案 0 :(得分:0)

我找到了自己的解决方案

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();
                }
            }
        });
    }
}