mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-17 03:04:26 +01:00
* feat: initial Laser pointer mvp * feat: add laser-pointer package and integrate it with collab * chore: fix yarn.lock * feat: update laser-pointer package, prevent panning from showing * feat: add laser pointer tool button when collaborating, migrate to official package * feat: reduce laser tool button size * update icon * fix icon & rotate * fix: lock zoom level * fix icon * add `selected` state, simplify and reduce api * set up pointer callbacks in viewMode if laser tool active * highlight extra-tools button if one of the nested tools active * add shortcut to laser pointer * feat: don't update paths if nothing changed * ensure we reset flag if no rAF scheduled * move `lastUpdate` to instance to optimize * return early * factor out into constants and add doc * skip iteration instead of exit * fix naming * feat: remove testing variable on window * destroy on editor unmount * fix incorrectly resetting `lastUpdate` in `stop()` --------- Co-authored-by: dwelle <luzar.david@gmail.com>
42 lines
981 B
TypeScript
42 lines
981 B
TypeScript
import "../ToolIcon.scss";
|
|
|
|
import clsx from "clsx";
|
|
import { ToolButtonSize } from "../ToolButton";
|
|
import { laserPointerToolIcon } from "../icons";
|
|
|
|
type LaserPointerIconProps = {
|
|
title?: string;
|
|
name?: string;
|
|
checked: boolean;
|
|
onChange?(): void;
|
|
isMobile?: boolean;
|
|
};
|
|
|
|
const DEFAULT_SIZE: ToolButtonSize = "small";
|
|
|
|
export const LaserPointerButton = (props: LaserPointerIconProps) => {
|
|
return (
|
|
<label
|
|
className={clsx(
|
|
"ToolIcon ToolIcon__LaserPointer",
|
|
`ToolIcon_size_${DEFAULT_SIZE}`,
|
|
{
|
|
"is-mobile": props.isMobile,
|
|
},
|
|
)}
|
|
title={`${props.title}`}
|
|
>
|
|
<input
|
|
className="ToolIcon_type_checkbox"
|
|
type="checkbox"
|
|
name={props.name}
|
|
onChange={props.onChange}
|
|
checked={props.checked}
|
|
aria-label={props.title}
|
|
data-testid="toolbar-LaserPointer"
|
|
/>
|
|
<div className="ToolIcon__icon">{laserPointerToolIcon}</div>
|
|
</label>
|
|
);
|
|
};
|