1

使用jcanvas,我如何链接两个可拖动的图层以使它们一起移动。
在此处输入图像描述
例如。圆圈和文档图标是两个不同的层。我如何让它们
a) 在同一层上绘制或
b) 一起移动

  // document
      .drawArc({
      layer: true,
      groups: ['document'],
      fillStyle: 'yellow',
      x: 100, y: 250,
      radius: 50
      })

      .drawImage({
      groups: ['document'],
      source: "img/document.jpg",
      x: 100, y: 250,
      width:40, height: 40,
      layer: true
    })


    $('canvas').setLayerGroup('document', {
      draggable: true,
      bringToFront: true
    })
4

1 回答 1

0

您可以使用dragGroups:[]

代码在这里

    $('canvas').drawArc({
            layer: true,
            groups: ['document'],
            dragGroups: ['document'],
            draggable: true,
            fillStyle: 'yellow',
            x: 100, y: 250,
            radius: 50
        })

        .drawImage({
            groups: ['document'],
            dragGroups: ['document'],
            draggable: true,
            source: "img/document.jpg",
            x: 100, y: 250,
            width: 40, height: 40,
            layer: true
        }).drawLayers();
于 2015-06-12T09:37:48.153 回答