feat(editor): allow laser-pointing in view mode (#10802)

* feat(editor): allow laser pointing in view mode

* feat: allow switching between laser/hand in view mode

* fix lint

* factor out to utils

* fix: only handle primary clicks with the selection/laser tools
This commit is contained in:
David Luzar
2026-02-20 22:49:46 +01:00
committed by GitHub
parent 4c3d037f9c
commit eb959128ac
12 changed files with 287 additions and 147 deletions
+18 -1
View File
@@ -8,6 +8,8 @@ import type {
Radians,
Degrees,
Vector,
GlobalCoord,
LocalCoord,
} from "./types";
/**
@@ -20,8 +22,23 @@ import type {
export function pointFrom<Point extends GlobalPoint | LocalPoint>(
x: number,
y: number,
): Point;
// TODO remove the overload once we migrate to using Point tuples everywhere
export function pointFrom<Coord extends GlobalCoord | LocalCoord>(
coords: Coord,
): Coord extends GlobalCoord ? GlobalPoint : LocalPoint;
// TODO remove the overload once we migrate to using Point tuples everywhere
export function pointFrom<Point extends GlobalPoint | LocalPoint>(coords: {
x: number;
y: number;
}): Point;
export function pointFrom<Point extends GlobalPoint | LocalPoint>(
xOrCoords: number | { x: number; y: number },
y?: number,
): Point {
return [x, y] as Point;
return typeof xOrCoords === "object"
? ([xOrCoords.x, xOrCoords.y] as Point)
: ([xOrCoords, y!] as Point);
}
/**