@orca-fe/x-map
Version:
35 lines (34 loc) • 1.66 kB
TypeScript
import { EventEmitter } from 'events';
import { Intersection, Object3D } from 'three';
import { Point } from '../../defs';
import { ILayerPure, IMarker } from '../ILayer';
export declare type ThreeObjectEvent = {
'mouseenter'(event: MouseEvent, intersection: Intersection): void;
'mouseleave'(event: MouseEvent, intersection: Intersection): void;
'click'(event: MouseEvent, intersection: Intersection): void;
'mousedown'(event: MouseEvent, intersection: Intersection): void;
'mouseup'(event: MouseEvent, intersection: Intersection): void;
'icon-check'(event: MouseEvent, index: number): void;
'icon-mouseenter'(event: MouseEvent, index: number): void;
'icon-mouseleave'(event: MouseEvent, index: number): void;
};
export declare type ThreeObjectOptions = {
z?: number;
pointerEvents?: boolean;
};
export default abstract class ThreeObject<T extends ThreeObjectOptions = any> extends EventEmitter implements IMarker {
layer?: ILayerPure;
object3D: Object3D;
threeCenter?: Point;
pointerEvents: boolean;
z: number;
options: T;
constructor(options?: T);
setZ(z: number): void;
abstract updatePosition(): void;
abstract createObject(): void;
setLayer(layer?: ILayerPure): void;
emit<EventName extends keyof ThreeObjectEvent>(eventName: EventName, ...args: Parameters<ThreeObjectEvent[EventName]>): boolean;
on<EventName extends keyof ThreeObjectEvent>(eventName: EventName, listener: ThreeObjectEvent[EventName]): this;
off<EventName extends keyof ThreeObjectEvent>(eventName: EventName, listener: ThreeObjectEvent[EventName]): this;
}