Brokenness from ScreenSpaceEventHandler changes

Hi guys,

I just upgraded National Map to use the head of master and ran into some problems introduced by pull request #2408. I submitted a pull request to fix one of the problems, but there’s another one that needs some discussion.

The problem is that after upgrading Cesium, dragging things is completely broken on my page. Specifically, dragging sliders doesn’t work and dragging/dropping within the app doesn’t work. Dragging the Cesium globe is fine.

I eventually tracked it down to this line in ScreenSpaceEventHandler:

https://github.com/AnalyticalGraphicsInc/cesium/blob/2315709e0e07cd0f097b5fecfceace019a4a3581/Source/Core/ScreenSpaceEventHandler.js#L248

Basically, Cesium is registering a mousemove handler on the document, and then canceling the event if a mouse button is currently held down. That’s reasonable if the button was pressed inside the Cesium canvas, perhaps. But it’s happening no matter where on the page the user pressed down the button.

So I’ve simply removed the preventDefault in my app and life is good, I guess. I’m not sure exactly what that preventDefault is supposed to be preventing. Hover styles from taking effect while dragging the globe?

If we do need the preventDefault, perhaps it should move to CameraEventAggregator? That class is able to distinguish between mousedowns that started inside the Cesium canvas and mousedowns that started elsewhere, unlike ScreenSpaceEventHandler (at least after #2408).

What do you think?

Thanks,

Kevin

By the way, Sandcastle examples in master have the same broken-slider problem I ran into in National Map. This one for example:
http://localhost:8080/Apps/Sandcastle/index.html?src=Imagery%20Adjustment.html&label=Showcases

I think the preventDefault is supposed to prevent text from getting drag-selected while rotating the globe. But as you said, it should only be prevented if the mousedown really happened inside the canvas itself.

–Ed.

I just tried it in my app with the hacked-out preventDefault. When I click inside the canvas and then drag outside, no text gets selected. If I start my drag outside the canvas, on the text itself, selection works as you’d expect. This is in Chrome and Firefox, I don’t have a Windows machine handy at the moment to test IE.

So I don’t think the preventDefault is necessary for that…

The app is here if you feel like playing with it:

http://nationalmap.research.nicta.com.au/demo/

Kevin