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.
Parameters:
Name |
Type |
Argument |
Description |
viewer |
Viewer
|
|
The viewer instance. |
options |
Object
|
<optional>
|
Configuration options for the mixin.
Properties
Name |
Type |
Argument |
Default |
Description |
dropTarget |
Element
|
String
|
<optional>
|
viewer.container
|
The DOM element which will serve as the drop target. |
clearOnDrop |
Boolean
|
<optional>
|
true
|
When true, dropping files will clear all existing data sources first, when false, new data sources will be loaded after the existing ones. |
|
Throws:
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: