UNPKG

threepipe

Version:

A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.

94 lines 3.04 kB
import { AViewerPluginEventMap, type ThreeViewer } from '../../viewer/'; import { AViewerPluginSync } from '../../viewer/AViewerPlugin'; import { UiObjectConfig } from 'uiconfig.js'; import type { AddAssetOptions, ImportFilesOptions, ImportResult, ImportAddOptions } from '../../assetmanager'; export interface DropzonePluginOptions { /** * The DOM element to attach the dropzone to. */ domElement?: HTMLElement; /** * Allowed file extensions. If undefined, all files are allowed. */ allowedExtensions?: string[]; /** * Automatically import assets when dropped. * @default true */ autoImport?: boolean; /** * Automatically add dropped and imported assets to the scene. * Works only if {@link autoImport} is true. * @default true */ autoAdd?: boolean; /** * Import options for the {@link AssetImporter.importFiles}, used when importing files. */ importOptions?: ImportFilesOptions; /** * Add options for the {@link RootScene.addObject}, used when adding assets to the scene. */ addOptions?: AddAssetOptions; } export interface DropzonePluginEventMap extends AViewerPluginEventMap { drop: { files: Map<string, File>; imported?: Map<string, (ImportResult | undefined)[]>; assets?: (ImportResult | undefined)[]; nativeEvent: DragEvent; }; } /** * Dropzone Plugin * * Adds a dropzone to the viewer for importing assets. * * Automatically imports and adds assets to the scene, the behavior can be configured. * @category Plugins */ export declare class DropzonePlugin extends AViewerPluginSync<DropzonePluginEventMap> { static readonly PluginType = "Dropzone"; uiConfig: UiObjectConfig; enabled: boolean; private _inputEl?; private _dropzone?; private _allowedExtensions; /** * Automatically import assets when dropped. */ autoImport: boolean; /** * Automatically add dropped and imported assets to the scene. * Works only if {@link autoImport} is true. */ autoAdd: boolean; /** * Import options for the {@link AssetImporter.importFiles} */ importOptions: ImportFilesOptions; /** * Add options for the {@link RootScene.addObject} */ addOptions: AddAssetOptions; /** * Allowed file extensions. If undefined, all files are allowed. */ get allowedExtensions(): string[] | undefined; set allowedExtensions(value: string[] | undefined); /** * Prompt for file selection using the browser file dialog. */ promptForFile(): void; /** * Prompt for file url. */ promptForUrl(): Promise<void>; load(res: string, options?: ImportAddOptions, dialog?: boolean): Promise<ImportResult[] | undefined>; private _domElement?; constructor(options?: DropzonePluginOptions); onAdded(viewer: ThreeViewer): void; onRemove(viewer: ThreeViewer): void; private _onFileDrop; } //# sourceMappingURL=DropzonePlugin.d.ts.map