react-drawing-board
react-drawing-board copied to clipboard
Tool.Clear is not working properly
Hey there! I have an issue. Here is it: whem im getting my operations stored on backend theyre pasting to the drawboard properly but when im clearing it i can still choose deleted elements. How can i fix that?
@dilidili
I guess i have nice idea how to fix this. You just have to change file SelectTool.tsx a bit like this:
Function onSelectMouseDown now finding operation to select inside array of all operations. But you need to find operation inside array which consist of operations after clear operation was added. Theres code sample:
const lastClearIndex = operationListState.reduced.length - [...operationListState.reduced].reverse().findIndex(operation => operation.tool === Tool.Clear)
const paintedOperations = operationListState.reduced.slice(lastClearIndex);
let selectedItem: Operation | null = findSelectedItem(paintedOperations, pos, scale);
@tar04 I need help. Can i setup it in the nextjs or reactjs ?Please guide
@tar04 I need help. Can i setup it in the nextjs or reactjs ?Please guide
You need help with the issue or to setup whole lib?
@mudasirpandith
@tar04 I want to use editor in my website. that`s setting lib
@tar04 I want to use editor in my website. that`s setting lib
Have you tried instructions from repository?
Or you have some specific problems?
Or you have some specific problems?
I tried to use const DrawingBoard = require('react-drawing-board');
, but i am not able to do it.Showing some conflicts and bunch of error while installing it
@mudasirpandith what about es6 imports?
@mudasirpandith what about es6 imports?
It is not getting installed.
@mudasirpandith what about es6 imports?
It is not getting installed.
What you mean?) you have to install library and types for it if you’re using typescript
i was trying to use it in the React and using Js.
is this correct way to use install npm install react-drawing-board
i was trying to use it in the React and using Js. is this correct way to use install
npm install react-drawing-board
Yes
And then you have to import it inside component you want to use it in
These are the errors it is showing
![]()
These are the errors it is showing
Did you opened project folder in console?
Yes,i am installing in the right directory. Other npm gets installed in that
@tar04
What do you mean “other npm”? @mudasirpandith
What do you mean “other npm”? @mudasirpandith
i mean other packages get installed. Is there any way I can use this editor in my website?
@mudasirpandith You can use cdn server instead, just find the link with the lib and add script with it to your project
@mudasirpandith You can use cdn server instead, just find the link with the lib and add script with it to your project
can you help me out for this? please
@mudasirpandith sure. I’ll be home in 25 mins
@mudasirpandith https://www.jsdelivr.com/package/npm/react-drawing-board
Copy the script, paste in html document and then you should try to find component in window object
Btw what ide do u use?
Btw what ide do u use?
vscode
You can add the package in package.jam file by yourself and the ide should show you hint about uninstalled dependencies
@mudasirpandith