@tolokoban/tgd
Version:
ToloGameDev library for WebGL2
136 lines • 4.36 kB
TypeScript
import { TgdInputPointerModifierKeys } from "../../types";
import { TgdEvent } from "../../event";
import { TgdCamera } from "../../camera";
import { TgdContext } from "../../context";
export interface TgdControllerCameraOrbitZoomRequest extends TgdInputPointerModifierKeys {
x: number;
y: number;
}
export interface TgdControllerCameraOrbitOptions {
minZoom: number;
maxZoom: number;
speedOrbit: number;
speedZoom: number;
speedPanning: number;
/**
* Time in msec during which the orbiting continues
* after the pointer stop touching.
*/
inertiaOrbit: number;
/**
* Time in msec during which the zooming continues
* after the pointer stop touching.
*
* Default to 0.
*/
inertiaZoom: number;
/**
* Time in msec during which the panning continues
* after the pointer stop touching.
*
* Default to 0.
*/
inertiaPanning: number;
/**
* If `true`, pannig will only act on `camera.shift`,
* not on `camera.target`.
*
* Default to 0.
*/
fixedTarget: boolean;
/**
* Zooming can be done by the mouse wheel.
* In this case, we may want to prevent it when the
* canvas is not in fullscreen, to let the rest of
* the page to scroll.
*
* This function, if defined, will be called just
* before the zoom event. If it returns `false`,
* the event is not dispatched.
*/
onZoomRequest(this: void, event: TgdControllerCameraOrbitZoomRequest): boolean;
/**
* If this attribute is defined, the orbit will follow latitude/longitude.
* You can also add limits.
*/
geo: Partial<{
/** Expressed in radians */
lat: number;
/** Expressed in radians */
lng: number;
/** Expressed in radians */
minLat: number;
/** Expressed in radians */
maxLat: number;
/** Expressed in radians */
maxLng: number;
/** Expressed in radians */
minLng: number;
}>;
}
export declare class TgdControllerCameraOrbit {
private readonly context;
private static counter;
readonly id: string;
readonly eventChange: TgdEvent<TgdCamera>;
minZoom: number;
maxZoom: number;
speedZoom: number;
speedOrbit: number;
speedPanning: number;
inertiaZoom: number;
inertiaOrbit: number;
inertiaPanning: number;
/**
* If `true`, pannig will only act on `camera.shift`,
* not on `camera.target`.
*/
fixedTarget: boolean;
/**
* Zooming can be done by the mouse wheel.
* In this case, we may want to prevent it when the
* canvas is not in fullscreen, to let the rest of
* the page to scroll.
*
* This function, if defined, will be called just
* before the zoom event. If it returns `false`,
* the event is not dispatched.
*/
onZoomRequest: (this: void, event: TgdControllerCameraOrbitZoomRequest) => boolean;
/**
* The camera will only move if `enabled === true`.
*/
_enabled: boolean;
private animOrbit;
/**
* It can be usefull to disable to orbit controller for some time
* because an animation is going on on the camera, for instance.
*/
private disabledUntil;
private readonly cameraInitialState;
private readonly geo?;
private readonly tmpQuat;
constructor(context: TgdContext, { geo, minZoom, maxZoom, speedZoom, speedOrbit, speedPanning, inertiaZoom, inertiaOrbit, inertiaPanning, fixedTarget, onZoomRequest, }?: Partial<TgdControllerCameraOrbitOptions>);
get enabled(): boolean;
set enabled(value: boolean);
reset(animDuration: number, easingFunction?: (x: number) => number): void;
disableForSomeTime(delayInMsec: number): void;
detach(): void;
private readonly handleMove;
private readonly actualMove;
private orbit;
/**
* Set the camera orientation from latitude/longitude
* @param lat Expressed in radians
* @param lng Expressed in radians
*/
orbitGeo(lat: number, lng: number): void;
private readonly handleMoveStart;
private readonly handleMoveEnd;
private handlePan;
private handleRotateAroundZ;
private fireOrbitChange;
private readonly handleZoom;
private fireZoomChange;
}
//# sourceMappingURL=orbit.d.ts.map