react-drawing-board icon indicating copy to clipboard operation
react-drawing-board copied to clipboard

Tool.Clear is not working properly

Open tar04 opened this issue 1 year ago • 34 comments

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?

tar04 avatar Oct 20 '23 11:10 tar04

@dilidili

tar04 avatar Oct 20 '23 23:10 tar04

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 avatar Oct 24 '23 09:10 tar04

@tar04 I need help. Can i setup it in the nextjs or reactjs ?Please guide

mudasirpandith avatar Dec 22 '23 12:12 mudasirpandith

@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?

tar04 avatar Dec 22 '23 12:12 tar04

@mudasirpandith

tar04 avatar Dec 22 '23 12:12 tar04

@tar04 I want to use editor in my website. that`s setting lib

mudasirpandith avatar Dec 22 '23 12:12 mudasirpandith

@tar04 I want to use editor in my website. that`s setting lib

Have you tried instructions from repository?

tar04 avatar Dec 22 '23 12:12 tar04

Or you have some specific problems?

tar04 avatar Dec 22 '23 12:12 tar04

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 avatar Dec 22 '23 12:12 mudasirpandith

@mudasirpandith what about es6 imports?

tar04 avatar Dec 22 '23 12:12 tar04

@mudasirpandith what about es6 imports?

It is not getting installed.

mudasirpandith avatar Dec 22 '23 12:12 mudasirpandith

@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

tar04 avatar Dec 22 '23 12:12 tar04

i was trying to use it in the React and using Js. is this correct way to use install npm install react-drawing-board

mudasirpandith avatar Dec 22 '23 13:12 mudasirpandith

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

tar04 avatar Dec 22 '23 13:12 tar04

And then you have to import it inside component you want to use it in

tar04 avatar Dec 22 '23 13:12 tar04

Screenshot 2023-12-22 183730 image These are the errors it is showing

mudasirpandith avatar Dec 22 '23 13:12 mudasirpandith

Screenshot 2023-12-22 183730 image These are the errors it is showing

Did you opened project folder in console?

tar04 avatar Dec 22 '23 13:12 tar04

Yes,i am installing in the right directory. Other npm gets installed in that

mudasirpandith avatar Dec 22 '23 13:12 mudasirpandith

@tar04

mudasirpandith avatar Dec 22 '23 13:12 mudasirpandith

What do you mean “other npm”? @mudasirpandith

tar04 avatar Dec 22 '23 14:12 tar04

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 avatar Dec 22 '23 14:12 mudasirpandith

@mudasirpandith You can use cdn server instead, just find the link with the lib and add script with it to your project

tar04 avatar Dec 22 '23 14:12 tar04

@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 avatar Dec 22 '23 14:12 mudasirpandith

@mudasirpandith sure. I’ll be home in 25 mins

tar04 avatar Dec 22 '23 14:12 tar04

@mudasirpandith https://www.jsdelivr.com/package/npm/react-drawing-board

tar04 avatar Dec 22 '23 14:12 tar04

Copy the script, paste in html document and then you should try to find component in window object

tar04 avatar Dec 22 '23 14:12 tar04

Btw what ide do u use?

tar04 avatar Dec 22 '23 14:12 tar04

Btw what ide do u use?

vscode

mudasirpandith avatar Dec 22 '23 14:12 mudasirpandith

You can add the package in package.jam file by yourself and the ide should show you hint about uninstalled dependencies

tar04 avatar Dec 22 '23 14:12 tar04

@mudasirpandith

tar04 avatar Dec 22 '23 14:12 tar04