-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dehighlight on mouseup if != mousedown event target
Previously, mousedown -> drag away from Cell -> mouseup would not clear the highlight effect until the User reloaded the page or re-inspired the highlight effect on all now-highlighted Cells. This can be mitigated by implementing a dehighlight function. And, fortunately, our dehighlight function is dead simple and also pretty innocuous since it requires no change in database state anymore. Remaining issue: mousedown on Cell -> drag away from Cell to an area outside of the Game board -> mouseup... - In this case we will not detect the `mouseup` event since it has occurred outside of the board and, thus, outside of the bubble context of our Stimulus controller. - I'm not sure if I want to add a `mouseup` listener that covers everything on the page just in case the drag happens on anything outside of the board. So, for now, just punting on this.
- Loading branch information
Showing
7 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
app/controllers/games/current/board/cells/dehighlight_neighbors_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class Games::Current::Board::Cells::DehighlightNeighborsController < | ||
ApplicationController | ||
include Games::Current::Board::Cells::ActionBehaviors | ||
|
||
def create | ||
updated_cells = cell.highlightable_neighbors | ||
|
||
broadcast_updates(updated_cells) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters