Esempio n. 1
0
bool ofxGuiPoints::mousePressed(int x, int y, int button)
{
	ofxPoint2f point = mouseToLocal(x, y);

	if(isPointInsideMe(point))
	{
		ofxPoint2f	inside	= fractionToValue(mouseToFraction(point));
		bool		onPoint	= isPointWithinDistance(inside);

		if(button == 2)
		{
			if(onPoint)
				mList.deleteActivePoint();
			else
				mList.addPointAtPosition(inside);
		}

		mMouseIsDown = true;
		mouseDragged(x, y, button);
	}
	else
	{
		mMouseIsDown = false;
	}

	return mMouseIsDown;
}
Esempio n. 2
0
bool ofxGuiFiles::mouseDragged(int x, int y, int button)
{
    if(mMouseIsDown && mNumberOfFiles > 0)
    {
        mSelected       = roundInt(fractionToValue(mouseToFraction(mouseToLocal(x, y)).x));
        mValue          = mFilelist.at(mSelected);
    }

    return mMouseIsDown;
}
Esempio n. 3
0
bool ofxGuiRadar::mouseDragged(int x, int y, int button)
{
	if(mMouseIsDown)
	{
		float value = fractionToValue(mouseToFraction(mouseToLocal(x, y)).x);
		
		if(value != mValue)
		{
			setValue(value);
			//mGlobals->mListener->handleGui(mParamId, kofxGui_Set_Float, &mValue, sizeof(float));
		}
	}
	
	return mMouseIsDown;
}
Esempio n. 4
0
bool ofxGuiPoints::mouseDragged(int x, int y, int button)
{
	if(mMouseIsDown)
	{
		ofxPoint2f	value	= mValue;
		ofxPoint2f	point	= fractionToValue(mouseToFraction(mouseToLocal(x, y)));

		if(mList.activePoint > -1)
		{
			if(mList.activePoint == 0)
			{
				point.x = mMinVal.x;
				mList.points[mList.activePoint] = point;
			}
			else if(mList.activePoint == mList.points.size() - 1)
			{
				point.x = mMaxVal.x;
				mList.points[mList.activePoint] = point;
			}
			else
			{
				if(point.x < mList.points[mList.activePoint - 1].x)
					point.x = mList.points[mList.activePoint - 1].x;
				else if(point.x > mList.points[mList.activePoint + 1].x)
					point.x = mList.points[mList.activePoint + 1].x;

				mList.points[mList.activePoint] = point;
			}
		}

		setValue(point);

		if(value != mValue)
		{
			mOutVal = mList.positionToValue(point);
			//mGlobals->mListener->handleGui(mParamId, kofxGui_Set_Point, &mOutVal, sizeof(ofxPoint2f));
			//mGlobals->mListener->handleGui(mParamId, kofxGui_Set_PointArray, &mList.points, sizeof(vector<ofxPoint2f>));
		}
	}

	return mMouseIsDown;
}