Beispiel #1
0
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 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);
}
Beispiel #3
0
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 PretzelRoot::onMouseWheel(ci::app::MouseEvent &event)
{
    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;
//        }
//    }
}
Beispiel #5
0
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;
        }
    }
}
Beispiel #6
0
    // Zoom code taken from Cinder::MayaCamUI
    bool Camera::mouseWheel(ci::app::MouseEvent m_event) {
        if (draw_interface_) 
            return false;

        float mouse_delta = m_event.getWheelIncrement() * zoom_speed_;
        //float direction = mouse_delta > 0.0f ? 1.0 : -1.0;
        
        float newCOI = powf( 2.71828183f, -mouse_delta / 500.0f ) * cam_->getCamera().getCenterOfInterest();
        ci::Vec3f oldTarget = cam_->getCamera().getCenterOfInterestPoint();
        ci::Vec3f newEye = oldTarget - cam_->getCamera().getViewDirection() * newCOI;
        ci::CameraPersp new_cam = cam_->getCamera();
        new_cam.setEyePoint( newEye );
        new_cam.setCenterOfInterest( newCOI );
        cam_->setCurrentCam(new_cam);

        return false;
    }
Beispiel #7
0
void App::mouseWheel(const ci::app::MouseEvent Event)
{
    for (auto&& listener : m_InputListeners) {
        listener->OnMouseWheel(Event.getWheelIncrement(), Event);
    }
}
Beispiel #8
0
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);
	}
}
Beispiel #9
0
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 ImGui_ImplCinder_ScrollCallback(ci::app::MouseEvent e)
{
    g_MouseWheel += e.getWheelIncrement();
}