Browse Source

Clean up ProjectionEditor from old comments

master
Krisjanis Rijnieks 9 years ago
parent
commit
6cd213a1a4
  1. 10
      src/UserInterface/ProjectionEditor.cpp

10
src/UserInterface/ProjectionEditor.cpp

@ -17,14 +17,11 @@ ProjectionEditor::~ProjectionEditor(){
} }
void ProjectionEditor::registerAppEvents(){ void ProjectionEditor::registerAppEvents(){
//ofAddListener(ofEvents().update, this, &ProjectionEditor::update);
ofAddListener(ofEvents().messageEvent, this, &ProjectionEditor::gotMessage); ofAddListener(ofEvents().messageEvent, this, &ProjectionEditor::gotMessage);
} }
void ProjectionEditor::unregisterAppEvents(){ void ProjectionEditor::unregisterAppEvents(){
//ofRemoveListener(ofEvents().update, this, &ProjectionEditor::update); ofRemoveListener(ofEvents().messageEvent, this, &ProjectionEditor::gotMessage);
ofRemoveListener(ofEvents().messageEvent, this,
&ProjectionEditor::gotMessage);
} }
void ProjectionEditor::enable(){ void ProjectionEditor::enable(){
@ -80,7 +77,7 @@ void ProjectionEditor::mouseDragged(ofMouseEventArgs & args){
for(int i = 0; i < surfaceManager->size(); i++){ for(int i = 0; i < surfaceManager->size(); i++){
BaseSurface * surface = surfaceManager->getSurface(i); BaseSurface * surface = surfaceManager->getSurface(i);
if(surface == surfaceManager->getSelectedSurface()){ if(surface == surfaceManager->getSelectedSurface()){
continue; // Don't add vertices of selected surface continue; // Don't add vertices of selected surface
} }
for(int j = 0; j < surface->getVertices().size(); j++){ for(int j = 0; j < surface->getVertices().size(); j++){
allVertices.push_back(&surface->getVertices()[j]); allVertices.push_back(&surface->getVertices()[j]);
@ -90,10 +87,8 @@ void ProjectionEditor::mouseDragged(ofMouseEventArgs & args){
// Snap currently dragged joint to nearest vertex // Snap currently dragged joint to nearest vertex
for(int i = 0; i < joints.size(); i++){ for(int i = 0; i < joints.size(); i++){
if(joints[i]->isDragged()){ if(joints[i]->isDragged()){
// Snap it!
for(int j = 0; j < allVertices.size(); j++){ for(int j = 0; j < allVertices.size(); j++){
float distance = mousePosition.distance(*allVertices[j]); float distance = mousePosition.distance(*allVertices[j]);
// cout << "distance: " << distance << endl;
if(distance < fSnapDistance){ if(distance < fSnapDistance){
joints[i]->position = *allVertices[j]; joints[i]->position = *allVertices[j];
ofVec2f clickDistance = joints[i]->position - ofVec2f(args.x, args.y); ofVec2f clickDistance = joints[i]->position - ofVec2f(args.x, args.y);
@ -107,7 +102,6 @@ void ProjectionEditor::mouseDragged(ofMouseEventArgs & args){
void ProjectionEditor::gotMessage(ofMessage & msg){ void ProjectionEditor::gotMessage(ofMessage & msg){
if(msg.message == "surfaceSelected"){ if(msg.message == "surfaceSelected"){
// refresh gui
clearJoints(); clearJoints();
createJoints(); createJoints();
} }

Loading…
Cancel
Save