void ofxMSAInteractiveObject::_mouseDragged(ofMouseEventArgs &e) { int x = e.x; int y = e.y; int button = e.button; if(verbose) printf("ofxMSAInteractiveObject::_mouseDragged(x: %i, y: %i, button: %i)\n", x, y, button); if(!enabled) return; _mouseX = x; _mouseY = y; _mouseButton = button; if(hitTest(x, y)) { // if mouse is over the object if(!_mouseOver) { // if wasn't over previous frame // onPress(x, y); // call onPress - maybe not _mouseOver = true; // update flag } onDragOver(x, y, button); // and trigger onDragOver } else { if(_mouseOver) { // if mouse is not over the object, but the flag is true (From previous frame) onRollOut(); // call onRollOut _mouseOver = false; // update flag } if(_mouseDown) { onDragOutside(x, y, button); } } }
//-------------------------------------------------------------- void ofxMSAInteractiveObject::_mouseDragged(ofMouseEventArgs &e) { int x = e.x; int y = e.y; int button = e.button; if(verbose) printf("ofxMSAInteractiveObject::_mouseDragged(x: %i, y: %i, button: %i)\n", x, y, button); if(!enabled) { _isMousePressed[button] = false; return; } if(hitTest(x, y)) { // if mouse is over the object if(!_isMouseOver) { // if wasn't over previous frame // onPress(x, y); // call onPress - maybe not _isMouseOver = true; // update flag onRollOver(x, y); // call onRollOver } onDragOver(x, y, button); // and trigger onDragOver } else { if(_isMouseOver) { // if mouse is not over the object, but the flag is true (From previous frame) onRollOut(); // call onRollOut _isMouseOver = false; // update flag } if(isMousePressed(button)) { onDragOutside(x, y, button); } _isMousePressed[button] = false; } _stateChangeTimestampMillis = ofGetElapsedTimeMillis(); mouseDragged(x, y, button); }
void MyPanel::onDragOutside(int x, int y, int button){ onDragOver(x, y, button); }
//--------------------------------------------------------------------- void ofxSimpleGuiQuadWarp::onDragOutside(int x, int y, int button) { onDragOver(x, y, button); }