In principle it looks like your method should work. If you have a maximum of 7 objects and can do the drag and drop for when all seven are showing then you could just leave the code as is and accept the possibility that participants might occasionally drag invisible objects. Alternatively you could check the opacity of the object and only select it if the value is 1.