ScreenSpaceEventHandler handleMouseUp not correctly checking the event
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
Sandcastle example:
I do not have a sandcastle example but use Cesium drawhelper https://github.com/smills2929/cesium-drawhelper.
The functionality for dragging a section of a polygon relies on drag and drop but these commits change the behavior of the event firing and do not properly check the raised mouseUp event at the end of the mouse drag.
8bf9c9f1f40cbf923c8adeb5e8387c29971e76b3
59be44ec0064e82face63744647f00bfd9a51c0b
I suggest changing this block in handleMouseUp:
```
if(screenSpaceEventHandler._buttonDown[MouseButton.LEFT]){
cancelMouseEvent(screenSpaceEventHandler, ScreenSpaceEventType.LEFT_UP, ScreenSpaceEventType.LEFT_CLICK, event);
screenSpaceEventHandler._buttonDown[MouseButton.LEFT] = false;
}
if(screenSpaceEventHandler._buttonDown[MouseButton.MIDDLE]){
cancelMouseEvent(screenSpaceEventHandler, ScreenSpaceEventType.MIDDLE_UP, ScreenSpaceEventType.MIDDLE_CLICK, event);
screenSpaceEventHandler._buttonDown[MouseButton.MIDDLE] = false;
}
if(screenSpaceEventHandler._buttonDown[MouseButton.RIGHT]){
cancelMouseEvent(screenSpaceEventHandler, ScreenSpaceEventType.RIGHT_UP, ScreenSpaceEventType.RIGHT_CLICK, event);
screenSpaceEventHandler._buttonDown[MouseButton.RIGHT] = false;
}
```
to
```
if(button === MouseButton.LEFT){
cancelMouseEvent(screenSpaceEventHandler, ScreenSpaceEventType.LEFT_UP, ScreenSpaceEventType.LEFT_CLICK, event);
screenSpaceEventHandler._buttonDown[MouseButton.LEFT] = false;
}
if(button === MouseButton.MIDDLE){
cancelMouseEvent(screenSpaceEventHandler, ScreenSpaceEventType.MIDDLE_UP, ScreenSpaceEventType.MIDDLE_CLICK, event);
screenSpaceEventHandler._buttonDown[MouseButton.MIDDLE] = false;
}
if(button === MouseButton.RIGHT){
cancelMouseEvent(screenSpaceEventHandler, ScreenSpaceEventType.RIGHT_UP, ScreenSpaceEventType.RIGHT_CLICK, event);
screenSpaceEventHandler._buttonDown[MouseButton.RIGHT] = false;
}
```
Please let me know if you agree and I will open a PR. This issue first appears in Cesium 1.53.
Browser:
vue cli electron
Operating System:
MacOS High Sierra 10.13.6
Contributor guide
Research direction
Search the Cesium source for handleMouseUp and inspect the two referenced commits, 8bf9c9f1f40cbf923c8adeb5e8387c29971e76b3 and 59be44ec0064e82face63744647f00bfd9a51c0b. Reproduce the drag-and-drop behavior described with cesium-drawhelper, then verify mouseUp handling checks the released button and that the corresponding events fire correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100