dilidili / react-drawing-board

demo
https://react-drawing-board-demo.dilidili.now.sh
MIT License
68 stars 21 forks source link

Tool.Clear is not working properly #30

Open tar04 opened 9 months ago

tar04 commented 9 months ago

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 commented 9 months ago

@dilidili

tar04 commented 9 months ago

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);
mudasirpandith commented 7 months ago

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

tar04 commented 7 months ago

@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 commented 7 months ago

@mudasirpandith

mudasirpandith commented 7 months ago

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

tar04 commented 7 months ago

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

Have you tried instructions from repository?

tar04 commented 7 months ago

Or you have some specific problems?

mudasirpandith commented 7 months ago

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

tar04 commented 7 months ago

@mudasirpandith what about es6 imports?

mudasirpandith commented 7 months ago

@mudasirpandith what about es6 imports?

It is not getting installed.

tar04 commented 7 months ago

@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

mudasirpandith commented 7 months ago

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

tar04 commented 7 months ago

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 commented 7 months ago

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

mudasirpandith commented 7 months ago

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

tar04 commented 7 months ago

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

Did you opened project folder in console?

mudasirpandith commented 7 months ago

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

mudasirpandith commented 7 months ago

@tar04

tar04 commented 7 months ago

What do you mean “other npm”? @mudasirpandith

mudasirpandith commented 7 months ago

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?

tar04 commented 7 months ago

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

mudasirpandith commented 7 months ago

@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

tar04 commented 7 months ago

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

tar04 commented 7 months ago

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

tar04 commented 7 months ago

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

tar04 commented 7 months ago

Btw what ide do u use?

mudasirpandith commented 7 months ago

Btw what ide do u use?

vscode

tar04 commented 7 months ago

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

tar04 commented 7 months ago

@mudasirpandith

mudasirpandith commented 7 months ago

I am totally lost into this. Can you please guide me step by step?

@mudasirpandith

tar04 commented 7 months ago

I am totally lost into this. Can you please guide me step by step?

@mudasirpandith

Yup. Do you hame smth like discord? JUst to text you there

mudasirpandith commented 7 months ago

yeah, discord username :mudasirpandith

I am totally lost into this. Can you please guide me step by step?

@mudasirpandith

Yup. Do you hame smth like discord? JUst to text you there

tar04 commented 7 months ago

@mudasirpandith added