diff --git a/src/ofxBaseJoint.cpp b/src/ofxBaseJoint.cpp index 4e1439e..311a59a 100644 --- a/src/ofxBaseJoint.cpp +++ b/src/ofxBaseJoint.cpp @@ -14,6 +14,7 @@ ofxBaseJoint::~ofxBaseJoint() void ofxBaseJoint::mousePressed(int x, int y, int button) { if ( hitTest(ofVec2f(x, y)) ) { + selected = true; clickDistance = position - ofVec2f(x, y); startDrag(); } @@ -47,8 +48,10 @@ bool ofxBaseJoint::isDragged() void ofxBaseJoint::setDefaultColors() { - fillColor = ofColor(0,255,255); - strokeColor = ofColor(255,255,255); + fillColor = ofColor(0, 255, 255); + strokeColor = ofColor(255, 255, 255); + fillColorSelected = ofColor(255, 255, 0); + strokeColorSelected = ofColor(255, 0, 0); } void ofxBaseJoint::setDefaultProperties() diff --git a/src/ofxBaseJoint.h b/src/ofxBaseJoint.h index 3f3d0e6..7fc8495 100644 --- a/src/ofxBaseJoint.h +++ b/src/ofxBaseJoint.h @@ -27,8 +27,10 @@ public: protected: ofColor fillColor; ofColor strokeColor; + ofColor fillColorSelected; + ofColor strokeColorSelected; float strokeWidth; - ofVec2f clickDistance; + ofVec2f clickDistance; // How far from the center of the joint the user has clicked? bool dragging; private: diff --git a/src/ofxCircleJoint.cpp b/src/ofxCircleJoint.cpp index 82165af..4abbc5c 100644 --- a/src/ofxCircleJoint.cpp +++ b/src/ofxCircleJoint.cpp @@ -17,10 +17,22 @@ void ofxCircleJoint::draw() ofPushStyle(); ofFill(); - ofSetColor(fillColor); + + if ( selected ) { + ofSetColor(fillColorSelected); + } else { + ofSetColor(fillColor); + } + ofCircle(position.x, position.y, radius); ofNoFill(); - ofSetColor(strokeColor); + + if ( selected ) { + ofSetColor(strokeColorSelected); + } else { + ofSetColor(strokeColor); + } + ofSetLineWidth(strokeWidth); ofCircle(position.x, position.y, radius); ofPopStyle(); diff --git a/src/ofxSurfaceGui.cpp b/src/ofxSurfaceGui.cpp index 32dad03..e36eb8e 100644 --- a/src/ofxSurfaceGui.cpp +++ b/src/ofxSurfaceGui.cpp @@ -57,10 +57,12 @@ void ofxSurfaceGui::mousePressed(int x, int y, int button) if (mode == PROJECTION_MAPPING) { for ( int i=0; i