- switch (event->type) {
- case SDL_MOUSEBUTTONDOWN: {
- Point position = vec((float) event->button.x, (float) event->button.y);
- if (rect_contains_point(boundary, position)) {
- slider->drag = 1;
+ if (!slider->drag) {
+ switch (event->type) {
+ case SDL_MOUSEBUTTONDOWN: {
+ Point position = vec((float) event->button.x, (float) event->button.y);
+ if (rect_contains_point(boundary, position)) {
+ slider->drag = 1;
+ if (selected) {
+ *selected = 1;
+ }
+ }
+ } break;
+ }
+ } else {
+ switch (event->type) {
+ case SDL_MOUSEBUTTONUP: {
+ slider->drag = 0;