简体   繁体   English

与jcanvas一起移动两层

[英]move two layers together with jcanvas

using jcanvas , how do i link two draggable layers such that they move together. 使用jcanvas ,我如何链接两个可拖动层,使它们一起移动。
在此处输入图片说明
eg. 例如。 the circle and document icon are two diff layers. 圆圈和文档图标是两个差异层。 how do i have them 我怎么有他们
a) draw on the same layer or a)在同一层上绘制或
b) move together 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
    })

You can do it using dragGroups:[] 您可以使用dragGroups:[]

Code here 在这里编码

    $('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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM