viewerDragDropMixin - Cesium Documentation

# viewerDragDropMixin

#### viewerDragDropMixin(viewer, options)

  A mixin which adds default drag and drop support for CZML files to the Viewer widget. Rather than being called directly, this function is normally passed as a parameter to `Viewer#extend`, as shown in the example below.

  Name | Type | Description
  --- | --- | ---
  `viewer` | Viewer | The viewer instance.

  `options`

  Object

  optional Object with the following properties:

  Name | Type | Default | Description
  --- | --- | --- | ---
  `dropTarget` | Element | String | `viewer.container` | optional The DOM element which will serve as the drop target.
  `clearOnDrop` | Boolean | `true` | optional When true, dropping files will clear all existing data sources first, when false, new data sources will be loaded after the existing ones.
  `flyToOnDrop` | Boolean | `true` | optional When true, dropping files will fly to the data source once it is loaded.
  `proxy` | DefaultProxy |  | optional The proxy to be used for KML network links.

  ##### Throws:

  - DeveloperError : Element with id does not exist in the document.
  - DeveloperError : dropTarget is already defined by another mixin.
  - DeveloperError : dropEnabled is already defined by another mixin.
  - DeveloperError : dropError is already defined by another mixin.
  - DeveloperError : clearOnDrop is already defined by another mixin.

  ##### Example:

      // Add basic drag and drop support and pop up an alert window on error.
      var viewer = new Cesium.Viewer('cesiumContainer');
      viewer.extend(Cesium.viewerDragDropMixin);
      viewer.dropError.addEventListener(function(viewerArg, source, error) {
          window.alert('Error processing ' + source + ':' + error);
      });

  Source: Widgets/Viewer/viewerDragDropMixin.js, line 53

### Members

#### clearOnDrop :Boolean

  Gets or sets a value indicating if existing data sources should be cleared before adding the newly dropped sources.
  Source: Widgets/Viewer/viewerDragDropMixin.js, line 148

#### dropEnabled :Element

  Gets or sets a value indicating if drag and drop support is enabled.
  Source: Widgets/Viewer/viewerDragDropMixin.js, line 116

#### dropError :Event

  Gets the event that will be raised when an error is encountered during drop processing.
  Source: Widgets/Viewer/viewerDragDropMixin.js, line 137

#### dropTarget :Element

  Gets or sets the element to serve as the drop target.
  Source: Widgets/Viewer/viewerDragDropMixin.js, line 93

#### flyToOnDrop :Boolean

  Gets or sets a value indicating if the camera should fly to the data source after it is loaded.
  Source: Widgets/Viewer/viewerDragDropMixin.js, line 162

#### proxy :DefaultProxy

  Gets or sets the proxy to be used for KML.
  Source: Widgets/Viewer/viewerDragDropMixin.js, line 176