# ScreenSpaceEventHandler LEFT\_CLICK and LEFT\_DOWN actions

**URL:** <https://community.cesium.com/t/screenspaceeventhandler-left-click-and-left-down-actions/4169>\
**Category:** CesiumJS\
**Created:** [May 30, 2016, 5:39pm UTC](https://community.cesium.com/t/screenspaceeventhandler-left-click-and-left-down-actions/4169 "2016-05-30T17:39:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thinh\_Ho](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@Thinh\_Ho](https://community.cesium.com/u/Thinh_Ho)\
**Post date:** [May 30, 2016, 5:39pm UTC](https://community.cesium.com/t/screenspaceeventhandler-left-click-and-left-down-actions/4169/1 "2016-05-30T17:39:53Z")

</div>

Hello,

I’m not sure if this is intended but a LEFT\_DOWN is also registered on a LEFT\_CLICK. Running the snippet below in Cesium 1.21 sandcastle…

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var scene = viewer.scene;

var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);

handler.setInputAction(function(movement) {

var cartesian = viewer.camera.pickEllipsoid(movement.position, scene.globe.ellipsoid);

if (cartesian) {

var cartographic = Cesium.Cartographic.fromCartesian(cartesian);

var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(2);

var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(2);

console.log(’(’ + longitudeString + ', ’ + latitudeString + ‘)’);

}

}, Cesium.ScreenSpaceEventType.LEFT\_CLICK);

handler.setInputAction(function(movement) {

console.log(‘LEFT\_DOWN’);

}, Cesium.ScreenSpaceEventType.LEFT\_DOWN);

``

Our application uses various handler objects, each disabled and enabled programmatically, depending how the user wants to interact with the map. The handler object is basically a wrapper around Cesium.ScreenSpaceEventHandler and the callback action logic only execute if that handler is enabled.

In one of the capability, the handle object registers both a LEFT\_CLICK and LEFT\_DOWN action callback similar to the snippet above. I would think that the LEFT\_DOWN is never called on a LEFT\_CLICK but if you run the snippet above, you’ll get the console output of the LEFT\_DOWN on every left click of the mouse. Is there a way to not let the console output ‘LEFT\_DOWN’ from the snippet above? (without having to toggle some flag and checking it inside the LEFT\_DOWN action)

Thank you.

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [May 31, 2016, 2:11pm UTC](https://community.cesium.com/t/screenspaceeventhandler-left-click-and-left-down-actions/4169/2 "2016-05-31T14:11:20Z")

</div>

Hello,

This behavior is caused by the browser. Left click is fired when left down is immediately followed by left up. So left down will always fire on click, but click will only fire if the button is not held down after it is pressed.

It is generally not recommended to have both a left click and left down action, since it is often not possible to distinguish between the two.

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![Thinh\_Ho](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@Thinh\_Ho](https://community.cesium.com/u/Thinh_Ho)\
**Post date:** [June 6, 2016, 3:03pm UTC](https://community.cesium.com/t/screenspaceeventhandler-left-click-and-left-down-actions/4169/3 "2016-06-06T15:03:44Z")

</div>

Hi, Hannah - Thank you for the clarification!
