How to use the cesium.ScreenSpaceEventHandler function in cesium

To help you get started, we’ve selected a few cesium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / lib / cesium-drawhelper / DrawHelper.js View on Github external
Cesium.Cartesian3.distance(circle.getCenter(), position)
                  )
                  markers.updateBillboardsPositions(getMarkerPositions())
                },
                onDragEnd(index, position) {
                  onEdited()
                },
              },
              tooltip() {
                return 'Drag to change the radius'
              },
            }
            markers.addBillboards(getMarkerPositions(), handleMarkerChanges)
            this._markers = markers
            // add a handler for clicking in the globe
            this._globeClickhandler = new Cesium.ScreenSpaceEventHandler(
              scene.canvas
            )
            this._globeClickhandler.setInputAction(movement => {
              const pickedObject = scene.pick(movement.position)
              if (!(pickedObject && pickedObject.primitive)) {
                _self.setEditMode(false)
              }
            }, Cesium.ScreenSpaceEventType.LEFT_CLICK)

            // set on top of the polygon
            markers.setOnTop()
          }
          this._editMode = true
        } else {
          if (this._markers != null) {
            this._markers.remove()
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / lib / cesium-drawhelper / DrawHelper.js View on Github external
const tooltip = this._tooltip

    const minPoints = isPolygon ? 3 : 2
    let poly
    if (isPolygon) {
      poly = new DrawHelper.PolygonPrimitive(options)
    } else {
      poly = new DrawHelper.PolylinePrimitive(options)
    }
    poly.asynchronous = false
    primitives.add(poly)

    const positions = []
    const markers = new _.BillboardGroup(this, defaultBillboard)

    const mouseHandler = new Cesium.ScreenSpaceEventHandler(scene.canvas)

    // Now wait for start
    mouseHandler.setInputAction(movement => {
      if (movement.position != null) {
        const cartesian = scene.camera.pickEllipsoid(
          movement.position,
          ellipsoid
        )
        if (cartesian) {
          // first click
          if (positions.length == 0) {
            positions.push(cartesian.clone())
            markers.addBillboard(positions[0])
          }
          if (positions.length >= minPoints) {
            poly.positions = positions
github darwin-education / resium / src / core / EventManager.ts View on Github external
public constructor(scene: Cesium.Scene) {
    this.scene = scene;
    this.sshe = new ScreenSpaceEventHandler(scene?.canvas as HTMLCanvasElement);
  }
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / js / widgets / cesium.bbox.js View on Github external
initialize() {
    this.mouseHandler = new Cesium.ScreenSpaceEventHandler(
      this.options.map.scene.canvas
    )
    this.listenTo(
      this.model,
      'change:mapNorth change:mapSouth change:mapEast change:mapWest',
      this.updatePrimitive
    )
  },
  enableInput() {
github darwin-education / resium / dist / resium.es.js View on Github external
}
                }
            });
        };
        this.eventCallback = function (et) { return function (e) {
            var picked = _this.pick(e.position);
            if (picked) {
                _this.events[et].forEach(function (cb, element) {
                    if (pickedObjectEquals(picked, element)) {
                        cb(e, element);
                    }
                });
            }
        }; };
        this.scene = scene;
        this.sshe = new ScreenSpaceEventHandler(canvas);
    }
    EventManager.prototype.destroy = function () {
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / js / widgets / cesium.circle.js View on Github external
initialize() {
    this.mouseHandler = new Cesium.ScreenSpaceEventHandler(
      this.options.map.scene.canvas
    )

    this.listenTo(
      this.model,
      'change:lat change:lon change:radius change:radiusUnits',
      this.updatePrimitive
    )
    this.updatePrimitive(this.model)
  },
  enableInput() {
github darwin-education / resium / dist / cesium-react.es.js View on Github external
_proto.createCesiumElement = function createCesiumElement() {
    if (this.props.useDefault) {
      this._useDefault = true;
      return this.context.cesiumWidget.screenSpaceEventHandler;
    }

    return new ScreenSpaceEventHandler(this.parent.canvas);
  };
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / component / visualization / maps / cesium / map.cesium.js View on Github external
function setupTooltip(map, selectionInterface) {
    const handler = new Cesium.ScreenSpaceEventHandler(map.scene.canvas)
    handler.setInputAction(movement => {
      $(componentElement).removeClass('has-feature')
      if (map.scene.mode === Cesium.SceneMode.MORPHING) {
        return
      }
      updateCoordinatesTooltip(movement.endPosition)
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE)
  }
github darwin-education / resium / dist / resium.es.js View on Github external
create: function (cprops, props, context) {
        return new Cesium.ScreenSpaceEventHandler(context.scene.canvas);
    },
    unmount: function (element) {
github darwin-education / resium / dist / cesium-react.cjs.js View on Github external
_proto.createCesiumElement = function createCesiumElement() {
    if (this.props.useDefault) {
      this._useDefault = true;
      return this.context.cesiumWidget.screenSpaceEventHandler;
    }

    return new cesium.ScreenSpaceEventHandler(this.parent.canvas);
  };