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 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; } }
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 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; }
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 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 GraphNodeHandler::mouseDrag(ci::app::MouseEvent &event) { if (selection == Selection::move) { *position = event.getPos(); changed = true; } event.setHandled(selection == Selection::move); }
void GraphNodeHandler::mouseUp(ci::app::MouseEvent &event) { if (selection == Selection::move) { selection = Selection::none; event.setHandled(true); return; } event.setHandled(false); }
bool Camera::mouseDrag(ci::app::MouseEvent m_event) { /* if (draw_interface_) return false; */ cam_->mouseDrag(m_event.getPos(), m_event.isLeftDown(), m_event.isMiddleDown(), m_event.isRightDown()); return false; }
void ImGui_ImplCinder_MouseButtonCallback(ci::app::MouseEvent e, bool isDown) { ImGui_ImplCinder_MouseState state = isDown ? MouseState_Pressed : MouseState_Released; if (e.isLeft()) g_MousePressed[0] = state; else if (e.isRight()) g_MousePressed[1] = state; else if (e.isMiddle()) g_MousePressed[2] = state; }
void DialerT<T>::mouseWheel( ci::app::MouseEvent &event ) { if( isHit( event.getPos() ) ) { T value = *mValueRef + mZoneMultiplier*( signbit( event.getWheelIncrement() ) > 0 ? 1.0 : -1.0 ); setValue( max( min( value, mMax ), mMin ) ); if( (int)mTrigger & (int)Trigger::CHANGE ) { trigger(); } } }
void ColorPicker::mouseDrag( ci::app::MouseEvent &event ) { if( mHit ) { vec2 pt = event.getPos(); vec3 color = mColor.get( mFormat.mColorModel ); if( mFormat.mRelative ) { //COMMON vec2 delta = pt - mHitPoint; delta *= mFormat.mSensitivity; color.x += delta.x; //SPECIFIC if( mFormat.mColorModel == ColorModel::CM_HSV ) { color.x = color.x > 1.0 ? 0.0 : color.x < 0.0 ? 1.0 : color.x; color.y -= delta.y; } else { color.x = std::max( std::min( color.x, 1.0f ), 0.0f ); color.y += delta.y; } } else { //COMMON color.x = (float)event.getX() / (float)app::getWindow()->getWidth(); //SPECIFIC if( mFormat.mColorModel == ColorModel::CM_HSV ) { color.x = color.x > 1.0 ? 0.0 : color.x < 0.0 ? 1.0 : color.x; color.y = 1.0 - ( (float)event.getY() / (float)app::getWindow()->getHeight() ); } else { color.x = std::max( std::min( color.x, 1.0f ), 0.0f ); color.y = (float)event.getY() / (float)app::getWindow()->getHeight(); } } color.y = std::max( std::min( color.y, 1.0f ), 0.0f ); mColor.set( mFormat.mColorModel, vec4( color.x, color.y, color.z, mColor.a ) ); mHitPoint = pt; updateColorRef(); updateLabel(); setNeedsDisplay(); setState( State::DOWN ); if( (int)mTrigger & (int)Trigger::CHANGE ) { trigger(); } } else { setState( State::NORMAL ); } View::mouseDrag( event ); }
void SliderT<T>::input( ci::app::MouseEvent &event ) { vec2 hp = getHitPercent( event.getPos() ); hp.x = min( max( hp.x, 0.0f ), 1.0f ); float value = lmap<double>( hp.x, 0.0, 1.0, mMin, mMax ); if( mFormat.mSticky || event.isMetaDown() ) { value = ceil( value / mFormat.mStickyValue ) * mFormat.mStickyValue; } setValue( value ); }
void Game::mouseUp(ci::app::MouseEvent e) { int button; if (e.isLeft()) button = Button::LEFT; else if (e.isRight()) button = Button::RIGHT; else if (e.isMiddle()) button = Button::MIDDLE; else return; mEngine.mouseEvent(false, button); }
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 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; } } }
bool Cinder2DInteractItem::detect_click_selection(ci::app::MouseEvent mouse_event) { if (!detect_selection_) return false; Rect bounds = bounding_rect(); bounds *= scale().x; bounds += ci::Vec2f(position().x, position().y); if (bounds.isInside(ci::Vec2f(mouse_event.getX(), mouse_event.getY()))) { activate(Client::user_identity()); return true; } return false; }
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::onMouseWheel(ci::app::MouseEvent &event) { // TODO: this should only happen on the front gui. Make sure to hit test it though. // mGuiList[0]->mouseWheel( event.getWheelIncrement() ); for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){ PretzelGui *pg = *it; if( pg->getGlobalBounds().contains( event.getPos() ) ){ (*it)->mouseWheel( event.getWheelIncrement() ); break; } } }
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 ); }
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; }
bool Camera::mouseDown(ci::app::MouseEvent m_event) { if (draw_interface_) return false; cam_->mouseDown(m_event.getPos()); return false; }
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 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 TouchDebug::mouseDrag(const ci::app::MouseEvent& e) { if(mReplicating){ replicate(e, ds::ui::TouchInfo::Moved); } else if(mTwoTouching){ mEngine.mouseTouchMoved(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.mouseTouchMoved(mouseTwo, mTouchId + 1); } else { mEngine.mouseTouchMoved(e, mTouchId); } }
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 = ""; } }
void GesturesDemo::mouseWheel(ci::app::MouseEvent event) { double angle = (event.getWheelIncrement() > 0) ? 2 : -2; ci::Vec2f temp(getMousePos()); temp[0] /= getWindowWidth(); temp[1] /= getWindowHeight(); field.Rotate(0, temp, 0.5, angle); }
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; }