Search code examples
javascriptjqueryhtmlwebcesiumjs

How to add a drop down menu when user selects an icon on a cesium map


I want to select an icon on a cesium map and then left click and bring up a drop down selection menu where that icon is.

I am using cesium map and need an easy way to add a drop down.


Solution

  • I think you should create drop down menu with jquery when user clicked on the entity.

    handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
    handler.setInputAction(function(click) {
        var pickedObject = viewer.scene.pick(click.position);
        if (Cesium.defined(pickedObject)) {
                // add some jquery code to create dropdown menu
            }
        }
    }, Cesium.ScreenSpaceEventType.LEFT_CLICK);