示例#1
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 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;
}