Controls - Verge3D 用户手册 - Soft8Soft
Description: 了解如何在使用 Verge3D 制作的交互式 3D 应用程序中使用 Controls

# Controls

Camera controls.

## Controls Constants

These constants define camera controls.

### Tweening Movement Types

`v3d.TweenLinear v3d.TweenSpherical`

## Constructor

### Controls(object : Camera, domElement : HTMLElement)

object
  The camera to be controlled.
domElement
  The HTML element used for event listeners (optional). By default this is the whole document, however if you only want to the controls to work over a specific element (e.g. the canvas) you can specify that here.

Creates a new Controls. Note that this class is not intended to be called directly; you probably want to use OrbitControls, FlyingControls, or FirstPersonControls instead.

## Properties

### # .allowMouseOverIframes : Boolean

Whether or not the mouse will be allowed to move above the `<iframe>` elements located on the page, when it's controlling the camera. Default is `false`. Please note that if the App.enableCSSRenderer() method is called, it will set .allowMouseOverIframes to `true`.

To allow camera movements when mouse cursor is above iframes, the internal mouse event listeners execute .lockIframeEvents() once the user starts moving the camera, and .unlockIframeEvents() once the movement is stopped.

### # .domElement : HTMLElement

The HTMLElement used to listen for mouse / touch events. This must be passed in the constructor; changing it here will not set up new event listeners. Default is the whole document.

### # .enabled : Boolean

Whether or not the controls are enabled.

### # .object : Camera

The camera (or other object) that is being controlled.

## Methods

### # .lockIframeEvents()

Prevent all `<iframe>` elements located on the current page to capture user events. Usually this method is called by the internal event listeners of the corresponding controls class. To be able to execute it manually, set .allowMouseOverIframes to `false`.

### # .unlockIframeEvents() → Float

Allow all `<iframe>` elements located on the current page to capture user events. Usually this method is called by the internal event listeners of the corresponding controls class. To be able to execute it manually, set .allowMouseOverIframes to `false`.

## 源代码

关于如何获取此模块的源代码，请查看 本页。