1

我创建了一个图像,我想整体拖动这个图像,以及如何做,希望有人能帮助我,谢谢

    var paper=Raphael("canvas",1000,1000);
            var draggableset = paper.set();

            var rect3042 = paper.rect(358.57144, 655.64789, 28.571428, 234.28575);
            rect3042.attr({id: 'rect3042',x: '358.57144',y: '655.64789' ,fill: '#ff0000',display: 'inline','stroke-width': '0','stroke-opacity': '1'}).data('id', 'rect3042');
            var path3044 = paper.path("m -48.57143,752.36218 a 57.142857,62.857143 0 1 1 -114.28571,0 57.142857,62.857143 0 1 1 114.28571,0 z");
            path3044.attr({id: 'path3044', fill: '#ff0000',display: 'inline','stroke-width': '0','stroke-opacity': '1'});
            path3044.transform("m1,0,0,-1,480.57147,1658.5815").data('id', 'path3044');
            var path3153 = paper.path("m -1051.4286,703.79077 a 58.57143,57.142857 0 1 1 -117.1428,0 58.57143,57.142857 0 1 1 117.1428,0 z");
            path3153.attr({id: 'path3153', fill: '315.00002766003-#ffffff:0-#ffffff:100','fill-opacity': '1',"fill-opacity": '1','stroke-width': '0','stroke-opacity': '1'});
            path3153.transform("m-0.64362098,-0.3480627,0.39244069,-0.72568265,-621.47254,1020.1699").data('id', 'path3153');


            draggableset.push(rect3042);
            draggableset.push(path3044);
            draggableset.push(path3153);

            var start = function () {
                draggableset.oBB = draggableset.getBBox();
            },
            move = function (dx, dy) {
                var bb = draggableset.getBBox();
                draggableset.translate(draggableset.oBB.x - bb.x + dx, draggableset.oBB.y - bb.y + dy);
            },
            up = function () {

            };

            draggableset.drag(move, start, up);

可以拖拽,但不能整体拖拽

4

0 回答 0