| | | | Browse by category |
Question
How to make the select interactor select an object that intersects the drag rectangle?
Answer
You can subclass the IlvSelectInteractorMultipleSelection
class and override the selectObjects(IlvRect rect)
method. By default, this method selects all objects that are strictly inside the rectangle. You can choose to select any set of objects, including objects that intersect the rectangle. For example:
public class MultipleSelectInteractor extends IlvSelectInteractorMultipleSelection{
public MultipleSelectInteractor(IlvSelectInteractor inter) {
super(inter) ;
}
protected void selectObjects(IlvRect rect) {
getManager().mapIntersects( new IlvApplyObject() {
public void apply(IlvGraphic obj, Object arg) {
MultipleSelectInteractor inter = MultipleSelectInteractor)arg;
inter.selectObject(obj);
}}, this, rect, getTransformer());
}
}
Then you need to override IlvSelectInteractor
.getMultipleSelectionInteractor
() to return an instance of your multiple selection subclass.