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; }
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; }
bool ofxGuiColor::mousePressed(int x, int y, int button) { ofxPoint2f inside = mouseToLocal(x, y); mMouseIsDown = isPointInsideMe(inside); if(mMouseIsDown) { mSlider = mouseToSlider(mouseToFraction(inside).y); mouseDragged(x, y, button); } return mMouseIsDown; }
bool ofxGuiColor::mouseDragged(int x, int y, int button) { if(mMouseIsDown) { // int value = mValue.toInt(mDisplay); mValue.setChanel(mSlider, mouseToFraction(mouseToLocal(x, y)).x); // if(mValue.toInt(mDisplay) != value) mGlobals->mListener->handleGui(mParamId, kofxGui_Set_Color, &mValue, sizeof(ofRGBA)); } return mMouseIsDown; }
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; }
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; }
bool ofxGuiMatrix::mousePressed(int x, int y, int button) { ofPoint inside = mouseToLocal(x, y); mMouseIsDown = isPointInsideMe(inside); if(mMouseIsDown) { int id = mouseToPadId(mouseToFraction(inside)); if (mDisplay == kofxGui_Button_Trigger) mBuffer[id] |= kofxGui_Matrix_Set; // = 1; else mBuffer[id] ^= kofxGui_Matrix_Set; // !mBuffer[id]; setValue(id); ofCell outVal = ofCell(mValue, mBuffer[mValue]); mGlobals->mListener->handleGui(mParamId, kofxGui_Set_Cell, &outVal, sizeof(ofCell)); } return mMouseIsDown; }