feat: Implement support for gesture-based PTZ control (#2378)

- Closes: #1839
This commit is contained in:
Dermot Duffy
2026-02-28 20:36:53 -08:00
committed by GitHub
parent 40ad3b4460
commit ea86ad0016
32 changed files with 1714 additions and 126 deletions
+15 -3
View File
@@ -19,12 +19,13 @@ export class ZoomController {
// Is the controller zoomed in at all?
private _zoomed = false;
// Is the controller set to the default zoom/pan settings?
private _default = true;
// Should clicks be allowed to propagate, or consumed as a pan/zoom action?
private _allowClick = true;
// Whether zoom/pan gestures are active. When `false`, all gesture events pass
// through untouched (used to yield to PTZ gesture mode).
private _zoom = true;
private _defaultSettings: PartialZoomSettings | null;
private _settings: PartialZoomSettings | null;
@@ -198,6 +199,14 @@ export class ZoomController {
this._debouncedUpdater();
}
public isActivated(): boolean {
return !!this._panzoom;
}
public setZoom(value: boolean): void {
this._zoom = value;
}
private _changeHandler(ev: Event): void {
const pz = (<CustomEvent<PanzoomEventDetail>>ev).detail;
const unzoomed = this._isUnzoomed(pz.scale);
@@ -439,6 +448,9 @@ export class ZoomController {
}
private _shouldZoomOrPan(ev: Event): boolean {
if (!this._zoom) {
return false;
}
return (
!this._isUnzoomed(this._panzoom?.getScale()) ||
// TouchEvent does not exist on Firefox on non-touch events. See: