//-------------------------------------------------------------- void ofxMSAInteractiveObject::_mouseMoved(ofMouseEventArgs &e) { int x = e.x; int y = e.y; int button = e.button; if(doCoordTransformation){ ofVec2f transformedCoord = screenToCanvas(ofVec2f(x,y)); x = transformedCoord.x; y = transformedCoord.y; } if(verbose) printf("ofxMSAInteractiveObject::_mouseMoved(x: %i, y: %i)\n", x, y); if(!enabled) return; // _mouseX = x; // _mouseY = y; if(hitTest(x, y)) { // if mouse is over the object if(!_isMouseOver) { // if wasn't over previous frame _isMouseOver = true; // update flag onRollOver(x, y); // call onRollOver } onMouseMove(x, y); // and trigger onMouseMove } 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 } _stateChangeTimestampMillis = ofGetElapsedTimeMillis(); mouseMoved(x, y); }
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 ofxMSAInteractiveObject::_mouseMoved(ofMouseEventArgs &e) { int x = e.x; int y = e.y; int button = e.button; if(verbose) printf("ofxMSAInteractiveObject::_mouseMoved(x: %i, y: %i)\n", x, y); if(!enabled) return; _mouseX = x; _mouseY = y; if(hitTest(x, y)) { // if mouse is over the object if(!_mouseOver) { // if wasn't over previous frame onRollOver(x, y); // call onRollOver _mouseOver = true; // update flag } onMouseMove(x, y); // and trigger onMouseMove } 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 } }