Appearance
KBE3D / KBCore / Cesium / viewerDragDropMixin
函数: viewerDragDropMixin()
viewerDragDropMixin(
viewer:Viewer,options?: {dropTarget?:string|Element;clearOnDrop?:boolean;flyToOnDrop?:boolean;clampToGround?:boolean;proxy?:Proxy; }):void
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.
参数
viewer
The viewer instance.
options?
Object with the following properties:
dropTarget?
string | Element
The DOM element which will serve as the drop target.
clearOnDrop?
boolean
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
When true, dropping files will fly to the data source once it is loaded.
clampToGround?
boolean
When true, datasources are clamped to the ground.
proxy?
The proxy to be used for KML network links.
返回
void
示例
ts
// Add basic drag and drop support and pop up an alert window on error.
const viewer = new Cesium.Viewer('cesiumContainer');
viewer.extend(Cesium.viewerDragDropMixin);
viewer.dropError.addEventListener(function(viewerArg, source, error) {
window.alert('Error processing ' + source + ':' + error);
});