void MidiKeyboardComponent::mouseDown (const MouseEvent& e)
{
    float mousePositionVelocity;
    auto newNote = xyToNote (e.position, mousePositionVelocity);

    if (newNote >= 0 && mouseDownOnKey (newNote, e))
    {
        updateNoteUnderMouse (e, true);
        shouldCheckMousePos = true;
    }
}
void MidiKeyboardComponent::mouseDown (const MouseEvent& e)
{
    float mousePositionVelocity;
    const int newNote = xyToNote (e.getPosition(), mousePositionVelocity);
    mouseDragging = false;

    if (newNote >= 0 && mouseDownOnKey (newNote, e))
    {
        repaintNote (noteUnderMouse);
        noteUnderMouse = -1;
        mouseDragging = true;

        updateNoteUnderMouse (e.getPosition());
        startTimer (500);
    }
}
예제 #3
0
void GuitarNeckComponent::mouseDown (const MouseEvent& e)
{
    float mousePositionVelocity;
    const FrettedNote newNote = xyToNote (e.getPosition(), mousePositionVelocity);
    mouseDragging = false;

	if (newNote.isValid() && mouseDownOnKey (newNote.fret,newNote.string, e))
    {
		//repaintNote (noteUnderMouse.fret);
		noteUnderMouse.invalidate();
        mouseDragging = true;

		currentlyFrettedFret[newNote.string]=newNote.fret;
        updateNoteUnderMouse (e.getPosition());
        startTimer (500);
		repaint();
    }
}