Interface IInputModule

interface IInputModule {
    Input: {
        closestObject: (() => InteractiveObject);
        enabled: (() => boolean);
        enabledRef: (() => Ref<boolean>);
        getKeyDown: ((keyCode) => boolean);
        getKeyPressed: ((keyCode) => boolean);
        getKeyUp: ((keyCode) => boolean);
        isDragging: (() => boolean);
        isLeftButtonDown: (() => boolean);
        isLeftButtonPressed: (() => boolean);
        isLeftButtonUp: (() => boolean);
        isMidButtonDown: (() => boolean);
        isMidButtonPressed: (() => boolean);
        isMidButtonUp: (() => boolean);
        isMoving: (() => boolean);
        isRightButtonDown: (() => boolean);
        isRightButtonPressed: (() => boolean);
        isRightButtonUp: (() => boolean);
        movementX: (() => number);
        movementY: (() => number);
        setEnable: ((b) => {});
        x: (() => number);
        y: (() => number);
    };
    addPointerEventsObject: ((entity) => {});
    removePointerEventsObject: ((entity) => {});
    setMenu: ((menu?, key?) => void);
}

Implemented by

Properties

Input: {
    closestObject: (() => InteractiveObject);
    enabled: (() => boolean);
    enabledRef: (() => Ref<boolean>);
    getKeyDown: ((keyCode) => boolean);
    getKeyPressed: ((keyCode) => boolean);
    getKeyUp: ((keyCode) => boolean);
    isDragging: (() => boolean);
    isLeftButtonDown: (() => boolean);
    isLeftButtonPressed: (() => boolean);
    isLeftButtonUp: (() => boolean);
    isMidButtonDown: (() => boolean);
    isMidButtonPressed: (() => boolean);
    isMidButtonUp: (() => boolean);
    isMoving: (() => boolean);
    isRightButtonDown: (() => boolean);
    isRightButtonPressed: (() => boolean);
    isRightButtonUp: (() => boolean);
    movementX: (() => number);
    movementY: (() => number);
    setEnable: ((b) => {});
    x: (() => number);
    y: (() => number);
}

Type declaration

  • closestObject: (() => InteractiveObject)

    当前离鼠标最近的物体实体

  • enabled: (() => boolean)
      • (): boolean
      • Returns boolean

  • enabledRef: (() => Ref<boolean>)

    是否可用的响应式对象

      • (): Ref<boolean>
      • 是否可用的响应式对象

        Returns Ref<boolean>

  • getKeyDown: ((keyCode) => boolean)

    获取键是否开始按下 exam: getKeyDown("KeyW")

      • (keyCode): boolean
      • 获取键是否开始按下 exam: getKeyDown("KeyW")

        Parameters

        • keyCode: string

        Returns boolean

  • getKeyPressed: ((keyCode) => boolean)

    获取键是否按住 如 Space Enter ShiftLeft

      • (keyCode): boolean
      • 获取键是否按住 如 Space Enter ShiftLeft

        Parameters

        • keyCode: string

        Returns boolean

  • getKeyUp: ((keyCode) => boolean)

    获取键是否松开

      • (keyCode): boolean
      • 获取键是否松开

        Parameters

        • keyCode: string

        Returns boolean

  • isDragging: (() => boolean)
      • (): boolean
      • Returns boolean

  • isLeftButtonDown: (() => boolean)
      • (): boolean
      • Returns boolean

  • isLeftButtonPressed: (() => boolean)
      • (): boolean
      • Returns boolean

  • isLeftButtonUp: (() => boolean)
      • (): boolean
      • Returns boolean

  • isMidButtonDown: (() => boolean)
      • (): boolean
      • Returns boolean

  • isMidButtonPressed: (() => boolean)
      • (): boolean
      • Returns boolean

  • isMidButtonUp: (() => boolean)
      • (): boolean
      • Returns boolean

  • isMoving: (() => boolean)
      • (): boolean
      • Returns boolean

  • isRightButtonDown: (() => boolean)
      • (): boolean
      • Returns boolean

  • isRightButtonPressed: (() => boolean)
      • (): boolean
      • Returns boolean

  • isRightButtonUp: (() => boolean)
      • (): boolean
      • Returns boolean

  • movementX: (() => number)
      • (): number
      • Returns number

  • movementY: (() => number)
      • (): number
      • Returns number

  • setEnable: ((b) => {})
      • (b): {}
      • Parameters

        • b: boolean

        Returns {}

    • x: (() => number)
        • (): number
        • Returns number

    • y: (() => number)
        • (): number
        • Returns number

    addPointerEventsObject: ((entity) => {})

    Type declaration

      • (entity): {}
      • Parameters

        Returns {}

      removePointerEventsObject: ((entity) => {})

      Type declaration

        • (entity): {}
        • Parameters

          Returns {}

        setMenu: ((menu?, key?) => void)

        设置地图右键上下文菜单,运行时将触发 上下文菜单将要打开contextMenuPreOpen, 上下文菜单已打开contextMenuOpened, 上下文菜单打开无内容contextMenuNoContent事件

        Type declaration

          • (menu?, key?): void
          • 设置地图右键上下文菜单,运行时将触发 上下文菜单将要打开contextMenuPreOpen, 上下文菜单已打开contextMenuOpened, 上下文菜单打开无内容contextMenuNoContent事件

            Parameters

            • Optional menu: ((event, object?) => ContextMenu)

              获取菜单的函数

            • Optional key: string

              多次调用setMenu时,同样的key会覆盖之前的事件函数;有多个key时,调用次序为key的字母次序倒序;多次调用时,直到函数返回一个非null的ContextMenu为止

            Returns void

        Param: menu

        获取菜单的函数

        Param: key

        多次调用setMenu时,同样的key会覆盖之前的事件函数;有多个key时,调用次序为key的字母次序倒序;多次调用时,直到函数返回一个非null的ContextMenu为止