mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
Fire: Ignore mouse events outside the window (to the left)
This fixes a small issue where if you drag the cursor outside the window on the left-hand side, the fire demo will still respond to the mouse events, but wrapped around to the right of the window.
This commit is contained in:
parent
934ea4faf1
commit
739d870091
1 changed files with 3 additions and 3 deletions
|
@ -174,9 +174,9 @@ void Fire::mousedown_event(GUI::MouseEvent& event)
|
||||||
void Fire::mousemove_event(GUI::MouseEvent& event)
|
void Fire::mousemove_event(GUI::MouseEvent& event)
|
||||||
{
|
{
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
if (event.y() >= 2 && event.y() < 398 && event.x() <= 638) {
|
|
||||||
int ypos = event.y() / 2;
|
int ypos = event.y() / 2;
|
||||||
int xpos = event.x() / 2;
|
int xpos = event.x() / 2;
|
||||||
|
if (bitmap->rect().shrunken(1, 1, 0, 0).contains(xpos, ypos)) {
|
||||||
bitmap->scanline_u8(ypos - 1)[xpos] = FIRE_MAX + 5;
|
bitmap->scanline_u8(ypos - 1)[xpos] = FIRE_MAX + 5;
|
||||||
bitmap->scanline_u8(ypos - 1)[xpos + 1] = FIRE_MAX + 5;
|
bitmap->scanline_u8(ypos - 1)[xpos + 1] = FIRE_MAX + 5;
|
||||||
bitmap->scanline_u8(ypos)[xpos] = FIRE_MAX + 5;
|
bitmap->scanline_u8(ypos)[xpos] = FIRE_MAX + 5;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue