shlogg · Early preview
Ramu Narasinga @karthik-m22

What SetCursorMode Does In Grida Source Code

setCursorMode in Grida source code sets cursor mode by dispatching an object with type "surface/cursor-mode" and cursor_mode to the _useInternal hook.

In this article, we will review a function called setCursorMode in Grida source code. To provide more context, you will see this function in Toolbar component on the Grida Canvas page.

Toolbar is used to draw elements on the canvas. This below code snippet is picked from Toolbar.tsx

<ToolsGroup
  value={value}
  options={[
    { value: "rectangle", label: "Rectangle", shortcut: "R" },
    { value: "ellipse", label: "Ellipse", shortcut: "O" },
    { value: "line", label: "Line", shortcut: "L" },
    { value: "image", label: "Image" },
  ]}
  onValueChange={(v) => {
    setCursorMode(toolbar_v...