Jcrop FabricJS image object: move/scale limit

186 views Asked by At

I'm doing crop image object on FabrijcJS. Here I am using Jcrop, but I have a problem is when I move/scale crop designated areas, it is moved out of the active object. Please help me one solution: crop frame only move inside the active object

enter image description here

    var object = canvas.getActiveObject();

    function updatePreview(c) {
        if (parseInt(c.w) > 0) {
        }
    }

    $('#c').Jcrop({
        onSelect: updatePreview,
        onChange: updatePreview,
        allowSelect: false,
        allowMove: false,
        allowResize: true,
        setSelect: [object.left, object.top, object.left + object.width * object.scaleX, object.top + object.height * object.scaleY],
        aspectRatio: 0,
        minSize: [1, 1],
        maxSize: [object.width * object.scaleX, object.height * object.scaleY]
    });    
0

There are 0 answers