GUI: even more piano work

- don't allow piano window to be moved if clicking on piano
- only treat left click as a touch point
This commit is contained in:
tildearrow 2022-05-18 00:23:13 -05:00
parent cfa05143ab
commit 255fc4cc25
2 changed files with 3 additions and 0 deletions

View file

@ -2314,6 +2314,7 @@ void FurnaceGUI::processPoint(SDL_Event& ev) {
break; break;
} }
case SDL_MOUSEBUTTONDOWN: { case SDL_MOUSEBUTTONDOWN: {
if (ev.button.button!=SDL_BUTTON_LEFT) break;
for (size_t i=0; i<activePoints.size(); i++) { for (size_t i=0; i<activePoints.size(); i++) {
TouchPoint& point=activePoints[i]; TouchPoint& point=activePoints[i];
if (point.id==-1) { if (point.id==-1) {
@ -2332,6 +2333,7 @@ void FurnaceGUI::processPoint(SDL_Event& ev) {
break; break;
} }
case SDL_MOUSEBUTTONUP: { case SDL_MOUSEBUTTONUP: {
if (ev.button.button!=SDL_BUTTON_LEFT) break;
for (size_t i=0; i<activePoints.size(); i++) { for (size_t i=0; i<activePoints.size(); i++) {
TouchPoint& point=activePoints[i]; TouchPoint& point=activePoints[i];
if (point.id==-1) { if (point.id==-1) {

View file

@ -209,6 +209,7 @@ void FurnaceGUI::drawPiano() {
// render piano // render piano
//ImGui::ItemSize(size,ImGui::GetStyle().FramePadding.y); //ImGui::ItemSize(size,ImGui::GetStyle().FramePadding.y);
if (ImGui::ItemAdd(rect,ImGui::GetID("pianoDisplay"))) { if (ImGui::ItemAdd(rect,ImGui::GetID("pianoDisplay"))) {
ImGui::ItemHoverable(rect,ImGui::GetID("pianoDisplay"));
if (view) { if (view) {
int notes=oct*12; int notes=oct*12;
// evaluate input // evaluate input