Make the select interactor select an object that intersects the drag rectangle

Article ID: 2245
Last updated: 29 May, 2018
Article ID: 2245
Last updated: 29 May, 2018
Revision: 3
Views: 688
Posted: 02 Nov, 2010
by Dean J.
Updated: 29 May, 2018
by Gargani A.

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.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2245
Last updated: 29 May, 2018
Revision: 3
Views: 688
Posted: 02 Nov, 2010 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Also listed in


Others in this category