Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom paths feature #168

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add custom paths feature #168

wants to merge 3 commits into from

Conversation

vinothpandian
Copy link
Owner

@vinothpandian vinothpandian commented Aug 17, 2024

Fixes #143

Add support for custom path generator in ReactSketchCanvas.

  • Add getSvgPathFromPoints prop to ReactSketchCanvas component to accept a callback function for custom path generation.
  • Pass getSvgPathFromPoints prop to Canvas component.
  • Add getSvgPathFromPoints prop to Canvas component to accept a callback function for custom path generation.
  • Pass getSvgPathFromPoints prop to SvgPath component.
  • Modify SvgPath component to use the custom path generator if provided.
  • Update documentation in README.md to include the new getSvgPathFromPoints prop and its usage.
  • Add tests in export.spec.tsx to verify the functionality of the custom path generator.

For more details, open the Copilot Workspace session.

* Add throttling to pointer move event

Fixes #163

Add throttling to pointer move events in the Canvas component to optimize coordinate recording.

- Modify `packages/react-sketch-canvas/src/Canvas/index.tsx` to add throttling to the `handlePointerMove` function using a custom `useThrottledCallback` function.
- Add `throttleTime` to `CanvasProps` in `packages/react-sketch-canvas/src/Canvas/types.ts` with a default value of 20.
- Add `throttleTime` to `ReactSketchCanvasProps` in `packages/react-sketch-canvas/src/ReactSketchCanvas/types.ts` with a default value of 20.
- Add `useThrottledCallback` function in `packages/react-sketch-canvas/src/Canvas/utils.tsx` to throttle a callback function.
- Update `README.md` to include documentation on the new `throttleTime` configuration option.
- Add tests to verify throttling behavior in `packages/tests/src/actions/throttling.spec.ts`.
- Write vitest tests for `useThrottledCallback` function in `packages/react-sketch-canvas/src/Canvas/__test__/utils.test.tsx`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/vinothpandian/react-sketch-canvas/issues/163?shareId=XXXX-XXXX-XXXX-XXXX).

* fix: tests

* fix: set default throttleTime to 0

* chore: remove lint in ci

* fix: workflow
Fixes #143

Add support for custom path generator in `ReactSketchCanvas`.

* Add `getSvgPathFromPoints` prop to `ReactSketchCanvas` component to accept a callback function for custom path generation.
* Pass `getSvgPathFromPoints` prop to `Canvas` component.
* Add `getSvgPathFromPoints` prop to `Canvas` component to accept a callback function for custom path generation.
* Pass `getSvgPathFromPoints` prop to `SvgPath` component.
* Modify `SvgPath` component to use the custom path generator if provided.
* Update documentation in `README.md` to include the new `getSvgPathFromPoints` prop and its usage.
* Add tests in `export.spec.tsx` to verify the functionality of the custom path generator.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/vinothpandian/react-sketch-canvas/issues/143?shareId=XXXX-XXXX-XXXX-XXXX).
@ozdevi
Copy link

ozdevi commented Aug 30, 2024

Hi @vinothpandian , any plan to merge it soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom paths
2 participants