def onEnter(self, context): super(self.__class__, self).onEnter(context) self.positioner = self.newPositioner(context) targetIndex = DOMUtil.findIntersect( self.dropTarget, CoordinateLocation(context.mouseX, context.mouseY), self.getLocationWidgetComparator() ) self.insert(self.positioner, targetIndex)
def onMove(self, context): super(self.__class__, self).onMove(context) targetIndex = DOMUtil.findIntersect( self.dropTarget, CoordinateLocation(context.mouseX, context.mouseY), self.getLocationWidgetComparator() ) positionerIndex = self.dropTarget.getWidgetIndex(self.positioner) # check that positioner not already in the correct location if positionerIndex is not targetIndex and (positionerIndex is not targetIndex - 1 or targetIndex == 0): if positionerIndex == 0 and self.dropTarget.getWidgetCount() == 1: pass elif positionerIndex == 0 and self.dropTarget.getWidgetCount() == 1: pass elif targetIndex == -1: # outside drop target, so remove positioner to indicate a drop will not happen self.positioner.removeFromParent() else: self.insert(self.positioner, targetIndex)