draw2d icon indicating copy to clipboard operation
draw2d copied to clipboard

multiple selections with PanningSelectionPolicy

Open akoskm opened this issue 4 years ago • 5 comments

Is there any way to support multiple selection with PanningSelectionPolicy?

Ideally, I would like to have BoundingboxSelectionPolicy installed and I would like the selection to being when I press Shift.

If this is not doable I'm OK with selecting multiple elements, one-by-one, while holding Shift.

akoskm avatar Sep 06 '20 11:09 akoskm

Can I get some feedback here, is this supported @freegroup?

akoskm avatar Oct 10 '20 09:10 akoskm

I have created a custom function to do that while pressing the shift key I detect the click event on the node then added a selection to the canvas or get the current selection as an ArrayList then added the node then set the current selection with the new array

Samanoova avatar Jan 12 '21 11:01 Samanoova

Can you share some code here?

akoskm avatar Jan 12 '21 11:01 akoskm

let myCanvasPolicy = draw2d.policy.canvas.CanvasPolicy.extend({
  name: "MyCanvasPolicy",
  shiftSelection: new draw2d.util.ArrayList(),
  allowdSwimLane: null,
init: function(attr, setter, getter) {
    this._super(attr, setter, getter);
  },
onMouseUp: function(canvas, x, y, shiftKey, ctrlKey) {
let bestFigure = canvas.getBestFigure(x, y);
if(shiftKey==true){
// then you can use canvas.addSelection(bestFigure); or some thing like that 
}
}
})

then install the policy to your canvas

Samanoova avatar Jan 12 '21 11:01 Samanoova

Thanks, I'll give this a try. 🙇

akoskm avatar Jan 12 '21 11:01 akoskm