improve device selection
This commit is contained in:
parent
bdfaeea0d0
commit
c295b13018
|
@ -26,10 +26,12 @@ bool DeviceRenderer::PropagateEvent(SDL_Event* event) {
|
|||
float x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
|
||||
if (x >= bbox.x && x <= bbox.x + bbox.w && y >= bbox.y && y <= bbox.y + bbox.h) {
|
||||
selected = true;
|
||||
grabbed = true;
|
||||
return true;
|
||||
if (event->button.button == SDL_BUTTON_LEFT) {
|
||||
if (x >= bbox.x && x <= bbox.x + bbox.w && y >= bbox.y && y <= bbox.y + bbox.h) {
|
||||
selected = true;
|
||||
grabbed = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (grabbed && event->type == SDL_EVENT_MOUSE_MOTION) {
|
||||
|
|
|
@ -13,7 +13,7 @@ void NetworkRenderer::AddDevice(std::shared_ptr<Device> device, uint16_t x, uint
|
|||
}
|
||||
|
||||
void NetworkRenderer::PropagateEvent(SDL_Event* event) {
|
||||
if (event->type == SDL_EVENT_MOUSE_BUTTON_DOWN) {
|
||||
if (event->type == SDL_EVENT_MOUSE_BUTTON_DOWN && event->button.button == SDL_BUTTON_LEFT) {
|
||||
for (DeviceRenderer& device : devices) {
|
||||
device.Deselect();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue