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:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user