Canvas that cannot be selected in all areas at startup

see http://liveweave.com/CQJDKc

when you click on the back of the image, that is, the image with girl and boys doing u waill will not be able to drag or select the canvas group, but when u clik on the strip of the sunshine area can be selected and can be dragged.

but as soon as you select the canvas element and drag it, the whole canvas becomes selectable, why can't the problem with starngle figure out? ..

fabric.Image.fromURL('http://www.gettyimages.com/CMS/Pages/ImageCollection/StaticContent/image1_%20164248809.jpg', function (img) {
        var img1 = img.set({
            left: 0,
            top: 0
        });
        fabric.Image.fromURL('http://upload.wikimedia.org/wikipedia/commons/c/c3/Aurora_as_seen_by_IMAGE.PNG', function (img) {
            var img2 = img.set({
                left: 0,
                top: 0
            });
            group = new fabric.Group([img1, img2], {
                left: 0,
                top: 0,
                originX: 'center',
                originY: 'center'
            });
            canvas.add(group);
            group.center();
            //group.hasRotatingPoint=true;
            //group.lockMovementX = group.lockMovementY = true;
            group.lockUniScaling = true;
            group.hasBorders = group.hasControls= false;
            //group.selectable = false;
            canvas.renderAll();
        });
    });

      

+3


source to share


1 answer


I'm not sure what exactly this is causing your problem, but I think your only problem is that you are positioning the group in the center and the canvas does not make it look pretty.

Removing the group from the canvas after positioning it to the center and then adding the group to the canvas again solves your problem. here demo http://liveweave.com/lcCAFH



 canvas.add(group);
                group.center();
              canvas.remove(group);
              canvas.add(group);

      

hope this helps

+1


source







All Articles