void TouchDebug::mouseDown(const ci::app::MouseEvent& e) { mReplicating = false; if(e.isAltDown()) { if(!mDropTouched){ mEngine.mouseTouchBegin(e, mTouchId + 2); mDropTouched = true; } else { mEngine.mouseTouchEnded(e, mTouchId + 2); mDropTouched = false; } } else if(e.isShiftDown()) { mReplicating = true; replicate(e, ds::ui::TouchInfo::Added); } else if(e.isControlDown()){ if(mTwoTouching){ mTwoTouching = false; } else { mTwoTouching = true; mTwoTouchDown = e.getPos(); } } else if(mTwoTouching){ mEngine.mouseTouchBegin(e, mTouchId); int deltaX = e.getPos().x - mTwoTouchDown.x; int deltaY = e.getPos().y - mTwoTouchDown.y; ci::app::MouseEvent mouseTwo = ci::app::MouseEvent(e.getWindow(), 0, mTwoTouchDown.x - deltaX, mTwoTouchDown.y - deltaY, e.getNativeModifiers(), e.getWheelIncrement(), e.getNativeModifiers()); mEngine.mouseTouchBegin(mouseTwo, mTouchId + 1); } else { mEngine.mouseTouchBegin(e, mTouchId); } }
void MultiSlider::mouseUp( ci::app::MouseEvent &event ) { if( mHit ) { #ifdef CINDER_COCOA_TOUCH setState( State::NORMAL ); #else if( isHit( event.getPos() ) ) { setState( State::OVER ); std::string newKey = getKey( event.getPos() ); if( newKey != mHoverKey ) { mHoverKey = newKey; changeState(); setNeedsDisplay(); } } else { setState( State::NORMAL ); } #endif if( (int)mTrigger & (int)Trigger::END ) { trigger(); } } mHitKey = ""; mHit = false; }
bool Monitor::mouseDrag( ci::app::MouseEvent event ) { switch( mMouseState ) { case MS_NOTHING : break; case MS_MOVE : { Vec2i diff = event.getPos() - mPosMouseDrag; mArea += diff; mPosMouseDrag = event.getPos(); } break; case MS_RESIZE : { Vec2i diff = event.getPos() - mPosMouseDrag; int width = math<int>::max( mArea.getWidth() + diff.x, mMinWidth ); int height = math<int>::max( mArea.getHeight() + diff.y, mMinHeight ); mArea.x2 = mArea.x1 + width; mArea.y2 = mArea.y1 + height; mPosMouseDrag = event.getPos(); } break; } return mMouseState != MS_NOTHING; }
bool XRect::mouseDownInternal( ci::app::MouseEvent event ) { bool hit = hitTest( event.getPos() ); if (hit && mScript) mScript->call("mouseDown", event.getPos().x, event.getPos().y); return hit; }
void PretzelRoot::onMouseDown(ci::app::MouseEvent &event) { PretzelGui *pg; // only click the top-most gui for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){ pg = *it; if( pg->getGlobalBounds().contains( event.getPos() ) ){ pg->mouseDown( event.getPos() ); break; } } // If this gui isn't on top, do z sorting to bring it up if( pg != mGuiList[0] ){ for( auto it = mGuiList.begin(); it!=mGuiList.end(); ){ if( *it == pg ){ it = mGuiList.erase(it); }else{ ++it; } } mGuiList.push_front(pg); } }
void DialerT<T>::mouseMove( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) ) { setState( State::OVER ); mHitPoint = event.getPos(); calculatePrecisionZone(); setNeedsDisplay(); } else { setState( State::NORMAL ); } }
void RangeT<T>::mouseDown( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) ) { mHit = true; setState( State::DOWN ); mHitValueHigh = mValueHigh; mHitValueLow = mValueLow; input( event.getPos() ); if( (int)mTrigger & (int)Trigger::BEGIN ) { trigger(); } } else { setState( State::NORMAL ); } }
void TextInput::mouseDown( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) ) { mHit = true; mClicked = true; setState( State::DOWN ); calculateCursorPosition( event.getPos() ); if( (int)mTrigger & (int)Trigger::BEGIN ) { trigger(); } } else { setState( State::NORMAL ); } }
void PretzelRoot::onMouseMoved(ci::app::MouseEvent &event) { // for( auto it=mGuiList.begin(); it!=mGuiList.end(); ++it){ // (*it)->mouseMoved( event.getPos() ); // } for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){ PretzelGui *pg = *it; if( pg->getGlobalBounds().contains( event.getPos() ) ){ (*it)->mouseMoved( event.getPos() ); break; } } }
void Button::mouseUp( ci::app::MouseEvent &event ) { if( mHit ) { #if defined( CINDER_COCOA_TOUCH ) setState( State::DOWN ); #else if( isHit( event.getPos() ) ) { setState( State::OVER ); } else { setState( State::NORMAL ); } #endif toggleValue(); if( (int)mTrigger & (int)Trigger::END ) { trigger(); } } else { setState( State::NORMAL ); } mHit = false; View::mouseUp( event ); }
void ColorPicker::mouseWheel( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) && !mHit ) { mColor.a -= event.getWheelIncrement() * mFormat.mSensitivity; mColor.a = std::max( std::min( mColor.a, mFormat.mAlphaLimits.y ), mFormat.mAlphaLimits.x ); updateColorRef(); updateLabel(); setNeedsDisplay(); if( (int)mTrigger & (int)Trigger::CHANGE ) { trigger(); } } else if( mHit ) { vec3 color = mColor.get( mFormat.mColorModel ); color.z -= event.getWheelIncrement() * mFormat.mSensitivity; color.z = std::max( std::min( color.z, 1.0f ), 0.0f ); mColor.set( mFormat.mColorModel, vec4( color.x, color.y, color.z, mColor.a ) ); updateColorRef(); updateLabel(); setNeedsDisplay(); if( (int)mTrigger & (int)Trigger::CHANGE ) { trigger(); } } }
void ColorPicker::mouseUp( ci::app::MouseEvent &event ) { if( mHit ) { #if defined( CINDER_COCOA_TOUCH ) setState( State::NORMAL ); #else if( isHit( event.getPos() ) ) { setState( State::OVER ); } else { setState( State::NORMAL ); } #endif mHit = false; updateLabel(); if( (int)mTrigger & (int)Trigger::END ) { trigger(); } } else { setState( State::NORMAL ); } View::mouseUp( event ); }
void GraphNodeHandler::mouseDown(ci::app::MouseEvent &event) { if (glm::length(*position - ci::vec2(event.getPos())) < size) { if (event.isAltDown()) { if (selection == Selection::addEdge) { selection = Selection::none; } else { selection = Selection::addEdge; selectedInFrame = ci::app::getElapsedFrames(); } } else { selection = Selection::move; } event.setHandled(true); } else { if (selection == Selection::move) selection = Selection::none; } }
bool Camera::mouseDown(ci::app::MouseEvent m_event) { if (draw_interface_) return false; cam_->mouseDown(m_event.getPos()); return false; }
void MultiSlider::mouseMove( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) ) { setState( State::OVER ); std::string newKey = getKey( event.getPos() ); if( newKey != mHoverKey ) { mHoverKey = newKey; changeState(); setNeedsDisplay(); } } else { setState( State::NORMAL ); mHoverKey = ""; } }
bool QTimeline::mouseDown( ci::app::MouseEvent event ) { if ( mSelectedMenu ) { if ( mSelectedMenu->isVisible() && mSelectedMenu->mouseDown(event) ) return true; else { mSelectedMenu->close(); mSelectedMenu = NULL; return true; } } for( size_t k=0; k < mTracks.size(); k++ ) mTracks[k]->mouseDown( event ); mCueManager->mouseDown( event ); // time bar handler mMouseDragTimeBar = mTimeBarRect.contains( event.getPos() ); mouseDrag( event ); return false; }
void RibbonPaint::mouseDrag( ci::app::MouseEvent event ) { if(_state != kStateNormal) return; // Not drawing lines, clear the frame if(_drawLines == false) ci::gl::clear( _clearColor ); // invisible if shift is helpd down if( event.isShiftDown() ) { // Store it the first time if(_alphaWhenDrawing > 0) { _oldAlphaWhenDrawing = _alphaWhenDrawing; } // make zero until they let go, or mouse up _alphaWhenDrawing = 0; } else { _alphaWhenDrawing = _oldAlphaWhenDrawing; } // start drawing lines _mousePosition = event.getPos(); _drawLines = true; }
void RangeT<T>::mouseUp( ci::app::MouseEvent &event ) { if( mHit ) { #ifdef CINDER_COCOA_TOUCH setState( State::NORMAL ); #else if( isHit( event.getPos() ) ) { setState( State::OVER ); } else { setState( State::NORMAL ); } #endif if( (int)mTrigger & (int)Trigger::END ) { trigger(); } } mHit = false; mHitHigh = false; mHitLow = false; mHitCenter = false; }
void RangeT<T>::mouseMove( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) ) { setState( State::OVER ); } else { setState( State::NORMAL ); } }
bool UserManager::mouseDrag( ci::app::MouseEvent event ) { RectMapping mapping( mSourceBounds, mOutputRect ); if ( mUsers.find( 0 ) != mUsers.end() ) mUsers[ 0 ]->addPos( XN_SKEL_LEFT_HAND, mapping.map( event.getPos() ) ); return true; }
void TouchManager::mouseTouchBegin(const ci::app::MouseEvent &event, int id){ ci::Vec2f globalPos = translateMousePoint(event.getPos()); if(shouldDiscardTouch(globalPos)){ return; } inputBegin(id, globalPos); }
void ColorPicker::mouseDown( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) ) { mHit = true; mHitPoint = event.getPos(); updateLabel(); setState( State::DOWN ); if( (int)mTrigger & (int)Trigger::BEGIN ) { trigger(); } } else { setState( State::NORMAL ); } View::mouseDown( event ); }
void XYPad::mouseDown( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) ) { mHit = true; setState( State::DOWN ); input( event.getPos() ); if( (int)mTrigger & (int)Trigger::BEGIN ) { trigger(); } } else { setState( State::NORMAL ); } }
void DialerT<T>::mouseDrag( ci::app::MouseEvent &event ) { if( mHit ) { setState( State::DOWN ); input( event.getPos() ); mHitPoint = event.getPos(); if( (int)mTrigger & (int)Trigger::CHANGE ) { trigger(); } } else { setState( State::NORMAL ); } }
bool Monitor::mouseDown( ci::app::MouseEvent event ) { if( mArea.contains( event.getPos())) { mPosMouseDrag = event.getPos(); if( mArea.getLR().distance( mPosMouseDrag ) < 10.0f ) mMouseState = MS_RESIZE; else mMouseState = MS_MOVE; } else { mMouseState = MS_NOTHING; } return mMouseState != MS_NOTHING; }
bool UserManager::mouseDown( ci::app::MouseEvent event ) { mUsers[ 0 ] = UserRef( new User( this )); mUsers[ 0 ]->addStroke( XN_SKEL_LEFT_HAND ); RectMapping mapping( mSourceBounds, mOutputRect ); mUsers[ 0 ]->addPos( XN_SKEL_LEFT_HAND, mapping.map( event.getPos() ) ); return true; }
void GraphNodeHandler::mouseDrag(ci::app::MouseEvent &event) { if (selection == Selection::move) { *position = event.getPos(); changed = true; } event.setHandled(selection == Selection::move); }
void BSplineEditor::mouseMove( ci::app::MouseEvent &event ) { View::mouseMove( event ); if( isHit( event.getPos() ) ) { setState( State::OVER ); } else { setState( State::NORMAL ); } }
bool QTimeline::mouseMove( ci::app::MouseEvent event ) { mMouseOnTrack.reset(); if ( mSelectedMenu && mSelectedMenu->isVisible() && mSelectedMenu->mouseMove(event) ) return true; for( size_t k=0; k < mTracks.size(); k++ ) if ( mTracks[k]->mouseMove( event ) ) mMouseOnTrack = mTracks[k]; mCueManager->mouseMove( event ); mMousePrevPos = event.getPos(); mMouseOnTimeBar = mTimeBarRect.contains( event.getPos() ); return false; }
void TextInput::mouseMove( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) ) { setState( State::OVER ); } else { mClicked = false; setState( State::NORMAL ); } }