This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const restoreState = (canvas, ctx, poping_obj, pushing_obj) => { | |
| if(poping_obj.list.length) { | |
| saveState(canvas, pushing_obj, true); | |
| var restore_state = poping_obj.list.pop(); | |
| var temp_list = poping_obj.list | |
| if(poping_obj.name=='undo'){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const undo = (canvas , ctx) => { | |
| restoreState(canvas, ctx, {name:'undo',list:undo_list}, {name:'redo',list:redo_list}); | |
| } | |
| const redo = (canvas , ctx) => { | |
| restoreState(canvas, ctx, {name:'redo',list:redo_list},{name:'undo',list:undo_list}); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const saveState = (canvas , list ,keep_redo) => { | |
| keep_redo = keep_redo || false; | |
| if(!keep_redo) { | |
| set_redo([]); | |
| } | |
| if (list){ | |
| if (list.name=='undo'){ | |
| set_undo(undo_list=>[...undo_list,canvas.toDataURL()]) | |
| } | |
| else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const [redo_list,set_redo] = useState([]) | |
| const [undo_list,set_undo] = useState([]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Please allow same site scripting to use the script https://stackoverflow.com/a/50902950 | |
| Linkedin = { | |
| config: { | |
| scrollDelay: 3000, | |
| actionDelay: 5000, | |
| nextPageDelay: 5000, | |
| // set to -1 for no limit | |
| maxRequests: -1, | |
| totalRequestsSent: 0, |