Example #1
0
	//----------
	void Scene::mousePressed(ofMouseEventArgs & args) {
		this->updateCursor();
		this->cursor.start(args.button);
		this->cursor.captured = args.button == 0 && !ofGetKeyPressed();
		this->cursor.dragged = false;
		
		this->getElementUnderCursor().cursorDown(cursor);
		
//		if (this->inspector.getShape().inside(this->cursor.screen.x, this->cursor.screen.y)) {
//			
//			//we're inside the gui
//			cursor.captured = true;
//			
//			//horrible hack to stop mouse clicks in gui affecting node selection
//			cursor.dragged = true;
//		}
		
		isSettingOrigin = ofGetModifierPressed(OF_KEY_ALT);
		cursor.captured |= isSettingOrigin;
		
		if (cursor.captured) {
			this->camera->setMouseActions(false);
		}
			
		this->lockIndex = true;
	}
Example #2
0
void dt_ui_home::singleClickStart(int x, int y, int button) {
    if( !mode_check() )
        return;

    app = ofApp::app;
    ofVec2f mpw = app->cam.screenToWorld( ofVec2f(x,y) );
    dt_circle_base * c = app->all_containers.note_on_container->getTouchedCircle( mpw );
    if( c ) {
        // circle -> select
        dt_circle_base::selected_circle = c;
    } else {
        bool bShift = ofGetModifierPressed( OF_KEY_SHIFT );
        if( !bShift ) {
            // canvas -> create new circle
            dt_circle_note_on * nc = new dt_circle_note_on();
            nc->setup(ofRandom( dt_config::DT_RHYTHM_SHAPE_SLOT_MIN, dt_config::DT_RHYTHM_SHAPE_SLOT_MAX) );
            nc->data.position = mpw;
            app->all_containers.circle_base_container->addCircle( nc );
            app->all_containers.note_on_container->addCircle( nc );
            dt_circle_base::selected_circle = nc;
        }
    }
    app->update_cocoa_ui();
}
//COMMAND on OS X, CTRL on Windows
//----------------------------------------
bool ofGetModifierShortcutKeyPressed(){
	return ofGetModifierPressed(OF_MODIFIER_KEY_CTRL);
}