2016-10-13 11 views
0

各グループ内に2つのグループに円または四角形があります。ユーザーがどのグループがアクティブであるかを知るために、クリック時にグループを強調表示し、境界線を強調表示する必要があります。Konvajs Group Highlight with Border

答えて

1

これを実行する方法はたくさんあります。たとえば、次のように

group.on('click',() => { 
    // toggle selected, this is just our custom property 
    group.isSelected = !group.isSelected; 
    // hide or show selection box 
    selectionRect.visible(group.isSelected); 
    // set box size and position 
    selectionRect.setAttrs(group.getClientRect()); 
    layer.draw(); 
}) 

デモ:

+0

http://jsbin.com/nucopakijo/1/edit?html,js,outputは私がKonva.jsとその非常に良いでは初心者です、ありがとうございます。 – abhiklpm