How to use the cesium.ScreenSpaceEventType.MOUSE_MOVE 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 darwin-education / resium / src / core / EventManager.ts View on Github external
public commit() {
    const sshe = this.sshe;
    const destroyed = this.sshe.isDestroyed();

    if (!destroyed) {
      if (
        this.events.onMouseEnter.size === 0 &&
        this.events.onMouseLeave.size === 0 &&
        this.events.onMouseMove.size === 0
      ) {
        this.sshe.removeInputAction(ScreenSpaceEventType.MOUSE_MOVE);
      } else if (!this.sshe.getInputAction(ScreenSpaceEventType.MOUSE_MOVE)) {
        this.sshe.setInputAction(this.onMouseMove as any, ScreenSpaceEventType.MOUSE_MOVE);
      }
    }

    entries(this.events).forEach(([et, m]) => {
      if (et === "onMouseEnter" || et === "onMouseLeave" || et === "onMouseMove") {
        return;
      }

      const cesiumEventType = EventManager.eventTypeMap[et];

      if (!destroyed) {
        if (m.size === 0) {
          sshe.removeInputAction(cesiumEventType);
        } else if (!sshe.getInputAction(cesiumEventType)) {
          sshe.setInputAction(this.eventCallback(et) as any, cesiumEventType);
github darwin-education / resium / src / core / EventWrapper.tsx View on Github external
withContext & P, EventWrapperContext>(
    class EventWrapper extends React.PureComponent<
      EventWrapperProps & P & { cesium: EventWrapperContext }
    > {
      private static events: Array<{
        prop: keyof EventWrapperProps;
        type: Cesium.ScreenSpaceEventType;
      }> = [
        { prop: "onClick", type: ScreenSpaceEventType.LEFT_CLICK },
        { prop: "onDoubleClick", type: ScreenSpaceEventType.LEFT_DOUBLE_CLICK },
        { prop: "onMouseDown", type: ScreenSpaceEventType.LEFT_DOWN },
        { prop: "onMouseUp", type: ScreenSpaceEventType.LEFT_UP },
        { prop: "onMiddleClick", type: ScreenSpaceEventType.MIDDLE_CLICK },
        { prop: "onMiddleDown", type: ScreenSpaceEventType.MIDDLE_DOWN },
        { prop: "onMiddleUp", type: ScreenSpaceEventType.MIDDLE_UP },
        { prop: "onMouseMove", type: ScreenSpaceEventType.MOUSE_MOVE },
        { prop: "onPinchEnd", type: ScreenSpaceEventType.PINCH_END },
        { prop: "onPinchMove", type: ScreenSpaceEventType.PINCH_MOVE },
        { prop: "onPinchStart", type: ScreenSpaceEventType.PINCH_START },
        { prop: "onRightClick", type: ScreenSpaceEventType.RIGHT_CLICK },
        { prop: "onRightDown", type: ScreenSpaceEventType.RIGHT_DOWN },
        { prop: "onRightUp", type: ScreenSpaceEventType.RIGHT_UP },
        { prop: "onWheel", type: ScreenSpaceEventType.WHEEL },
      ];

      private ref = React.createRef>();
      private sseh?: Cesium.ScreenSpaceEventHandler;
      private sseh2?: Cesium.ScreenSpaceEventHandler;
      private hovering = false;

      public render() {
        const props = omit(this.props, EventWrapper.events.map(e => e.prop));
github darwin-education / resium / src / core / EventManager.ts View on Github external
public commit() {
    const sshe = this.sshe;
    const destroyed = this.sshe.isDestroyed();

    if (!destroyed) {
      if (
        this.events.onMouseEnter.size === 0 &&
        this.events.onMouseLeave.size === 0 &&
        this.events.onMouseMove.size === 0
      ) {
        this.sshe.removeInputAction(ScreenSpaceEventType.MOUSE_MOVE);
      } else if (!this.sshe.getInputAction(ScreenSpaceEventType.MOUSE_MOVE)) {
        this.sshe.setInputAction(this.onMouseMove as any, ScreenSpaceEventType.MOUSE_MOVE);
      }
    }

    entries(this.events).forEach(([et, m]) => {
      if (et === "onMouseEnter" || et === "onMouseLeave" || et === "onMouseMove") {
        return;
      }

      const cesiumEventType = EventManager.eventTypeMap[et];

      if (!destroyed) {
        if (m.size === 0) {
          sshe.removeInputAction(cesiumEventType);
        } else if (!sshe.getInputAction(cesiumEventType)) {
          sshe.setInputAction(this.eventCallback(et) as any, cesiumEventType);
        }
github darwin-education / resium / dist / resium.es.js View on Github external
onClick: ScreenSpaceEventType.LEFT_CLICK,
        onDoubleClick: ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
        onMouseDown: ScreenSpaceEventType.LEFT_DOWN,
        onMouseUp: ScreenSpaceEventType.LEFT_UP,
        onMiddleClick: ScreenSpaceEventType.MIDDLE_CLICK,
        onMiddleDown: ScreenSpaceEventType.MIDDLE_DOWN,
        onMiddleUp: ScreenSpaceEventType.MIDDLE_UP,
        onMouseMove: ScreenSpaceEventType.MOUSE_MOVE,
        onPinchEnd: ScreenSpaceEventType.PINCH_END,
        onPinchMove: ScreenSpaceEventType.PINCH_MOVE,
        onPinchStart: ScreenSpaceEventType.PINCH_START,
        onRightClick: ScreenSpaceEventType.RIGHT_CLICK,
        onRightDown: ScreenSpaceEventType.RIGHT_DOWN,
        onRightUp: ScreenSpaceEventType.RIGHT_UP,
        onWheel: ScreenSpaceEventType.WHEEL,
        onMouseEnter: ScreenSpaceEventType.MOUSE_MOVE,
        onMouseLeave: ScreenSpaceEventType.MOUSE_MOVE,
    };
    return EventManager;
}());
github darwin-education / resium / src / core / EventManager.ts View on Github external
onClick: ScreenSpaceEventType.LEFT_CLICK,
    onDoubleClick: ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
    onMouseDown: ScreenSpaceEventType.LEFT_DOWN,
    onMouseUp: ScreenSpaceEventType.LEFT_UP,
    onMiddleClick: ScreenSpaceEventType.MIDDLE_CLICK,
    onMiddleDown: ScreenSpaceEventType.MIDDLE_DOWN,
    onMiddleUp: ScreenSpaceEventType.MIDDLE_UP,
    onMouseMove: ScreenSpaceEventType.MOUSE_MOVE,
    onPinchEnd: ScreenSpaceEventType.PINCH_END,
    onPinchMove: ScreenSpaceEventType.PINCH_MOVE,
    onPinchStart: ScreenSpaceEventType.PINCH_START,
    onRightClick: ScreenSpaceEventType.RIGHT_CLICK,
    onRightDown: ScreenSpaceEventType.RIGHT_DOWN,
    onRightUp: ScreenSpaceEventType.RIGHT_UP,
    onWheel: ScreenSpaceEventType.WHEEL,
    onMouseEnter: ScreenSpaceEventType.MOUSE_MOVE,
    onMouseLeave: ScreenSpaceEventType.MOUSE_MOVE,
  };

  private scene: Cesium.Scene;
  private sshe: ScreenSpaceEventHandler;
  private events: EventMap> = {
    onClick: new Map(),
    onDoubleClick: new Map(),
    onMouseDown: new Map(),
    onMouseUp: new Map(),
    onMiddleClick: new Map(),
    onMiddleDown: new Map(),
    onMiddleUp: new Map(),
    onMouseMove: new Map(),
    onPinchEnd: new Map(),
    onPinchMove: new Map(),
github darwin-education / resium / dist / resium.es.js View on Github external
EventManager.prototype.commit = function () {
        var _this = this;
        var sshe = this.sshe;
        var destroyed = this.sshe.isDestroyed();
        var elements = new Set(this.hovered.keys());
        var elements2 = new Set();
        if (!destroyed) {
            if (this.events.onMouseEnter.size === 0 &&
                this.events.onMouseLeave.size === 0 &&
                this.events.onMouseMove.size === 0) {
                this.sshe.removeInputAction(ScreenSpaceEventType.MOUSE_MOVE);
            }
            else if (!this.sshe.getInputAction(ScreenSpaceEventType.MOUSE_MOVE)) {
                this.sshe.setInputAction(this.onMouseMove, ScreenSpaceEventType.MOUSE_MOVE);
            }
        }
        Object.entries(this.events).forEach(function (_a) {
            var et = _a[0], m = _a[1];
            var eventType = et;
            m.forEach(function (v, k) {
                if (!_this.hovered.has(k)) {
                    _this.hovered.set(k, false);
                }
                elements2.add(k);
            });
            if (et === "onMouseEnter" || et === "onMouseLeave" || et === "onMouseMove") {
                return;
            }
            var cesiumEventType = EventManager.eventTypeMap[eventType];
            if (!destroyed) {
github darwin-education / resium / dist / resium.es.js View on Github external
onDoubleClick: ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
        onMouseDown: ScreenSpaceEventType.LEFT_DOWN,
        onMouseUp: ScreenSpaceEventType.LEFT_UP,
        onMiddleClick: ScreenSpaceEventType.MIDDLE_CLICK,
        onMiddleDown: ScreenSpaceEventType.MIDDLE_DOWN,
        onMiddleUp: ScreenSpaceEventType.MIDDLE_UP,
        onMouseMove: ScreenSpaceEventType.MOUSE_MOVE,
        onPinchEnd: ScreenSpaceEventType.PINCH_END,
        onPinchMove: ScreenSpaceEventType.PINCH_MOVE,
        onPinchStart: ScreenSpaceEventType.PINCH_START,
        onRightClick: ScreenSpaceEventType.RIGHT_CLICK,
        onRightDown: ScreenSpaceEventType.RIGHT_DOWN,
        onRightUp: ScreenSpaceEventType.RIGHT_UP,
        onWheel: ScreenSpaceEventType.WHEEL,
        onMouseEnter: ScreenSpaceEventType.MOUSE_MOVE,
        onMouseLeave: ScreenSpaceEventType.MOUSE_MOVE,
    };
    return EventManager;
}());
github darwin-education / resium / src / core / EventManager.ts View on Github external
"onRightUp",
  "onWheel",
  "onMouseEnter",
  "onMouseLeave",
];

export default class EventManager {
  private static eventTypeMap: EventMap = {
    onClick: ScreenSpaceEventType.LEFT_CLICK,
    onDoubleClick: ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
    onMouseDown: ScreenSpaceEventType.LEFT_DOWN,
    onMouseUp: ScreenSpaceEventType.LEFT_UP,
    onMiddleClick: ScreenSpaceEventType.MIDDLE_CLICK,
    onMiddleDown: ScreenSpaceEventType.MIDDLE_DOWN,
    onMiddleUp: ScreenSpaceEventType.MIDDLE_UP,
    onMouseMove: ScreenSpaceEventType.MOUSE_MOVE,
    onPinchEnd: ScreenSpaceEventType.PINCH_END,
    onPinchMove: ScreenSpaceEventType.PINCH_MOVE,
    onPinchStart: ScreenSpaceEventType.PINCH_START,
    onRightClick: ScreenSpaceEventType.RIGHT_CLICK,
    onRightDown: ScreenSpaceEventType.RIGHT_DOWN,
    onRightUp: ScreenSpaceEventType.RIGHT_UP,
    onWheel: ScreenSpaceEventType.WHEEL,
    onMouseEnter: ScreenSpaceEventType.MOUSE_MOVE,
    onMouseLeave: ScreenSpaceEventType.MOUSE_MOVE,
  };

  private scene: Cesium.Scene;
  private sshe: ScreenSpaceEventHandler;
  private events: EventMap> = {
    onClick: new Map(),
    onDoubleClick: new Map(),
github darwin-education / resium / dist / resium.es.js View on Github external
if (picked.id instanceof Cesium.Entity) {
                return picked.id;
            }
            return picked;
        }
        return undefined;
    };
    EventManager.eventTypeMap = {
        onClick: ScreenSpaceEventType.LEFT_CLICK,
        onDoubleClick: ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
        onMouseDown: ScreenSpaceEventType.LEFT_DOWN,
        onMouseUp: ScreenSpaceEventType.LEFT_UP,
        onMiddleClick: ScreenSpaceEventType.MIDDLE_CLICK,
        onMiddleDown: ScreenSpaceEventType.MIDDLE_DOWN,
        onMiddleUp: ScreenSpaceEventType.MIDDLE_UP,
        onMouseMove: ScreenSpaceEventType.MOUSE_MOVE,
        onPinchEnd: ScreenSpaceEventType.PINCH_END,
        onPinchMove: ScreenSpaceEventType.PINCH_MOVE,
        onPinchStart: ScreenSpaceEventType.PINCH_START,
        onRightClick: ScreenSpaceEventType.RIGHT_CLICK,
        onRightDown: ScreenSpaceEventType.RIGHT_DOWN,
        onRightUp: ScreenSpaceEventType.RIGHT_UP,
        onWheel: ScreenSpaceEventType.WHEEL,
        onMouseEnter: ScreenSpaceEventType.MOUSE_MOVE,
        onMouseLeave: ScreenSpaceEventType.MOUSE_MOVE,
    };
    return EventManager;
}());
github darwin-education / resium / src / core / EventWrapper.tsx View on Github external
}
        });

        if (
          this.sseh2 &&
          (prevProps.onMouseEnter !== this.props.onMouseEnter ||
            prevProps.onMouseLeave !== this.props.onMouseLeave)
        ) {
          if (!this.props.onMouseEnter && !this.props.onMouseLeave) {
            this.sseh2.removeInputAction(ScreenSpaceEventType.MOUSE_MOVE);
          } else if (
            (this.props.onMouseEnter || this.props.onMouseLeave) &&
            !prevProps.onMouseEnter &&
            !prevProps.onMouseLeave
          ) {
            this.sseh2.setInputAction(this.checkHovering as any, ScreenSpaceEventType.MOUSE_MOVE);
          }
        }
      }